Task · SKT-0096

Restrict git source token variables to an allowlisted prefix

Description

POST /control/blueprints/sources accepts any HTTPS URL and any TokenEnvVar name (internal/bpsource/source_validation.go), and the fetch sends that variable’s value as Basic auth (nanogit client via os.Getenv in cmd/synthkit/main.go). A control-plane user can therefore name any process env var (stack tokens, self-obs credential, CONTROL_TOKEN) and send it to a host of their choosing. Today the control-plane token holder is usually also the env owner, so the impact is limited, but any deployment where control access is delegated is exposed. Restrict TokenEnvVar to GIT_TOKEN_* (empty keeps the GIT_TOKEN default) and add an optional GIT_SOURCE_HOST_ALLOWLIST.

Acceptance Criteria

Definition of Done

Implementation Plan

Isolated candidate with frozen ownership; acceptance reproduction, focused checks and just check; independent review before root landing. HA seam design is independently challenged and frozen first.

Implementation Notes

loop1: implementation attempts 1, review-repair rounds 1 (Compose policy override). Land7232114bf410f16dc45f8e58449fcf151345a44c; composed just check exit0 exactSHA. Integrated CI run37696196429 atf3d701a1a4500eb2944a0a354c53a9c641fed371 green; earlier723 run37695831947 cancelled, not pass. Complete final CodeRabbit13/13 and security ACCEPT. One minor custom Go settings in isolated CLI test retained; empty allowlist intentionally allows hosts, DNS rebinding out of policy scope. Generation not applicable; no renderer changes, composed inventory/fidelity checks unchanged.

Final Summary

Forbid non-GIT_TOKEN secret-variable references before lookup; configured host policy applies at validation and real local-TLS fetch, redirects refused. Resolved env-file configuration wired at composition root; empty/default/explicit GIT_TOKEN compatible. Evidence /tmp/skt-0096-D96/acceptance-report.json and /tmp/skt-0096-D96/security-review.log; guarded review and exact integrated gate/CI green.

View the source file on GitHub