Skip to content

Use effective runner identity and owner-only configs for safeoutputs - #75443

Merged
lpcox merged 7 commits into
mainfrom
copilot/self-hosted-run-safeoutputs-mcp
Nov 7, 2026
Merged

lpcox merged 7 commits into
mainfrom
copilot/self-hosted-run-safeoutputs-mcp

Conversation

Copilot AI commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Safeoutputs child containers need runner identity to access owner-only files on self-hosted runners; the parent gateway’s Docker user is not inherited.

  • Identity: Use effective numeric UID/GID in the shared mcpg launcher across engine formats, including primary GID 31. Preserve explicit users, HOME, and configured supplementary groups.
  • Permissions: Reuse the no-follow, descriptor-based writer to enforce 0600 for tools, tools metadata, and validation files—including existing files.
  • Coverage: Add effective-versus-real identity checks and an opt-in mcpg regression covering UID >1000/GID 31, private input reads, and output ownership without sudo.
  • Documentation: Clarify supported identity behavior and distinguish the backend gap from v1.0.1’s existing gateway user flag.

Copilot AI and others added 2 commits November 6, 2026 15:30
…ed configs

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix safeoutputs MCP container identity for self-hosted runner Use effective runner identity and owner-only configs for safeoutputs Nov 6, 2026
Copilot AI requested a review from lpcox November 6, 2026 15:32
@lpcox
lpcox marked this pull request as ready for review November 6, 2026 15:35
Copilot AI adaptive review requested due to automatic review settings November 6, 2026 15:35
@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

Generated by PR Specification Reviewer for #75443

@github-actions

github-actions Bot commented Nov 6, 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 🏗️ · routed: gpt56 max · ~1 AIC · ⌖ ~2 AIC · ⊞ 7.7K · ◷

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Nov 6, 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 Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Generated by Ponytail Reviewer for #75443

@github-actions

github-actions Bot commented Nov 6, 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 · routed: gpt56 max · ~2 AIC · ⌖ ~1 AIC · ⊞ 6.3K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Nov 6, 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 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.

Reviewed head 439627a916214ad8e3a80c2fb8eaf4f320a0b9f4 against base 565bf516865c76a0c744dcac4815abf59014d245. Applicable contracts: docs/src/content/docs/specs/safe-outputs-specification.md v1.29.18, Asset Staging Ownership and Transport; specs/compiler-threat-detection-spec.md v1.0.97, §7.9 and v1.29.15 mapping; and the MCP gateway reference.

Blocking contract synchronization gap: the intentional behavior now applies identity to both built-in backends and adds owner-only generated safeoutputs files, but the formal specifications still describe only the safeoutputs backend identity and do not state the generated-file guarantees. The inline comment proposes focused v1.29.19 / next-unreleased updates while preserving existing 0600/0700, anti-link, and other-backend obligations.

Coverage limit: the added opt-in mcpg regression does not establish the existing MUST-level Linux conformance requirement for a separate host-uploader process reading 0600 staged files and traversing 0700 Claim directories; that evidence remains outstanding. No tests or conformance scripts were run per static-review instructions.

Generated by PR Specification Reviewer for #75443 · copilot · gpt50 · ~5 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review-specs to run again

@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.

What this change does: It makes the built-in backend containers use the runner effective UID/GID and routes generated safeoutputs files through the existing owner-only writer. It adds filesystem, identity, engine-format, and opt-in mcpg coverage, then documents the behavior.

Should fix:

  1. Remove the duplicate effective-identity test (actions/setup/js/start_mcp_gateway.test.cjs:L357-369)

    • What this is: This VM test checks the default effective UID/GID lookup.
    • Problem: The later per-engine test already runs main() with mocked geteuid()/getegid() and asserts --user 2001:31 for every engine, so this block adds no coverage and runs twice under the surrounding backend parameterization.
    • Fix: Delete this it block and keep the engine-path test as the default-identity regression.
    • If we skip it: Two extra module evaluations and 14 lines must be maintained without catching a failure the later test misses.

Verdict: fix 1 first.
Lean: -14 lines possible.

Generated by ✂️ Ponytail Reviewer for #75443 · codex · routed: gpt56 max · ~5 AIC · ⌖ ~1 AIC · ⊞ 118
Comment /ponytail to run again

@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.

Review summary

No actionable correctness, security, or performance issues found in the changed lines. The owner-only file writes use no-follow descriptors, and the backend identity propagation is covered by targeted tests.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~4 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again

