Skip to content

fix(blueprint): keep the scheduled plan unmasked after PATCH /blueprints - #9247

Merged
klesh merged 1 commit into
apache:mainfrom
Thanatos9404:fix/blueprint-patch-keeps-scheduled-plan
Oct 26, 2026
Merged

klesh merged 1 commit into
apache:mainfrom
Thanatos9404:fix/blueprint-patch-keeps-scheduled-plan

Conversation

@Thanatos9404

Copy link
Copy Markdown
Contributor

Summary

After PATCH /blueprints/:id, PatchBlueprint sanitized the same blueprint object the cron job had just been given, and the gitextractor sanitizer rewrote options["url"] in place. Scheduled runs then cloned with a masked URL until the server restarted. Normal-mode blueprints with credentials in beforePlan or afterPlan were affected too, since those tasks are shared with the generated plan.

Sanitizing now works on copies: the options map is cloned before masking, SanitizeTask returns a new task, and SanitizeBlueprint and SanitizePipeline build a new plan. PatchBlueprint sanitizes a copy for its response, so the returned plan is still masked. Its beforePlan and afterPlan now come back unmasked, as GET already returns them; before, they were masked only through this aliasing.

Two new unit tests in blueprint_test.go fail on main and pass here, and go test, go vet and golangci-lint are clean for server/services.

Does this close any open issues?

Closes #9243

PatchBlueprint sanitized the blueprint it had just handed to the cron
job, and the gitextractor sanitizer rewrote the options map in place.
The next scheduled pipeline then cloned with a masked URL until the
server restarted. Normal-mode blueprints with credentials in beforePlan
or afterPlan were hit too, since those tasks are shared with the
generated plan.

Sanitizing now works on copies: SanitizePluginOption masks a clone of
the options, SanitizeTask returns a new task, and SanitizeBlueprint and
SanitizePipeline build a new plan. PatchBlueprint sanitizes a copy of
the saved blueprint for its response, so the plan it returns is still
masked.

Closes apache#9243

Signed-off-by: Yashvardhan Thanvi <yashvt9404@gmail.com>

@klesh klesh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch.
Thanks for your contribution.

@klesh
klesh merged commit 56826a5 into apache:main Oct 26, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants