Commit 27cce76
fix(sandbox): SRP split + shellEscape cloneUrl + drop URL from logs
Three review fixes bundled:
1) SRP per sweetmantech: split app/workflows/buildOrgSnapshot.ts into
- app/workflows/buildSnapshotStep.ts (the "use step" function)
- app/workflows/buildOrgSnapshotWorkflow.ts (the "use workflow"
function — filename now matches the export, addressing the
cubic P2 about filename mismatch)
2) P0 command injection (cubic): wrap cloneUrl with shellEscape() in
the `git clone --depth=1 ...` command. The Zod + parseGitHubRepoUrl
validators upstream of this workflow already reject anything that
doesn't match `^https:\/\/github\.com\/recoupable\/...`, so this
isn't exploitable today — but shell-escaping is defense-in-depth
that survives validator changes. Zero behavior change for valid
inputs (extra single quotes around an already-clean URL).
3) P1 credential leak (cubic): dropped `cloneUrl` from every log line
in the workflow + kick. The `https://user:token@github.com/...`
shape is also blocked by the regex validator, but log scrubbing
is the cheaper of the two layers if the validator ever loosens.
`sandboxName` (the regex-extracted repo name only) remains in logs
— uniquely identifies the org for observability without
exposing tokens.
Out of scope: cubic's P2 about duplicate workflow runs (same
fire-and-forget pattern as open-agents — duplicates are wasteful but
not incorrect; can add a Vercel Workflow idempotency key in a
follow-up if observed in practice).
Tests: existing handler tests still pass unchanged (the kick is mocked
at the lib path, which didn't change). Suite remains 2577 / 2577.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 60265ee commit 27cce76
4 files changed
Lines changed: 86 additions & 62 deletions
File tree
- app/workflows
- lib/sandbox
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
19 | 24 | | |
20 | 25 | | |
21 | 26 | | |
| |||
24 | 29 | | |
25 | 30 | | |
26 | 31 | | |
27 | | - | |
| 32 | + | |
28 | 33 | | |
29 | 34 | | |
30 | 35 | | |
31 | | - | |
| 36 | + | |
32 | 37 | | |
33 | 38 | | |
34 | 39 | | |
| |||
0 commit comments