[Bug][Blueprint] Cron-triggered pipelines use a sanitized plan after PATCH /blueprints, gitextractor fails with masked credentials
Maintainer thường phản hồi trong vòng 3 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 56/100
Hướng nghiên cứu
Read backend/server/services/blueprint.go around PatchBlueprint, saveBlueprint, and reloadBlueprint, then inspect SanitizeBlueprint and pluginOptionSanitizers in backend/server/services/pipeline.go. Trace how the cron job and API response share the blueprint plan, then review existing blueprint service tests. Done means cron runs after a PATCH use the stored credentials while the API response still masks them.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Search before asking
- I had searched in the issues and found no similar issues.
What happened
After updating an advanced-mode blueprint through the API (PATCH /blueprints/:id), the next pipeline started by the cron schedule runs with a sanitized (masked) plan. Every gitextractor task fails with:
subtask Clone Git Repo ended unexpectedly
git cmd [git clone https://git:*****@<gitlab-host>/<group>/<repo>.git /tmp/gitextractorXXXX --bare] failed
remote: HTTP Basic: Access denied. ...
The token stored in the database is correct:
- Triggering the same blueprint manually (
POST /blueprints/:id/trigger) clones every repo fine. - After a
lakerestart, cron runs work again until the next PATCH.
In our case it was 1330/1330 gitextractor tasks failing in a cron run, while the same repos cloned fine in a manual run of the same plan a few hours earlier.
Root cause (v1.0.3-beta15, still present on main):
PatchBlueprint→saveBlueprint→reloadBlueprint(blueprint)registers the cron job with the same pointer:
cronManager.AddJob(blueprint.CronConfig, &BlueprintJob{blueprint})(backend/server/services/blueprint.go).- Right after saving,
PatchBlueprintcallsSanitizeBlueprint(blueprint)on that same object to build the API response. - The
gitextractorsanitizer (pluginOptionSanitizersinbackend/server/services/pipeline.go) replaces the password inoptions["url"]with*in place. - When the cron fires,
BlueprintJob.Run()callscreatePipelineByBlueprint(bj.Blueprint, ...), which for advanced mode usesblueprint.Planas is. The new pipeline gets the masked URL.
TriggerBlueprint and ReloadBlueprints (at startup) load the blueprint from the DB, which is why manual runs and runs after a restart are fine. Normal-mode blueprints are not affected, because their plan is regenerated from the connections on each run.
What do you expect to happen
Cron-triggered pipelines should use the stored (unsanitized) plan, the same as manual triggers. Sanitizing the API response should not change the object the scheduler holds.
How to reproduce
- Create an advanced-mode blueprint with a
gitextractortask whoseurlcontains credentials (https://git:<token>@host/group/repo.git), withenable: true,isManual: falseand a cron, e.g.*/5 * * * *. - Update it through the API, e.g.
PATCH /blueprints/:idwith{"cronConfig": "*/5 * * * *"}or with a newplan. - Wait for the cron to fire.
- The
gitextractortask fails withHTTP Basic: Access denied, and the pipeline's task options show the masked URL. - Trigger the same blueprint with
POST /blueprints/:id/trigger: it succeeds.
Anything else
Possible fixes, either of:
- In
BlueprintJob.Run(), reload the blueprint from the DB by id before creating the pipeline. - In
PatchBlueprint(and other handlers that sanitize aftersaveBlueprint), sanitize a deep copy rather than the object passed toreloadBlueprint.SanitizeBlueprintwrites intoblueprint.Plan[i][j], and the option maps are shared.
Workaround: set the blueprint to manual and trigger it from an external scheduler with POST /blueprints/:id/trigger, or restart lake after every blueprint update.
Version
v1.0.3-beta15 (helm chart 1.0.3-beta15). Code verified unchanged on main.
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct
- Ngôn ngữ chính
- Go
- Star
- 3.2k
- Fork
- 824
- Merge trung bình
- 2 ngày 22 giờ
- Pull request đã merge (30 ngày)
- 46
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/devlake
-
[Bug][SonarQube] Migration 20230927145127 is not re-runnable: fails with "constraint _tool_sonarqube_file_metrics_pkey does not exist" after an interrupted runCó thể đã có người làm @chenwei791129 đã nhận hôm nay. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 3 ngày
-
type/bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 64/100
Maintainer thường phản hồi trong vòng 3 ngày
-
[Bug][Blueprint] Scheduled run fails silently when plan generation errorsCó thể đã có người làm @jcamargos đã nhận 1 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 42/100
Maintainer thường phản hồi trong vòng 3 ngày
Tất cả issue của apache/devlake
Issue tương tự
-
Độ khó 2/5 Dưới một giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Low] CSI plugin builds staging directories from storage_volume_id without a containment checkĐang mởarea/security kind/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
agent-substrate/substrate#2935 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
100 points complexity: trivial documentation drips-wave good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
Maintainer thường phản hồi trong vòng 1 ngày
-
automation models
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Guardian health server binds :8080 and collides with the Voltron proxyCó thể đã có người làm @denislemire đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
projectcalico/calico#14341 ·
Maintainer thường phản hồi trong vòng 1 ngày