fix(sandbox-daemon): reject duplicate secondary repoName entries - #6984
Closed
pedrofrxncx wants to merge 1 commit into
Closed
fix(sandbox-daemon): reject duplicate secondary repoName entries#6984pedrofrxncx wants to merge 1 commit into
pedrofrxncx wants to merge 1 commit into
Conversation
Two git.repositories entries with the same repoName resolve to the same paths.SecondaryRepoDir directory. cloneSecondaryRepos collects every job before any directory exists to skip on, so both clones fan out concurrently into the same directory, corrupting the checkout. validateGit now rejects a duplicate repoName across git.repositories, closing the gap at the trust boundary where this config crosses in from off-pod. Verify: go test ./internal/config/... (from packages/sandbox/daemon-go).
Collaborator
Author
|
Closing as stale: this PR sat past the bot's 48h merge window, main has moved on, and its CI results no longer reflect the current base. This is a housekeeping close, not a rejection of the change — if the underlying problem still exists, the bot will find it again and open a fresh, rebased PR. [studio-bot:stale-close] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug found while auditing
packages/sandbox/daemon-go/internal/config/andinternal/gitx/for missing validation/error-handling gaps.Failure scenario:
git.repositoriesis a config patch surface reaching in from off-pod (the org's own client).paths.SecondaryRepoDir(repoDir, name)maps arepoNamedeterministically to one clone directory, butvalidateGitonly validated eachrepoName's shape individually — never that it's unique across the array.Orchestrator.cloneSecondaryRepos(internal/setup/orchestrator.go) builds its full job list (one job per repository) before any directory exists to skip on, then fans every job out concurrently (secondaryCloneConcurrency = 4) viaSpawnClone. Two entries with the samerepoNametherefore become twogit cloneprocesses racing to write the same directory at once — a corrupted checkout, not a clean rejection.Fix:
validateGitnow tracks seenrepoNames and rejects a duplicate at the same trust boundary where every other per-repo shape check already lives, before it ever reaches the orchestrator's fan-out.Regression test:
TestValidateGitRejectsDuplicateSecondaryRepoNamesinvalidate_test.go— two repositories with the samerepoName, assertsvalidateGitreturns a rejection reason instead of "".Reviewer command:
cd packages/sandbox/daemon-go && go test ./internal/config/...Local checks run:
go test ./internal/config/...(green),gofmt -lon both touched files (clean),go vet ./internal/config/...(clean). Full CI (daemon-e2e, rust-checks etc.) validates the rest.Summary by cubic
Rejects duplicate secondary
repoNameentries ingit.repositoriesso two entries pointing to the same clone directory no longer race to clone concurrently. Previously,validateGitonly checked each entry individually, so the orchestrator could launch twogit cloneprocesses into the same directory, corrupting the checkout. Now the validation rejects duplicates at the trust boundary before they reach the fan-out.Written for commit 610c885. Summary will update on new commits.