[Bug][Blueprint] Cron-triggered pipelines use a sanitized plan after PATCH /blueprints, gitextractor fails with masked credentials
I maintainer di solito rispondono entro 3 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 56/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Go
- Stelle
- 3.2k
- Fork
- 824
- Merge medio
- 2g 21h
- PR unite (30g)
- 48
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di apache/devlake
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
apache/devlake#9246 · 1 reazione ·
I maintainer di solito rispondono entro 3 giorni
-
[Bug][SonarQube] Migration 20230927145127 is not re-runnable: fails with "constraint _tool_sonarqube_file_metrics_pkey does not exist" after an interrupted runForse già presa @chenwei791129 l’ha presa 2 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
I maintainer di solito rispondono entro 3 giorni
-
[Bug][GitHub] Closed (unmarked) Pull Requests are re-fetched on every runForse già presa @dvecy l’ha presa 1 giorno fa. Apertatype/bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 64/100
apache/devlake#9240 · 1 commento ·
I maintainer di solito rispondono entro 3 giorni
-
[Bug][Blueprint] Scheduled run fails silently when plan generation errorsForse già presa @jcamargos l’ha presa 3 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 3/5 Mezza giornata Idoneità per principianti 62/100
I maintainer di solito rispondono entro 3 giorni
Tutte le issue di apache/devlake
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
Mend: dependency security vulnerability
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
kube-tarian/sigrun#202 ·
-
good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
eugenioenko/ttt#1085 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
fullsend-ai/fullsend#8688 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
question raised-by:verifier
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
medici-finance/assay#4013 ·
I maintainer di solito rispondono entro 1 giorno