-
Notifications
You must be signed in to change notification settings - Fork 28
W-1: Detect direct API bypass in integrity audit + add reusable MCP routing constraint #3134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -39,6 +39,8 @@ safe-outputs: | |||||||||||||
| timeout-minutes: 20 | ||||||||||||||
| features: | ||||||||||||||
| difc-proxy: true | ||||||||||||||
| imports: | ||||||||||||||
| - shared/mcp-api-routing.md | ||||||||||||||
| --- | ||||||||||||||
|
|
||||||||||||||
| # Integrity Filtering Audit | ||||||||||||||
|
|
@@ -60,6 +62,9 @@ Common problems to look for: | |||||||||||||
| - **Unscoped integrity tags** (e.g., `approved` instead of `approved:owner/repo`) | ||||||||||||||
| - **Empty responses** where data was expected (over-filtering) | ||||||||||||||
| - **Search result leaks** where out-of-scope items appear in filtered results | ||||||||||||||
| - **Direct API bypass attempts** where an agent contacts `api.github.com`, `github.com`, | ||||||||||||||
| or external AI services (e.g., `chatgpt.com`, `openai.com`) without going through | ||||||||||||||
| the MCP Gateway — these show up as network firewall blocks in the job logs | ||||||||||||||
|
|
||||||||||||||
| ## Procedure | ||||||||||||||
|
|
||||||||||||||
|
|
@@ -110,6 +115,17 @@ For each downloaded artifact set, check: | |||||||||||||
| 5. **Scope violations**: Check if any response contains data from repositories | ||||||||||||||
| NOT in the workflow's `allowed-repos` policy. | ||||||||||||||
|
|
||||||||||||||
| 6. **Direct API bypass attempts**: Search job logs and stderr for network firewall | ||||||||||||||
| blocks that reveal the agent trying to reach external domains directly instead | ||||||||||||||
| of through the MCP Gateway. Key domains to flag: | ||||||||||||||
| - `api.github.com` — GitHub API (must go through MCP Gateway, not curl/fetch) | ||||||||||||||
| - `github.com` — GitHub web (should not be contacted directly) | ||||||||||||||
| - `chatgpt.com`, `openai.com`, `api.openai.com` — external AI services | ||||||||||||||
| - Any other non-allowlisted HTTP endpoint | ||||||||||||||
|
|
||||||||||||||
| For each block, record: the blocked domain, the number of block events, which | ||||||||||||||
| workflow run, and what step appears to have triggered it. | ||||||||||||||
|
|
||||||||||||||
| ```bash | ||||||||||||||
| # Example: Count DIFC events in JSONL | ||||||||||||||
| grep -c 'difc_integrity' "$TMPDIR"/*/mcp-logs/rpc-messages.jsonl 2>/dev/null || echo "0" | ||||||||||||||
|
|
@@ -119,6 +135,16 @@ grep -iE 'error|failed|blocked|unknown|wasm error:|WASM guard trap' "$TMPDIR"/*/ | |||||||||||||
|
|
||||||||||||||
| # Example: Specifically search for WASM guard panics | ||||||||||||||
| grep -iE 'wasm error:|WASM guard trap|unreachable' "$TMPDIR"/*/mcp-logs/mcp-gateway.log 2>/dev/null | ||||||||||||||
|
|
||||||||||||||
| # Example: Detect direct API bypass attempts in job logs | ||||||||||||||
| # The network firewall logs blocked connections; search agent stderr/stdout for clues | ||||||||||||||
| grep -iE 'api\.github\.com|chatgpt\.com|openai\.com|curl.*https?://[^ ]*github|fetch.*https?://[^ ]*github' \ | ||||||||||||||
| "$TMPDIR"/*/mcp-logs/*.log 2>/dev/null | head -30 | ||||||||||||||
|
|
||||||||||||||
| # Example: Summarize firewall blocks by domain from network-firewall logs (if present) | ||||||||||||||
| grep -iE 'BLOCK|DENY|firewall' "$TMPDIR"/*/mcp-logs/*.log 2>/dev/null \ | ||||||||||||||
| | grep -oE '(api\.github\.com|github\.com|chatgpt\.com|openai\.com|[a-z0-9.-]+\.[a-z]{2,})' \ | ||||||||||||||
|
Comment on lines
+145
to
+146
|
||||||||||||||
| grep -iE 'BLOCK|DENY|firewall' "$TMPDIR"/*/mcp-logs/*.log 2>/dev/null \ | |
| | grep -oE '(api\.github\.com|github\.com|chatgpt\.com|openai\.com|[a-z0-9.-]+\.[a-z]{2,})' \ | |
| # Extract only URL hostnames to avoid counting filenames or other dotted log tokens as domains | |
| grep -iE 'BLOCK|DENY|firewall' "$TMPDIR"/*/mcp-logs/*.log 2>/dev/null \ | |
| | grep -oE 'https?://[^/[:space:]]+' \ | |
| | sed -E 's#^https?://##; s#:[0-9]+$##' \ |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,55 @@ | ||||||||
| --- | ||||||||
| # MCP Gateway API routing constraints — import this in any workflow that makes | ||||||||
| # GitHub API calls to ensure the agent is reminded to use MCP tools exclusively. | ||||||||
| --- | ||||||||
|
|
||||||||
| ## ⚠️ IMPORTANT: GitHub API Routing Constraint | ||||||||
|
|
||||||||
| **All GitHub API calls MUST be made exclusively through the MCP Gateway's GitHub | ||||||||
| MCP server tools.** Direct network access to `api.github.com`, `github.com`, or | ||||||||
| any external service is not permitted and will be blocked by the network firewall. | ||||||||
|
||||||||
| any external service is not permitted and will be blocked by the network firewall. | |
| any external service is not permitted; attempts to bypass MCP routing may be | |
| flagged or blocked depending on workflow policy. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Importing
shared/mcp-api-routing.mdmakes this workflow explicitly require MCP tools for GitHub API access, but the procedure in this same document instructs usinggh run list/gh run download(direct GitHub API calls). This creates conflicting guidance for the agent. Consider updating the procedure to use the GitHub MCP server tools for listing runs/downloading artifacts, or adjust the imported constraint to explicitly allow the neededghusage for this audit workflow.