@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 /tdd, /diagnosing-bugs, and /codebase-design. Requesting changes on the lock-file drift and a test that does not exercise its claim.

📋 Key Themes & Highlights

Key Themes

  • Lock-file drift: the docker/login-action@v4.8.0 pin is removed from .github/aw/actions-lock.json, but both synced action_pins.json copies still have it.
  • Vacuous engine matrix: the five GH_AW_ENGINE cases never reach engine conversion, because writeMcpConfiguration throws before detectEngineType runs.
  • CI coverage gap: the core UID/GID test is skipped unless GH_AW_TEST_MCP_DOCKER=1, and nothing at the PR head sets it.
  • Docs overclaim: the 0600 sentence does not cover the early comment-memory printf > config write.

Positive Highlights

  • ✅ writeFile uses O_NOFOLLOW, 0o600 on open, and fchmodSync, which closes the existing-file permission gap.
  • ✅ The effective-vs-real identity test and the GID 31 coverage are good regression checks.
  • ✅ The symlink-rejection test in generate_safe_outputs_tools.test.cjs covers an important path.

@copilot please address the review comments above.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~7 AIC · ⌖ ~1 AIC · ⊞ 5.4K
Comment /matt to run again

Comment thread .github/aw/actions-lock.json Resolved
@lpcox

lpcox commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

@copilot address review feedback

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

The opt-in regression depends on the v0.5.4 pin, so pruning it during a gateway upgrade breaks image lookup instead of testing the supported gateway.

2 open issues
What changed in this PR

Updates gh-aw’s built-in MCP launcher to use the runner’s effective identity and enforce owner-only safeoutputs files on self-hosted runners.

Changes:

  • Use effective numeric UID/GID while preserving explicit backend identity settings.
  • Apply the secure file writer to generated tools, metadata, and validation files.
  • Add identity and permissions coverage, including an opt-in Docker regression, and clarify gateway versus backend behavior.
File Description
docs/​src/​content/​docs/​reference/​mcp-gateway.md Documents identity, permissions, and the historical gateway/backend distinction.
actions/​setup/​js/​start_mcp_gateway.test.cjs Adds effective-identity, low-GID, and Docker ownership coverage.
actions/​setup/​js/​start_mcp_gateway.cjs Defaults built-in backends to effective UID/GID.
actions/​setup/​js/​generate_safe_outputs_tools.test.cjs Checks restrictive permissions and symlink rejection.
actions/​setup/​js/​generate_safe_outputs_tools.cjs Uses the secure writer for generated JSON files.
.github/​aw/​actions-lock.json Removes the docker/login-action@v4.8.0 pin.

Review effort: Max (auto)

const name = path.basename(directory);
const pins = JSON.parse(fs.readFileSync(new URL("../../../.github/aw/actions-lock.json", import.meta.url), "utf8")).containers;
const nodeImage = pins["ghcr.io/github/gh-aw-node"].pinned_image;
const gatewayImage = pins["ghcr.io/github/gh-aw-mcpg:v0.5.4"].pinned_image;
The gh-aw launcher defaults the built-in `agenticworkflows` and `safeoutputs` backend containers to the runner's UID and GID, with a container-local writable `HOME` at `/tmp`. This keeps private logs and staged assets readable by host redaction and artifact-upload steps without relaxing file permissions. Explicit container-user settings and configured `HOME` values are preserved; other MCP servers are unchanged.
The gh-aw launcher defaults the built-in `agenticworkflows` and `safeoutputs` backend containers to the runner's effective numeric UID and primary GID, including nonzero GIDs below 1000, with a container-local writable `HOME` at `/tmp`. Identity is applied to the backend arguments sent to mcpg, independently of the parent gateway container, across engine configuration formats. This keeps owner-only (`0600`) config files readable and outputs runner-owned without relaxing file permissions. Generated safeoutputs config, tools, tools metadata, and validation files use `0600`, including when replacing existing files. Explicit container-user settings, configured `HOME` values, and `--group-add` arguments are preserved; supplementary runner groups are not automatically granted to backends. The gateway separately receives the Docker socket group needed to launch child containers; other MCP servers are unchanged.

The v1.0.1 compiler already emitted `--user ${MCP_GATEWAY_UID}:${MCP_GATEWAY_GID}` for the parent gateway, but not for the safeoutputs backend. A report of a missing gateway user flag therefore needs the unmodified generated command and compiler metadata to reconcile it. Missing a backend user flag alone does not establish why container root could not read a runner-owned `0600` file on a particular self-hosted runner; host permissions and Docker user mappings still need separate evidence.
Copilot AI and others added 2 commits November 6, 2026 16:01
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

Copilot AI commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

@copilot address review feedback

Updated the regression to derive the mcpg lock entry from DefaultMCPGatewayVersion and removed report-specific investigation details from the reference docs. Commit: 383a8a0.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot

Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (docs/src/content/docs/reference/mcp-gateway.md:162): The implementation intentionally expands the documented behavior beyond the current formal contracts, so please synchronize them in this PR rather than leaving this line as the only normative-looking record. Base docs/src/content/docs/specs/safe-outputs-specification.md (Asset Staging Ownership and Transport) scopes the effective runner UID/GID and private-file contract to safeoutputs, while specs/compiler-threat-detection-spec.md v1.0.97 / §7.9 and its v1.29.15 mapping likewise mention only safeoutputs. Proposed focused updates: - Use effective runner identity and owner-only configs for safeoutputs #75443 (comment)
  3. Review (actions/setup/js/start_mcp_gateway.test.cjs:357): What this is: This is a second VM-based check of the default effective UID/GID lookup. Problem: The later publishes the runner identity before launching the gateway test already runs main() with mocked geteuid()/getegid() and asserts --user 2001:31 for every engine, so this block adds no coverage and is executed twice by the surrounding describe.each. Fix: Delete this it block and keep the engine-path test as the default-identity regression. If we skip it: Two extra module evaluations and 14 lines must be maintained without catching a failure the later test misses... - Use effective runner identity and owner-only configs for safeoutputs #75443 (comment)
  4. Review (.github/aw/actions-lock.json:136): [/codebase-design] This removes the docker/login-action@v4.8.0 pin from the lock file, but the synced copies pkg/actionpins/data/action_pins.json and pkg/workflow/data/action_pins.json still contain it at line 136. The sync-action-pins Make target regenerates those copies from this lock file, so they will drift. Confirm the removal is intentional and run make sync-action-pins, or restore the entry. - Use effective runner identity and owner-only configs for safeoutputs #75443 (comment)
  5. Review (actions/setup/js/start_mcp_gateway.test.cjs:565): [/tdd] This matrix does not exercise what it claims. writeMcpConfiguration is mocked to throw, and that throw happens before detectEngineType(configDir) runs at start_mcp_gateway.cjs line 1416. So none of the five GH_AW_ENGINE cases reaches engine-specific conversion. Assert the applyBuiltinMCPRunnerIdentity output per engine directly, or mock past the throw point so the engine branch runs. - Use effective runner identity and owner-only configs for safeoutputs #75443 (comment)
  6. Review (docs/src/content/docs/reference/mcp-gateway.md:162): [/diagnosing-bugs] The claim that all generated safeoutputs config files use 0600 is broader than the code. The config.json written by create_files.cjs uses writeFile, but the early comment-memory config is written by a plain shell printf > redirect in pkg/workflow/compiler_yaml_runtime_setup.go (around line 388), which does not set 0600. Either narrow this sentence to the JS-written files, or route that write through the same owner-only path. - Use effective runner identity and owner-only configs for safeoutputs #75443 (comment)
  7. Review (actions/setup/js/generate_safe_outputs_tools.cjs:38): [/codebase-design] This adds a sibling require of ./create_files.cjs. Existing sibling requires resolve in unit tests, but this file is bundled into the Generate Safe Outputs Config step, so create_files.cjs must be present next to it on the runner. Confirm the bundled step ships that file, or add a test that exercises the bundled path. - Use effective runner identity and owner-only configs for safeoutputs #75443 (comment)
  8. Review (actions/setup/js/start_mcp_gateway.test.cjs:446): [/tdd] The core UID and GID behavior (non-root UID, GID 31) is covered only by this Docker test, which is skipped unless GH_AW_TEST_MCP_DOCKER=1. Nothing I checked at the PR head sets that flag in the Makefile or workflows, so CI never runs the main fix. Add a CI target that sets it, or cover the same identity path with a non-Docker unit test. - Use effective runner identity and owner-only configs for safeoutputs #75443 (comment)

Once you start work, post this work summary as a PR comment without the leading Copilot mention, including the Sous-chef head, work, and state lines below, to record that the assignment is running. Apply the necessary fixes on this PR's existing branch, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved; stop when only human review or CI remains. Do not merge or trigger CI.

Sous-chef requested-head: 383a8a0
Sous-chef requested-work: 43aa0ee646a9615af715273cf835c722c23253692e03a76ad465f5566d1f334a 7e4bbe3efd98a42429245ad46350fc71c6bcbbb4a0163f42319995a4cf2903ab 9268d9faa0dd0cb44cdca28d431c0b0d26e2e5d5cf8c8e603ad5348d1b503ec6 b2efca9153aa987e587b0e182ee3a9ec6bc5b6699f4128d6a891efdefe9d864b bae7168e46339aad76c9bb570723976831429de76b4d0edf9c32a90cdb2e34b8 cc5570eea323050b1b278c2dfd1804f715dac227f24cda9b508eae5e93e05372 cf772a54c805a5dfc1297761c6d52b0acfc64657ab0316062f9f68b46cbfb565
Sous-chef requested-state: 297b71586df8daf01d3e8c150ee6c8276caf31131ef78933734589b0745052a4

Generated by 👨🍳 PR Sous Chef · pi · haiku45 · ~10 AIC · ⌖ ~11 AIC · ⊞ 1.2K · ◷
Comment /souschef to run again

Copilot AI commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

@copilot

Copilot assignment requested for the following outstanding work:...

Sous-chef requested-head: 383a8a0
Sous-chef requested-work: 43aa0ee646a9615af715273cf835c722c23253692e03a76ad465f5566d1f334a 7e4bbe3efd98a42429245ad46350fc71c6bcbbb4a0163f42319995a4cf2903ab 9268d9faa0dd0cb44cdca28d431c0b0d26e2e5d5cf8c8e603ad5348d1b503ec6 b2efca9153aa987e587b0e182ee3a9ec6bc5b6699f4128d6a891efdefe9d864b bae7168e46339aad76c9bb570723976831429de76b4d0edf9c32a90cdb2e34b8 cc5570eea323050b1b278c2dfd1804f715dac227f24cda9b508eae5e93e05372 cf772a54c805a5dfc1297761c6d52b0acfc64657ab0316062f9f68b46cbfb565
Sous-chef requested-state: 297b71586df8daf01d3e8c150ee6c8276caf31131ef78933734589b0745052a4
State: Started work on the requested updates: syncing safeoutputs contracts, removing redundant coverage, correcting engine-path tests, synchronizing action pins, and merging main.

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
@lpcox

lpcox commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

Verified the Actions-bot feedback against current head 12a428301c4ed8bb83edc566fe60030a44372da9; all seven Actions-bot threads now have direct evidence-based replies and are resolved. No additional code changes were needed.

Review summaries:

  • Specification review 5802696867: v1.29.19 / v1.0.98 synchronize the effective-identity and owner-only-file contracts while retaining guarded 0600/0700 and anti-link obligations. The separate Linux host-uploader/Claim-directory conformance evidence remains outstanding; the opt-in mcpg test and static conformance job do not establish that live handoff.
  • Ponytail review 5802734788: the duplicate VM block is removed; the retained engine-path matrix covers default effective identity.
  • Skills review 5802787646: both pin copies match the source byte-for-byte, startup reaches all five converter dispatches, early comment-memory config uses the owner-only writer, setup.sh ships the sibling dependency, and non-Docker tests cover UID 2001/GID 31.
  • Code-quality review 5802739786: no actionable request was reported.

Published-head impacted-JS CI passed 302 tests with one opt-in Docker test skipped; all reported checks are successful or skipped. A local focused rerun could not start because this checkout lacks Vitest, so the validation evidence above is from existing CI, not a claimed local run. The outstanding CHANGES_REQUESTED reviews still require reviewer clearance; resolving threads does not dismiss or replace those reviews. No workflow was dispatched, review dismissed, or merge performed.

@lpcox

lpcox commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

@copilot merge main and resolve conflicts

…un-safeoutputs-mcp

# Conflicts:
#	docs/src/content/docs/specs/safe-outputs-specification.md

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

Copilot AI commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

@copilot merge main and resolve conflicts

Merged and published main as two-parent commit a9d0f470. Resolved the safe-outputs specification conflict by preserving both the identity/permissions and §7.0.4 entries. Build, workflow recompilation, and impacted tests passed; Go lint and CodeQL timed out.

@lpcox
lpcox dismissed github-actions[bot]’s stale review November 7, 2026 00:27

feedback addresseed

@lpcox
lpcox merged commit bd0d728 into main Nov 7, 2026
64 checks passed
@lpcox
lpcox deleted the copilot/self-hosted-run-safeoutputs-mcp branch November 7, 2026 00:27
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.2.2

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.

Self-hosted: run safeoutputs MCP container with runner identity and preserve owner-only config access

4 participants