Repository navigation
Cover regex-shaped MCP gateway masks in artifact redaction - #66041
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ PR Code Quality Reviewer completed the code quality review. No GitHub write was possible from the shell because safeoutputs execution was permission-gated.
|
|
✅ Ponytail Reviewer completed successfully! Lean already. Ship.
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality Sentinel skipped because pre-fetch PR data was unavailable: unable to fetch test file diff
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft. No ADR enforcement needed for PR #66041: the PR does not carry the 'implementation' label and has 0 new lines in business logic directories (1 file changed, threshold 100).
|
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused regression test accurately covers the reported failure and expected sanitization behavior.
Review effort: Balanced
Findings: None
What changed in this PR
Adds regression coverage ensuring regex-shaped, multiline MCP gateway masks are treated literally during artifact redaction.
Changes:
- Tests sanitization of agent logs and JSONL artifacts.
- Verifies redaction completes without warnings, failures, or source deletion.
| File | Description |
|---|---|
actions/setup/js/runtime_mask_publication.test.cjs |
Adds end-to-end regression coverage for multiline gateway masks. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Reviewed the added regression test for regex-shaped multiline MCP gateway masks.
Findings: None blocking. The test is well-targeted: it exercises redactMaskedValues/redactArtifactMaskedValues with mask text containing regex metacharacters ((?:, \", +) and embedded newlines, confirming literal (non-regex) matching sanitizes both the agent-stdio log and a JSONL artifact without triggering core.setFailed/core.warning or deleting the source. Verified locally — test passes.
This is a test-only change (no production code modified), consistent with the PR description. No action needed.
🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · copilot · sonnet50 · 28.4 AIC · ⌖ 14 AIC · ⊞ 8.2K
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /tdd — no actionable issues found; approving.
📋 Analysis
This is a focused, test-only regression addition (no production code changes), consistent with the PR description.
Verification performed: I manually traced the redaction pipeline (collectAddMaskedValues → redactMaskedValues / redactArtifactMaskedValues) against the new regex-shaped, multiline mask value and confirmed the implementation produces exactly the outputs asserted in the new test (***\n***\n***\n for the stdio log, {"body":"***\n***\n***"} for the JSON source). This confirms secrets are matched literally (not compiled as a regex), which is the behavior the regression guards against.
TDD review (/tdd):
- ✅ Descriptive test name reads as a specification: "sanitizes regex-shaped multiline gateway text without removing artifacts"
- ✅ Mirrors the existing sibling test ("oversized runtime masks") in structure and assertion style — consistent with codebase conventions
- ✅ Exercises a real edge case (regex metacharacters
(?:,$, unescaped quotes, embedded newlines) that caused the original production bug (#65833) - ✅ Asserts both the absence of failure (
setFailed/warningnot called) and the positive sanitization outcome — good coverage of both the regression symptom and the fix - No gaps identified; no further test cases needed for this change's scope
Positive highlights:
- ✅ Clean reuse of existing
write/redactSourcestest harness helpers - ✅ Good regression coverage without introducing unnecessary production complexity
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · 45.2 AIC · ⌖ 13.4 AIC · ⊞ 10.2K
Comment /matt to run again
Comment MemoryPeek at saved memory (pr-code-quality-reviewer)Note This comment is managed by comment memory.Expand the saved memory block to view or edit the persistent context for this thread.
|
There was a problem hiding this comment.
Request changes
This PR only adds regression coverage, and the new test currently targets a synthetic patch fragment instead of the real gateway mask shape that broke redaction.
Blocking theme
The added fixture keeps ${MCP_GATEWAY_AGENT_ID} unresolved and includes leading + diff markers on subsequent lines. Because of that, it does not demonstrate that the rendered multiline gateway shell text from the actual setup path can be redacted safely end to end, which is the whole point of the regression.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 35.4 AIC · ⌖ 5.57 AIC · ⊞ 21.1K
Comment /review to run again
| }); | ||
|
|
||
| it("sanitizes regex-shaped multiline gateway text without removing artifacts", async () => { | ||
| const mask = '(?:${MCP_GATEWAY_AGENT_ID}\\"\\\n+ export MCP_GATEWAY_AGENT_ID\n+ export MCP_GATEWAY_PAYLOAD_DIR="/tmp/gh-aw/mcp-payloads"'; |
There was a problem hiding this comment.
This fixture does not model the runtime mask that actually broke redaction, so the regression can pass while the production case stays untested.
💡 Why this blocks merge
The new mask literal still contains the unresolved ${MCP_GATEWAY_AGENT_ID} placeholder and prefixes the following lines with + diff markers, but the real value passed through ::add-mask:: is the rendered gateway shell text, not a patch fragment. As written, this test mostly proves we can redact this synthetic string shape; it does not prove #65833 stays fixed for the actual multiline gateway payload.
Please build the fixture from the real rendered shell snippet (or the exact failing payload from the bug) instead of embedding diff artifacts. Even a small helper such as const mask = actualGatewayLines.join( ) would make this exercise the same text shape production emits.
There was a problem hiding this comment.
Updated in $(git rev-parse --short HEAD): the fixture now uses the rendered gateway export lines, with the runtime agent ID concretely expanded and no diff markers. The log and JSONL assertions verify sanitization without source removal.
|
@copilot address the following outstanding work in one pass:
Push the necessary fixes, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved. Use the pr-finisher skill and stop when only human review or CI remains; do not trigger CI. Sous-chef head: 84683ff
|
…daction-issue Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
|
🎉 This pull request is included in a new release. Release: |
In v0.90.3, secret redaction could fail with an invalid regular expression when a runtime mask contained generated MCP gateway shell text. The failure removed artifact sources instead of uploading sanitized files.