Remote configuration download fails with GitLab due to hardcoded propietary PAT authentication scheme
还没有人认领这个 Issue。
评估
- 难度
- 1/5
- 预计耗时
- 1 小时以内
- 新手友好度
- 85/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- github, gitlab, go
调研方向
从 pkg/engine/config.go 中构建远程配置请求并设置 Authorization 和 Accept 头(值来自 gitAuth.envSecret)的代码开始。在将认证方案切换为 Bearer 之前,确认 GitLab 不需要 GitHub 专用的 Accept: application/vnd.github.v3+json 头,并检查同一个包中与远程配置下载相关的现有测试。完成意味着报告中的 GitLab URL 使用 PAT 返回 200,并且现有 GitHub 路径仍然可用。
由索引模型根据 Issue 内容生成。
描述
FetchIt fails to download remote configuration files hosted in private GitLab repositories when using PAT authentication through gitAuth.envSecret.
The current implementation in pkg/engine/config.go uses a GitHub-specific authorization scheme:
req.Header.Add("Authorization", "token "+pat)
req.Header.Add("Accept", "application/vnd.github.v3+json")
GitLab supports Authorization: Bearer and PRIVATE-TOKEN headers for access token authentication through its REST API.
Steps to reproduce
- Create a private GitLab repository containing a FetchIt configuration file.
- Generate an access token with
read_repositorypermissions. - Expose the token to FetchIt using a Podman secret:
Secret=gitlab_token,type=env,target=GITLAB_TOKEN
- Configure FetchIt to reload its configuration using the GitLab repository files API:
gitAuth:
envSecret: GITLAB_TOKEN
configReload:
schedule: "*/1 * * * *"
configUrl: "https://gitlab.example.com/api/v4/projects/123/repository/files/config%2Ffetchit.yaml/raw?ref=main"
Actual behavior
The remote configuration download fails.
The issue can be reproduced independently of FetchIt using curl against the same URL with the same access token.
| Authentication header | HTTP response |
|---|---|
Authorization: token <PAT> |
404 |
Authorization: Bearer <PAT> |
200 |
PRIVATE-TOKEN: <PAT> |
200 |
Both successful requests return the expected YAML configuration.
The HTTP 404 response appears to be caused by GitLab concealing the existence of an inaccessible private resource rather than by an incorrect URL.
Expected behavior
FetchIt should support authenticated remote configuration downloads from Git providers other than GitHub, including GitLab.
Suggested solution
Replace the GitHub-specific token authentication scheme
with the standardized Bearer authentication scheme:
- req.Header.Add("Authorization", "token "+pat)
+ req.Header.Add("Authorization", "Bearer "+pat)
Bearer authentication is defined in RFC 6750 and is
supported by both GitHub and GitLab.
GitHub's official REST API documentation explicitly supports
both Bearer and token authentication schemes.
This change would improve interoperability without introducing
additional configuration options or provider-specific logic..
References
- Related Podman secret support: PR #286
- GitLab REST API authentication
- GitLab repository files API
Scope
This issue concerns HTTP authentication for remote configuration downloads, not Git repository clone or fetch operations.
- 主要语言
- Go
- 星标
- 178
- 派生
- 25
- 平均合并
- 1 天 2 小时
- 30 天内合并 PR
- 2
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
containers/fetchit 的其他 Issue
-
Clone from public Codeberg repository fails with authentication required可能已有人在做 @cooktheryan 于 16 天前认领。 未关闭
难度 3/5 半天 新手友好度 65/100
containers/fetchit#425 · 3 条评论 · 1 个 reaction ·
-
难度 5/5 一周以上 新手友好度 25/100
containers/fetchit#242 ·
-
packaging the fetchit systemd services into RPM?可能重新可做 @cooktheryan 于 1557 天前认领,目前没有进行中的 PR。 未关闭
containers/fetchit#218 · 已指派 1 人 ·
-
难度 5/5 一周以上 新手友好度 25/100
containers/fetchit#216 · 2 条评论 ·
-
enhancement
难度 3/5 1-2 天 新手友好度 35/100
containers/fetchit#210 ·
查看 containers/fetchit 的全部 Issue
相似的 Issue
-
Area/Agent Lifecycle Aspect/Build & Deploy Severity/Major Type/Bug
难度 2/5 1-3 小时 新手友好度 86/100
wso2/agent-manager#2603 ·
维护者通常 1 天内回复
-
[Enhancement] platform-engineer: a definition change does not re-render running Applications; say how to roll it out可能已有人在做 @anoop2811 今天认领。 未关闭needs-triage type/enhancement
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
Area/Policies Aspect/API Severity/Major Type/Bug
难度 2/5 1-3 小时 新手友好度 76/100
wso2/api-platform#4468 ·
维护者通常 1 天内回复
-
review: medium
难度 2/5 1-3 小时 新手友好度 78/100
1lck/Lithe-IDEA#2432 ·
维护者通常 1 天内回复
-
bug needs-triage
难度 2/5 1-3 小时 新手友好度 86/100
dsx-ai-factory/health-validation#368 ·
维护者通常 2 天内回复