Skip to content

fix(#176): restrict code agent GitHub API access to read-only - #178

Merged
waynesun09 merged 2 commits into
mainfrom
agent/176-restrict-github-api-access
Jul 15, 2026
Merged

waynesun09 merged 2 commits into
mainfrom
agent/176-restrict-github-api-access

Conversation

@fullsend-ai-coder

Copy link
Copy Markdown
Contributor

The github_api network policy in policies/code.yaml granted read-write access to api.github.com and github.com. Combined with the GH_TOKEN in the sandbox, this allowed agents to push branches and create PRs directly, bypassing harness post-script checks.

Change both endpoints from access: read-write to access: read-only. The code agent only needs to read GitHub data inside the sandbox (issue context, PR details, repo contents). All write operations flow through the post-script on the runner.

This matches the pattern already used by the review and retro agent policies.


Closes #176

Post-script verification

  • Branch is not main/master (agent/176-restrict-github-api-access)
  • Secret scan passed (gitleaks — 0dbf1959357382ecdb9bb39e3c69a5fa678af3c1..HEAD)
  • Pre-commit hooks passed (authoritative run on runner)
  • Tests ran inside sandbox

The github_api network policy in policies/code.yaml granted
read-write access to api.github.com and github.com. Combined
with the GH_TOKEN in the sandbox, this allowed agents to push
branches and create PRs directly, bypassing harness post-script
checks.

Change both endpoints from access: read-write to access:
read-only. The code agent only needs to read GitHub data inside
the sandbox (issue context, PR details, repo contents). All
write operations flow through the post-script on the runner.

This matches the pattern already used by the review and retro
agent policies.

Closes #176
@fullsend-ai-coder
fullsend-ai-coder Bot requested a review from a team July 15, 2026 14:26
@maruiz93

Copy link
Copy Markdown
Contributor

/fs-review

@fullsend-ai-review

fullsend-ai-review Bot commented Jul 15, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 2:36 PM UTC · Completed 2:43 PM UTC
Commit: 5cd495a · View workflow run →

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

We must do the same for the fix agent as well.

@fullsend-ai-review

Copy link
Copy Markdown

Review — approve

Confidence: high

Summary

This PR correctly restricts the code agent's GitHub API network policy from read-write to read-only in policies/code.yaml, closing the sandbox escape vector described in #176. The change is minimal (2 lines), well-scoped to the linked issue, and aligns the code agent with the read-only pattern already established in review.yaml and retro.yaml.

Correctness: The read-only network policy does not break any legitimate code agent functionality. The agent only needs to read GitHub data inside the sandbox (issue context, PR details, repo contents via gh and git). All write operations (git push, gh pr create) are performed by the harness post-script on the runner using the separate PUSH_TOKEN. The pre-commit binary in the allowed list only needs read access (cloning hook repos, downloading binaries).

Security: This is a permission reduction that adds a network-layer backstop. Combined with the read-only scoped GH_TOKEN (per env/code.env) and disallowedTools restrictions in agents/code.md, there are now three independent layers preventing write abuse from the sandbox. Defense-in-depth posture is strong.

Scope: The change traces directly to issue #176 with no scope creep. Single file, single concern, value-only modification.

Findings

# Severity Category File Description
1 low policy-inconsistency policies/fix.yaml fix.yaml has the same read-write GitHub API access that #176 identifies as a vulnerability. Its header comment states it is "Identical to the code agent policy," and its post-script (post-fix.sh) also performs writes on the runner with PUSH_TOKEN. Consider applying the same read-only change to fix.yaml:46 and fix.yaml:51 in a follow-up.

Dimensional summary

  • Correctness: No issues. Change correctly implements the fix.
  • Security: Permission reduction confirmed. No residual write paths identified.
  • Intent & coherence: Properly scoped and authorized by code agent policy grants unnecessary write access to GitHub API #176.
  • Style/conventions: Value-only change follows existing patterns. No findings.
  • Docs currency: File header comment remains accurate (describes GitHub API access and curl exclusion rationale, which is still valid).
  • Cross-repo contracts: policies/code.yaml is internal configuration, not an exported contract. No concerns.

Protected paths detected — this PR modifies files under one or more
protected paths. The review agent cannot approve PRs that touch these paths.
A human reviewer must approve this PR.

Protected files in this PR:

  • policies/code.yaml

Labels: PR modifies sandbox policy for the code agent, fixing a security bypass

@fullsend-ai-review fullsend-ai-review Bot added requires-manual-review Review requires human judgment code-agent bug Something isn't working labels Jul 15, 2026
@maruiz93

Copy link
Copy Markdown
Contributor

/fs-fix

@fullsend-ai-coder

fullsend-ai-coder Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Finished Fix · ✅ Success · Started 2:57 PM UTC · Completed 3:05 PM UTC
Commit: 5cd495a · View workflow run →

Apply the same read-only restriction to the fix agent's github_api
network policy that was applied to the code agent. The fix agent only
needs to read GitHub data inside the sandbox (PR diffs, issue context);
all write operations flow through the post-script on the runner.

This addresses review feedback from ascerra on PR #178.
@fullsend-ai-coder

Copy link
Copy Markdown
Contributor Author

🔧 Fix agent — iteration 1 (human-triggered)

Addressed review feedback from ascerra: applied the same read-only GitHub API restriction to the fix agent policy (policies/fix.yaml) that was applied to the code agent policy in this PR. The fix agent only needs read access to GitHub inside the sandbox; all write operations flow through the post-script on the runner.

Fixed (1):

  1. restrict fix agent GitHub API access to read-only (policies/fix.yaml): Changed access from read-write to read-only for both api.github.com and github.com endpoints in the fix agent's github_api network policy, matching the pattern already applied to the code and review agent policies

Tests: passed

Updated by fullsend fix agent

@waynesun09
waynesun09 added this pull request to the merge queue Jul 15, 2026
Merged via the queue into main with commit ab29a63 Jul 15, 2026
12 checks passed
@waynesun09
waynesun09 deleted the agent/176-restrict-github-api-access branch July 15, 2026 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working code-agent requires-manual-review Review requires human judgment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

code agent policy grants unnecessary write access to GitHub API

5 participants