Skip to content

Fix built-in MCP backend log file ownership - #69235

Merged
pelikhan merged 4 commits into
mainfrom
pelikhan-fail-closed-log-redaction
Oct 16, 2026
Merged

pelikhan merged 4 commits into
mainfrom
pelikhan-fail-closed-log-redaction

Conversation

@pelikhan

@pelikhan pelikhan commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Ownership/path-access fix only. Secret parsing, its tests, documentation, and changeset are now in independent PR #69244. Both target main and can be reviewed/merged independently; this PR does not modify the parser or claim to fix its large-record/malformed-token defects.

Run the built-in container-backed agenticworkflows MCP backend as the runner UID:GID unless a container user is explicitly configured. Supply container-local writable HOME=/tmp only when absent. Preserve explicit named/numeric users, environment, credentials, actor validation, and other servers.

Verified mechanism and evidence limits

Pinned gh-aw-mcpg v0.4.33 does not propagate the gateway container's user to backend Docker launches. Built-in development/release images default to root; downloaded logs are created with mode 0600. These backend-owned files are unreadable by the runner's post-agent redactor. Fix the producer identity instead of widening permissions or skipping redaction.

Historical optimizer run 38805693127 logged 115 stage=read, code=EACCES diagnostics; reviewer run 38840691314 logged 3 after an independent timeout. These are diagnostic counts, not unique-file counts. Exact failed paths/owners were omitted, so source confirms the mechanism but not definitive attribution of every historical failure.

The performance run's stage=redact, code=unknown is a separate parsing investigation, covered by #69244 with historical attribution limits. Summary overflow, timeout tuning, and health code are unchanged. Fail-closed removal and upload gates remain unchanged.

Validation

  • Focused gateway, redaction, and runtime-publication suites: 237 tests passed on ownership-only revision.
  • npm run typecheck --prefix actions/setup/js passed.
  • PATH="/opt/homebrew/bin:$PATH" TMPDIR="$(cd "${TMPDIR:-/tmp}" && pwd -P)" make agent-report-progress passed build, formatting, lint, schema freshness, and 113 impacted gateway tests. Four pre-existing gateway lint warnings remain, no new warnings.
  • Split read-only security gate: PASS, all ten answers YES. Reviewed identity/access controls, credential destinations, executable boundaries, fail-closed removal, and upload gates. No confirmed vulnerabilities found in the ownership changes; upstream parser defects are not certified or fixed by this verdict.

Docker daemon unavailable, so real container-ownership integration remains unverified. No live workflow reruns/dispatches or raw logs/secret values committed.

Authored Markdown/security impact

Source Change Security impact
tools.md:203 Documents runner identity/default ephemeral HOME. Retains owner-only permissions, explicit users, credential destinations, and fail-closed cleanup.
ownership changeset:1-5 Records producer-identity fix. No permission widening or executable snippet.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review October 16, 2026 04:43
Copilot AI max review requested due to automatic review settings October 16, 2026 04:43
@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

Design Decision Gate 🏗️

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Design Decision Gate 🏗️ · opus50 · 14.1 AIC · ⌖ 46.2 AIC · ◇ 26.7 AIC · ⊞ 1.9K · ◷

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Test Quality Sentinel · sonnet50 · 13.2 AIC · ⌖ 15 AIC · ◇ 6.53 AIC · ⊞ 12.6K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Ponytail Reviewer · gpt56 · 6.74 AIC · ⌖ 5.36 AIC · ⊞ 14.6K · ◷

Generated by Ponytail Reviewer for #69235

Comment thread actions/setup/js/add_mask_redaction.cjs Outdated

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict

I did not find a blocking regression in the large-record redaction rewrite or the backend UID/GID normalization.

What I checked
  • the iterative JSON-string scanner still preserves unchanged records, keeps numeric-token masking outside quoted strings, and intentionally fails closed if a validated token cannot be decoded
  • the agenticworkflows container-user injection is scoped to that backend, preserves explicit --user and HOME overrides, and happens before the config is serialized to the gateway
  • the added coverage exercises the risky edges here: multi-MiB payloads, malformed prefixes, private-file cleanup, and explicit container-user preservation

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 35.2 AIC · ⌖ 5.57 AIC · ⊞ 21.7K
Comment /review to run again

@pelikhan

Copy link
Copy Markdown
Collaborator Author

@lpcox please review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skills-Based Review 🧠

