repoward: A GitHub MCP Server That Can't Be Talked Into Leaking
A GitHub MCP server that stops AI agents from acting on what an attacker's issue told them to do: flow guard, default-deny policy, single-use approvals, and a hash-chained audit log.
Pipeline
Highlights
- Flow guard tracks what the agent has already read: after private data, writes to public repos are denied; after untrusted issues or job logs, every write needs a human.
- Enforced outside the model from GitHub facts, so rewording or encoding the attack does not get around it.
- Approvals cover one exact call at one exact commit, work once, and expire. Merging stays off until a policy turns it on.
- Optional GitHub App mode mints a short-lived token per call, scoped to one repository and only the permissions that tool needs.
The problem#
An agent with GitHub access can read a malicious public issue, read a private repository, and post its contents in a public pull request. Each call looks allowed on its own, so per-tool permissions do not stop the sequence. This is the attack Invariant Labs published against agents using GitHub’s MCP server, and repoward’s test suite replays it against real repositories.
Flow guard#
Before every write, repoward checks what this agent has already read, using facts from GitHub rather than the model’s judgment:
| If the agent has read | Then |
|---|---|
| Anything from a private repository | Writes to public repositories are denied |
An issue, PR, or comment from an author outside OWNER, MEMBER, and COLLABORATOR, or a job log | Each write needs human approval |
The state survives restarts, and no tool can clear it. Only a person can, from the CLI.
Guardrails on every write#
- Writes only reach branches with a configured prefix (
agent/by default), and pull requests are draft-only by default. - Commit sizes are capped, nothing is forced or retried, and text holding a recognizable credential is refused.
- Merging and branch deletion need approval, and an approval can come from a real GitHub review of the exact commit.
- Text from GitHub users comes back wrapped in a per-response random tag, with invisible characters, hidden HTML comments, and secrets stripped. That is a mitigation, not a guarantee, which is why the rules above are enforced outside the model.
For teams#
HTTP mode serves several users from one server, each logging in with a JWT from their identity provider and mapped to a role. Policy replay shows which past decisions a policy edit would change before you deploy it, and optional pull request receipts post a commit status summarizing how the agent’s run went.
Honest scope#
repoward is alpha and has not had an independent security review. It only sees its own tools, so it protects agents whose GitHub access and outbound routes go through this server. A shell, a browser, or another MCP server is still a way out, and the threat model says so up front.