Commit 434aada
fix(engine): reject path-traversal repo segments on the governor-ledger write path (#8469)
normalizeOptionalRepoFullName in the engine only checked for exactly two
non-empty segments, so "../evilrepo" normalized unchanged (owner "..", repo
"evilrepo") and was persisted by appendGovernorEvent's SQLite INSERT. The
miner-lib siblings already reject this class via repo-clone.ts's
isValidRepoSegment (#5831/#7525/#7795), and miner-lib's own guarded copy covers
its read/purge paths -- but the write path delegates to this engine function,
which never got the guard.
Restates the guard locally (the engine must not import from the miner package,
which depends on it) with isValidRepoSegment's exact semantics: /^[A-Za-z0-9._-]+$/
plus rejecting a bare "."/".." segment. Signature, return type, and the
null-passthrough are unchanged.
Closes #8350
Co-authored-by: RealDiligent <nft.gold.eth@gmail.com>1 parent 5d34f85 commit 434aada
3 files changed
Lines changed: 43 additions & 0 deletions
File tree
- packages/loopover-engine
- src
- test
- test/unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
39 | 49 | | |
40 | 50 | | |
41 | 51 | | |
42 | 52 | | |
43 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
44 | 58 | | |
45 | 59 | | |
46 | 60 | | |
| |||
Binary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
63 | 92 | | |
64 | 93 | | |
65 | 94 | | |
| |||
0 commit comments