Jagster
(Jakke Lehtonen)
1
继续讨论 Masonry Image Gallery:
标题说明了一切,我想。
在我从 2.9.0.beta11 (208d22cfc2) 重建后,来自 GitLab 的所有主题或组件在安装或更新时都会出现 500 错误。
这是一个 bug 还是某种安全问题?我的设置没有任何奇怪之处,而且相当基础。
这可能与之有关。当我尝试安装一个主题时出现了这个问题:
消息(报告了 2 条)
无法正确处理劫持的响应:RemoteTheme::ImportError:克隆 git 存储库时出错,访问被拒绝或找不到存储库
回溯
/var/www/discourse/lib/theme_store/git_importer.rb:81:in `raise_import_error!'
/var/www/discourse/lib/theme_store/git_importer.rb:148:in `rescue in clone_http!'
/var/www/discourse/lib/theme_store/git_importer.rb:145:in `clone_http!'
/var/www/discourse/lib/theme_store/git_importer.rb:93:in `clone!'
/var/www/discourse/lib/theme_store/git_importer.rb:18:in `import!'
/var/www/discourse/app/models/remote_theme.rb:82:in `import_theme'
/var/www/discourse/app/controllers/admin/themes_controller.rb:106:in `block in import'
/var/www/discourse/lib/hijack.rb:56:in `instance_eval'
/var/www/discourse/lib/hijack.rb:56:in `block in hijack'
/var/www/discourse/lib/scheduler/defer.rb:94:in `block in do_work'
环境
HTTP HOSTS:foorumi.katiska.eu
4 个赞
pfaffman
(Jay Pfaffman)
2
您是指 GitLab 还是 GitHub?这些是以前可以工作的主题组件吗?这可能是暂时的网络问题。您正在访问的主题是否已被删除或受保护?
如果是公开的,您可以分享它们的网址,以便其他人尝试访问它们。
Jagster
(Jakke Lehtonen)
3
GitLab。基于 GitHub 的那些都没问题。
是的。如果从 zip 安装,它们仍然可以工作。现在的问题是连接 Discourse 和 Gitlab。
否,都不是。
当然。您可以试试 Masonry Image Gallery — 链接在第一篇帖子中。
我什么都不知道,但凭直觉,URL 的规范化(或类似的东西)会将 gitlab 改为 github,这就是为什么找不到存储库。
2 个赞
RGJ
(Richard - Communiteq)
5
几乎可以肯定是由于 SSRF 保护 的修复。
Gitlab 将 git clone 从 https://gitlab.com/silentboatman/discourse-masonry-image-gallery 重定向为 301 到 https://gitlab.com/silentboatman/discourse-masonry-image-gallery.git/(注意,以 .git/ 结尾),但 git 调用时使用了 -c http.followRedirects=false,因此失败了。
直接输入 https://gitlab.com/silentboatman/discourse-masonry-image-gallery.git/ 作为仓库 URL 不起作用,因为 FinalDestination.resolve(@uri.to_s) 会将其改回 https://gitlab.com/silentboatman/discourse-masonry-image-gallery,原因在于,您可能不会相信,当在 git 外部请求时,重定向会反向进行!Gitlab 会将 https://gitlab.com/silentboatman/discourse-masonry-image-gallery.git/ 重定向为 302 到 https://gitlab.com/silentboatman/discourse-masonry-image-gallery。
编辑:使用 GIT_CURL_VERBOSE=1,我能够看到 Git 在克隆时会附加 info/refs?service=git-upload-pack,因此
GET /silentboatman/discourse-masonry-image-gallery/info/refs?service=git-upload-pack HTTP/2
会重定向到
location: https://gitlab.com/silentboatman/discourse-masonry-image-gallery.git/info/refs?service=git-upload-pack
5 个赞
Jagster
(Jakke Lehtonen)
6
那么——最大的问题(™)是:最近发生了什么变化?我们(这里的我们是指除我以外的所有人)该如何解决这个问题?
1 个赞
RGJ
(Richard - Communiteq)
8
(此外,现在添加存储库时导致错误的多数操作似乎会弹出一个仅包含“500 服务器错误”文本的弹出窗口,而不是实际的错误消息)
1 个赞
我认为这个修复(如下)可以解决这个问题,但我仍然收到同样的错误。
我现在使用的是 2.9.0.beta11 +143 (795687160d)。
@daniel 这个修复与本主题中的问题有关吗?
1 个赞
daniel
(Daniel Waterworth)
11
是的,该提交是为了修复从 GitLab 获取。我刚刚试了一下,现在可以通过 SSH 和 HTTP 克隆 GitLab 仓库了。你能详细说明一下你具体在做什么导致无法工作吗?
@Jagster,这对你来说还是个问题吗?
4 个赞
RGJ
(Richard - Communiteq)
12
我也在更新到 beta12 后看到了这个问题。
URL 格式似乎很重要。
https://gitlab.com/silentboatman/discourse-masonry-image-gallery/ –> 错误
https://gitlab.com/silentboatman/discourse-masonry-image-gallery –> 错误
https://gitlab.com/silentboatman/discourse-masonry-image-gallery.git –> 可以
这意味着您需要删除并重新添加格式为前两种之一的主题组件,并复制配置。但如果这两种格式也能开箱即用的话,那就太棒了。
6 个赞
是的,在 URL 末尾添加 .git 似乎可行。太棒了!
更多细节如下。我安装了 discourse-masonry-image-gallery,在更新 Discourse 后收到了以下错误消息。
我记得是从没有 .git 的 URL 安装的,因为示例 URL 的末尾没有 .git。
我还尝试从 gitlab 安装另一个主题(没有 .git),并收到了以下消息。
在上面的测试中,我尝试安装 discourse-agora-theme,它也是一个公共的 gitlab 仓库。
3 个赞
Jagster
(Jakke Lehtonen)
14
在 beta12 之后,使用 .git 就可以正常工作了。不过我没有尝试不使用 .git 的情况。
2 个赞