Summary
Pre-existing shell-injection surface in lib/adapters/pr-merge-gitlab.ts:86. The repo arg is interpolated raw into the shell command:
return repo !== undefined ? `${parts.join(' ')} -R ${repo}` : parts.join(' ');
This is the same injection class as PR #403/#407 (which fixed pr-merge-github.ts). The GitLab mirror was not flagged in the original code-reviewer pass and remains unpatched.
Active exploitability: Mitigated by repoOptionalSchema (regex blocks shell metacharacters at the handler boundary). This is a defence-in-depth fix — every other parts.push() in this function uses shellEscape() (line 84 escapes squashMessage).
Implementation Steps
-
Update lib/adapters/pr-merge-gitlab.ts line 86:
return repo !== undefined ? `${parts.join(' ')} -R ${shellEscape(repo)}` : parts.join(' ');
-
The shellEscape helper is already defined locally at line 65 — no import needed.
-
Add a regression test in lib/adapters/pr-merge-gitlab.test.ts injecting a hostile repo value (e.g. 'sec/repo'\\''; echo PWNED; #') and verifying the dangerous chars stay inside single-quoted argv tokens.
Test Procedures
- Run
bun test lib/adapters/pr-merge-gitlab.test.ts — all should pass.
- Inject
'sec/repo'\\''; echo PWNED; #' as the repo arg and verify no breakout.
- Run full suite — confirm no regressions.
Acceptance Criteria
Dependencies
Metadata
| Field |
Value |
| Repository |
Wave-Engineering/mcp-server-sdlc |
| Surfaced by |
code-reviewer trust-score gate (plan #390 audit byproduct) |
Summary
Pre-existing shell-injection surface in
lib/adapters/pr-merge-gitlab.ts:86. Therepoarg is interpolated raw into the shell command:This is the same injection class as PR #403/#407 (which fixed
pr-merge-github.ts). The GitLab mirror was not flagged in the original code-reviewer pass and remains unpatched.Active exploitability: Mitigated by
repoOptionalSchema(regex blocks shell metacharacters at the handler boundary). This is a defence-in-depth fix — every otherparts.push()in this function usesshellEscape()(line 84 escapessquashMessage).Implementation Steps
Update
lib/adapters/pr-merge-gitlab.tsline 86:The
shellEscapehelper is already defined locally at line 65 — no import needed.Add a regression test in
lib/adapters/pr-merge-gitlab.test.tsinjecting a hostilerepovalue (e.g.'sec/repo'\\''; echo PWNED; #') and verifying the dangerous chars stay inside single-quoted argv tokens.Test Procedures
bun test lib/adapters/pr-merge-gitlab.test.ts— all should pass.'sec/repo'\\''; echo PWNED; #'as therepoarg and verify no breakout.Acceptance Criteria
pr-merge-gitlab.ts:86shell-escapesrepoviashellEscape()Dependencies
Metadata