Applied /diagnosing-bugs and /codebase-design to the mask-redaction scanner and container-identity fix. Both defects are root-caused (stack-sensitive regex alternation; missing UID:GID propagation to backend containers), and the fail-closed cleanup path is preserved and well tested — approving with two minor non-blocking suggestions.

📋 Key Themes & Highlights

Key Themes

  • -u flag detection in applyAgenticWorkflowsRunnerIdentity (start_mcp_gateway.cjs:1500) could false-positive on unrelated args like -update, silently skipping the ownership fix in that edge case. Low likelihood given current MCP arg conventions, but cheap to tighten.
  • transformJSONStrings (add_mask_redaction.cjs) reimplements a meaningful slice of JSON string-literal grammar as a private helper. It's a clean, deep fix for the stack-exhaustion bug, but as an un-exported helper it's only exercised indirectly through redactArtifactMaskedValues; direct unit tests would make future regressions easier to localize.

Positive Highlights

  • Root cause properly addressed: replacing repeated regex alternation with an iterative scanner removes the stack-exhaustion failure mode entirely rather than papering over symptoms (verified locally: a 2 MiB synthetic record redacts in ~30ms with no stack error).
  • Decode failures in the scanner correctly throw instead of silently swallowing, propagating to the existing fail-closed processFile cleanup — confirmed the error path does not leak raw secret-bearing messages (RedactionOperationError constructs a sanitized stage=/code= message only).
  • Strong regression coverage: 10 MiB JSON/mixed-log synthetics, escaped-quote edge cases, malformed-prefix recovery, and container-ownership preservation (explicit --user/-u passthrough) are all tested.
  • Backend identity fix narrowly targets the agenticworkflows container and leaves other MCP servers, credentials, and file permissions untouched — consistent with the project's fail-closed posture.

Note: sandbox npm registry access was unavailable, so the new/changed tests were verified by direct code reading and a manual reproduction of the scanner logic rather than running vitest in this environment.

@copilot please address the two inline suggestions when convenient.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · 85.1 AIC · ⌖ 15 AIC · ⊞ 11.7K
Comment /matt to run again

Comment thread actions/setup/js/start_mcp_gateway.cjs
Comment thread actions/setup/js/add_mask_redaction.cjs Outdated
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Malformed-string recovery can leave encoded secrets unmasked without triggering fail-closed cleanup.

2 open findings
What changed in this PR

Improves artifact-redaction reliability by addressing backend file ownership and large-record tokenization.

Changes:

  • Applies runner identity and default HOME to the built-in MCP backend.
  • Replaces quoted-string regex matching with iterative scanning.
  • Adds regression tests, documentation, and patch changesets.
File Description
docs/​src/​content/​docs/​reference/​tools.md Documents backend identity defaults.
docs/​src/​content/​docs/​reference/​imports.md Documents large-record masking.
actions/​setup/​js/​start_mcp_gateway.test.cjs Tests backend identity configuration.
actions/​setup/​js/​start_mcp_gateway.cjs Applies backend user and HOME defaults.
actions/​setup/​js/​redact_secrets.test.cjs Tests private artifacts and fail-closed cleanup.
actions/​setup/​js/​add_mask_redaction.test.cjs Tests large records and malformed prefixes.
actions/​setup/​js/​add_mask_redaction.cjs Introduces iterative JSON-string scanning.
.changeset/​patch-large-record-mask-redaction.md Records the large-record masking patch.
.changeset/​patch-agentic-workflows-backend-ownership.md Records the backend ownership patch.

🧠 Review effort: Max

Comment thread actions/setup/js/add_mask_redaction.cjs Outdated
Comment thread actions/setup/js/add_mask_redaction.cjs Outdated
pelikhan and others added 2 commits October 15, 2026 22:05
Preserve Docker named-user overrides and add direct scanner tests.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep this PR scoped to backend file ownership and runner identity.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pelikhan pelikhan changed the title Fix backend-owned log redaction and large-record mask failures Fix built-in MCP backend log file ownership Oct 16, 2026
@pelikhan

Copy link
Copy Markdown
Collaborator Author

@lpcox

@pelikhan
pelikhan merged commit a15e7ef into main Oct 16, 2026
16 of 18 checks passed
@pelikhan
pelikhan deleted the pelikhan-fail-closed-log-redaction branch October 16, 2026 05:34
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.92.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants