Skip to content

test(factory): add fixture-only provenance-bound MCP OAuth scope step-up coverage - #2014

Draft
groupthinking with Copilot wants to merge 6 commits into
mainfrom
copilot/test-factory-add-provenance-bound-mcp-oauth-scope
Draft

groupthinking with Copilot wants to merge 6 commits into
mainfrom
copilot/test-factory-add-provenance-bound-mcp-oauth-scope

Conversation

Copilot AI commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Canonical issue

Fixes #2005.

Outcome

This draft adds fixture-only, provenance-bound MCP OAuth scope step-up behavior for Agent Factory/EventRelay. Live authorization remains disabled.

Enforced fixture contract

  • Validates the JSON-RPC root, params, operation, and target before dynamic scope evaluation.
  • Covers tools/call, static and templated resources/read, and prompts/get.
  • Returns a pre-handler HTTP 403 challenge with the minimal complete scope set and canonical resource metadata.
  • Requires an active, unexpired operator approval bound to approval ID, provenance, operation, target, exact scopes, and metadata URL.
  • Preserves prior grants on retry and records challenged, prior, effective, and missing scopes separately.
  • Gives no authority to a challenge, model output, peer-agent GO, Skill content, Video Pack/OCR/canvas text, or workspace files.
  • Denies malformed input, scope confusion, missing provenance, revoked/expired approvals, target mismatch, metadata mismatch, and incomplete incremental grants.
  • Protects shared counters and receipt storage with locking and returns immutable receipt snapshots.
  • Percent-encodes metadata path segments and safely quotes WWW-Authenticate values.
  • Prevents fixture subprocess pipe deadlock and preserves the receipt policy during regeneration.

Evidence boundary

Exact verified head

1134c78ee53ff6de3fa7c6a094266a371eb1fb15

The branch was refreshed onto main 276d738891361bb8a7118afe0785d5b11f3c91b9 before final verification.

Exact-head verification

  • CI: passed, including Python 3.10/3.11/3.12, production web build, lint, guards, and frontend tests
  • Security: passed, including repository Trivy, npm audit, Bandit, and Python safety
  • Security Scan: passed
  • Coverage: passed
  • Dependency Review: passed
  • E2E: passed
  • CodeQL and gitleaks: passed
  • All five inline review threads: resolved

Boundary and rollback

This remains an open, draft, unmerged PR. It performs no production activation, deployment, live OAuth exchange, provider spending, messaging, or merge. Rollback is a branch revert of the four fixture/conformance files.

@coderabbitai

coderabbitai Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository: groupthinking/EventRelay/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: eb9c4330-1243-48b9-b60c-b36adc5b365c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Co-authored-by: groupthinking <154503486+groupthinking@users.noreply.github.com>
Copilot AI changed the title [WIP] Add fixture-only provenance-bound MCP OAuth scope step-up behavior test(factory): add fixture-only provenance-bound MCP OAuth scope step-up coverage Sep 18, 2026
Copilot AI requested a review from groupthinking September 18, 2026 20:57
@groupthinking
groupthinking marked this pull request as ready for review September 18, 2026 20:59
Copilot AI balanced review requested due to automatic review settings September 18, 2026 20:59
@vercel

vercel Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
v0-uvai Building Building Preview, v0 Sep 20, 2026 7:26am UTC

Comment thread scripts/testing/official_mcp_conformance.py

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.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Pull request overview

Adds fixture-only MCP OAuth scope step-up enforcement and receipt tracking for the official conformance fixture server, along with new unit tests and updated conformance receipt metadata to document upstream/unmerged scope-step-up status.

Changes:

  • Introduced a scope step-up mode in the fixture server that returns pre-handler 403 challenges with WWW-Authenticate: ... insufficient_scope ... and emits machine-readable receipts.
  • Added unit tests covering challenge-then-retry, pre-handler enforcement for resources/prompts, and rejection of malformed targets / peer-agent provenance.
  • Updated the conformance harness + stored receipt JSON to pin scope-step-up SDK commit and track upstream issue/PR as unmerged and excluded from official claims.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
tests/unit/test_official_mcp_conformance.py Adds fixture-server start helper and new tests for scope step-up challenge/receipt behavior.
tests/testing/official_mcp_fixture_server.py Implements fixture-only scope step-up enforcement, canonical target validation, and receipt emission endpoints.
tests/fixtures/mcp_conformance/official-2026-07-28-receipt.json Records scope-step-up metadata/policy/exclusions in the stored conformance receipt.
scripts/testing/official_mcp_conformance.py Extends receipt builder to include scope-step-up commit pin and upstream tracking metadata.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/testing/official_mcp_fixture_server.py
Comment thread tests/testing/official_mcp_fixture_server.py
Comment thread tests/testing/official_mcp_fixture_server.py
Comment thread tests/unit/test_official_mcp_conformance.py Outdated
@github-actions

github-actions Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

🔍 PR Validation

⚠️ Large PR detected (875 lines changed)

@groupthinking
groupthinking marked this pull request as draft September 20, 2026 07:11
@github-actions

Copy link
Copy Markdown
Contributor

✅ E2E Test Results: ALL TESTS PASSED

Metric Value
Status 🟢 GREEN
Total Tests
Passed 19
Failed
Deployment https://v0-uvai-2ygu6ziek-garv1.vercel.app
Test Output
dout�[2m | tests/e2e/pipeline.test.ts�[2m > �[22m�[2mEventRelay E2E — Live Deployment�[2m > �[22m�[2mSSE Pipeline Stream�[2m > �[22m�[2mSSE stream emits at least a pipeline_status:running event
�[22m�[39m[E2E] last pipeline_status: complete

 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mSSE Pipeline Stream�[2m > �[22mSSE stream emits at least a pipeline_status:running event�[33m 18073�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mSSE Pipeline Stream�[2m > �[22mSSE stream closes within 90 seconds (no 95% hang)�[33m 18508�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mSSE Pipeline Stream�[2m > �[22mSSE events fire in correct agent order�[33m 15642�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mCloudEvent Schema�[2m > �[22mSSE events contain valid timestamps�[33m 13857�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mCloudEvent Schema�[2m > �[22mterminal pipeline_status includes duration and stage progress�[33m 16539�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mError Handling�[2m > �[22mmissing URL returns 400, not a hang�[32m 253�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mError Handling�[2m > �[22minvalid URL returns error event or completes quickly, not a hang�[33m 10848�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mDashboard�[2m > �[22m/dashboard returns 200�[33m 314�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mDashboard�[2m > �[22m/dashboard contains agent or pipeline visualization markup�[32m 196�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mAPI Health�[2m > �[22mGET /api returns a response (not 404)�[33m 371�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mAPI Health�[2m > �[22mPOST /api/pipeline/stream with no body returns 400�[32m 178�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mStatic Assets�[2m > �[22mhomepage has proper meta tags�[32m 181�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mStatic Assets�[2m > �[22m/features page returns 200�[32m 178�[2mms�[22m�[39m

�[2m Test Files �[22m �[1m�[32m1 passed�[39m�[22m�[90m (1)�[39m
�[2m      Tests �[22m �[1m�[32m19 passed�[39m�[22m�[90m (19)�[39m
�[2m   Start at �[22m 07:17:41
�[2m   Duration �[22m 98.55s�[2m (transform 51ms, setup 0ms, import 67ms, tests 98.35s, environment 0ms)�[22m


@github-actions

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@github-actions

Copy link
Copy Markdown
Contributor

✅ E2E Test Results: ALL TESTS PASSED

Metric Value
Status 🟢 GREEN
Total Tests
Passed 19
Failed
Deployment https://v0-uvai-n9fubi84i-garv1.vercel.app
Test Output
tdout�[2m | tests/e2e/pipeline.test.ts�[2m > �[22m�[2mEventRelay E2E — Live Deployment�[2m > �[22m�[2mSSE Pipeline Stream�[2m > �[22m�[2mSSE stream emits at least a pipeline_status:running event
�[22m�[39m[E2E] last pipeline_status: complete

 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mSSE Pipeline Stream�[2m > �[22mSSE stream emits at least a pipeline_status:running event�[33m 25159�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mSSE Pipeline Stream�[2m > �[22mSSE stream closes within 90 seconds (no 95% hang)�[33m 19052�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mSSE Pipeline Stream�[2m > �[22mSSE events fire in correct agent order�[33m 19167�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mCloudEvent Schema�[2m > �[22mSSE events contain valid timestamps�[33m 26476�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mCloudEvent Schema�[2m > �[22mterminal pipeline_status includes duration and stage progress�[33m 19215�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mError Handling�[2m > �[22mmissing URL returns 400, not a hang�[32m 68�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mError Handling�[2m > �[22minvalid URL returns error event or completes quickly, not a hang�[33m 13160�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mDashboard�[2m > �[22m/dashboard returns 200�[32m 234�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mDashboard�[2m > �[22m/dashboard contains agent or pipeline visualization markup�[33m 1586�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mAPI Health�[2m > �[22mGET /api returns a response (not 404)�[32m 208�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mAPI Health�[2m > �[22mPOST /api/pipeline/stream with no body returns 400�[32m 56�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mStatic Assets�[2m > �[22mhomepage has proper meta tags�[32m 71�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mStatic Assets�[2m > �[22m/features page returns 200�[32m 88�[2mms�[22m�[39m

�[2m Test Files �[22m �[1m�[32m1 passed�[39m�[22m�[90m (1)�[39m
�[2m      Tests �[22m �[1m�[32m19 passed�[39m�[22m�[90m (19)�[39m
�[2m   Start at �[22m 07:28:06
�[2m   Duration �[22m 126.99s�[2m (transform 57ms, setup 0ms, import 72ms, tests 126.79s, environment 0ms)�[22m


Copy link
Copy Markdown
Owner

Execution receipt — fixture-only OAuth scope step-up

Decision: TEST
Canonical issue: #2005
Artifact: PR #2014
Exact verified head: 1134c78ee53ff6de3fa7c6a094266a371eb1fb15

Inputs

Decision and mutation

The earlier PR head was non-draft but did not satisfy the issue’s security contract. I converted the existing canonical PR to draft and corrected it instead of opening competing work.

The corrected branch now:

  • validates malformed roots, params, operations, and targets before policy evaluation;
  • binds approval to operator provenance, approval ID, operation, target, exact scopes, metadata URL, active state, and expiry;
  • proves a challenge alone grants no authority and preserves prior grants on retry;
  • rejects peer-agent GO, missing provenance, revoked or expired approvals, metadata mismatch, and hierarchy/scope confusion;
  • emits immutable, lock-protected, machine-readable challenge/decision/retry/outcome receipts;
  • safely encodes metadata URLs and quoted challenge fields;
  • avoids subprocess pipe deadlock;
  • regenerates the complete scope-step-up receipt policy; and
  • records upstream scope-step-up conformance as unmerged and not executed, so no official or live compatibility claim is made.

The branch was then refreshed onto current main 276d738891361bb8a7118afe0785d5b11f3c91b9 with an explicit merge commit and reverified at the exact head above.

Verification

Boundary and next action

No merge, deployment, live authorization exchange, provider invocation, spending, or production mutation occurred.

Next action is an exact-head human review and explicit approval before merging 1134c78ee53ff6de3fa7c6a094266a371eb1fb15.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(factory): add provenance-bound MCP OAuth scope step-up fixtures

3 participants