repoward

io.github.Sanoy24由 GitHub 帳號 Sanoy24 發布v0.3.0更新於 Nov 7, 2026

GitHub MCP server that blocks private-to-public leaks by agents, with approvals and audit.

已驗證STDIO僅桌面開發者工具安全與監控

概覽

AI 產生的概覽

供 AI 代理使用的 GitHub MCP 伺服器,以讀取追蹤流程守衛、預設拒絕策略、人工核准與防竄改稽核日誌約束每次寫入。

可以做什麼
  • 讀取 GitHub 議題、拉取請求、程式碼搜尋結果、儲存庫檔案以及 CI 狀態與作業日誌
  • 在策略限制內建立分支、提交檔案、發起草稿拉取請求與張貼留言
  • 僅在一次性、會到期的人工核准後合併拉取請求與刪除分支
  • 執行預設拒絕的 YAML 策略,包含角色、儲存庫允許清單、路徑拒絕清單與速率限制
  • 將每次決策寫入雜湊鏈稽核日誌,可選用 HMAC、檢查點與策略重播
  • 包裝不可信的 GitHub 文字,移除隱藏內容並遮蔽可辨識的憑證
適用情境
適用於 AI 代理需要存取 GitHub、但存取 GitHub 的唯一途徑就是此伺服器(例如 CI 機器人或託管代理),並希望在模型之外阻擋私有內容外洩到公開儲存庫與危險寫入。對具備 shell 存取權的代理並不構成安全邊界。
執行需求
以 uvx 執行的本機 Python 程序(需要 uv);必須先執行初始化指令產生策略,存放於 ~/.repoward 或 REPOWARD_HOME。需要細緻度 GITHUB_TOKEN:讀取工具用唯讀權限,寫入工具另需寫入權限。可選的 GitHub App 模式需要 GITHUB_APP_PRIVATE_KEY_FILE 與策略設定。
安裝前請注意
處於 alpha 階段,未經獨立安全審查。GITHUB_TOKEN 是機密,避免提交含真實權杖的設定檔。Contents 寫入權限可讓權杖推送到任意分支,應為預設分支設定規則集保護。若代理與伺服器使用同一作業系統使用者或擁有 shell,核准將失去意義。稽核日誌僅能偵測竄改而非絕對防竄改,機密遮蔽僅為盡力而為。公開儲存庫上的回執會揭露被拒次數。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 repoward,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

repoward

A GitHub MCP server that stops AI agents acting on what an attacker's issue told them to do.

Status: alpha. It has not had an independent security review. Read the threat model, especially the part about where it runs.

The problem

An agent with GitHub access can read a malicious public issue, read a private repository, and post the 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:

If the agent has readThen
Anything from a private repositoryWrites to public repositories are denied
An issue, pull request or comment from an author outside OWNER, MEMBER and COLLABORATOR, or a job logEach write needs human approval

This does not depend on the model noticing an attack or on scanning text, so rewording or encoding the data does not get around it. The state survives restarts, and no tool can clear it. A person can:

bash
uvx repoward flow statusuvx repoward flow reset

What it does not do:

  • It only sees this server's tools. A shell, a browser or another MCP server is still a way out, so it protects agents whose GitHub access and outbound routes are limited to this server.
  • Data can stay in an agent's context after the window (60 minutes by default) ends. Restart a long-running agent to clear its context.
  • Reading one private repository and writing to another private repository is allowed, unless you set single_repo: true.
  • Repository files and code search results do not count as untrusted input, because they were merged by someone with write access.
  • author_association is a coarse signal, and a compromised trusted account counts as trusted.
  • Maintainers of public repositories will see more approval requests. That is the cost of the default, and trusted_associations is configurable.

Features

  • Policy: default-deny YAML with roles, repository allowlists and path denylists. See policy.example.yaml.
  • Single guarded path: every tool attempt, including unknown tools and invalid arguments, passes through one pipeline and is logged.
  • Audit log: a hash-chained record of every decision, with optional HMAC and checkpoints.
  • Rate limits: per principal and per tool.
  • Read tools: github_list_issues, github_get_issue, github_search_code, github_get_file, ci_get_status and ci_get_job_logs.
  • Write tools: github_create_branch, github_commit_files, github_create_pull_request and github_comment. Writes only reach branches with the configured prefix (agent/ by default), pull requests are draft only by default, commit sizes are limited, nothing is forced or retried, and text holding a recognizable credential is refused.
  • Dangerous tools: github_merge_pull_request and github_delete_branch need human approval. An approval covers one exact call at one exact commit, works once and expires. Merging is off until a policy turns it on.
  • GitHub App tokens (optional): each call gets a short-lived token limited to one repository and only the permissions that tool needs, and GitHub enforces those limits itself.
  • Pull request review as approval (optional): a merge can be approved by a real GitHub review of the exact commit.
  • Pull request receipts (optional): a commit status summarizing how the agent's run has gone.
  • Policy replay: see which past decisions a policy edit would change before you deploy it.
  • Untrusted content handling: text from GitHub users comes back wrapped in a tag with a random id per response, after invisible characters, hidden HTML comments and images are removed and secrets are redacted. This is a mitigation, not a guarantee: a model can still be fooled, which is why the rules above are enforced outside the model.

Who it is for

Agents whose only route to GitHub is this server, such as CI bots and hosted agents. An agent with shell access can run git or read local credentials directly, so this server is not a security boundary for it.

Install

Requires uv. Create a starter policy, which also prints a client config to paste:

bash
uvx repoward init --repo your-org/your-repo

The starter policy gives the server read-only tools. Add --role contributor for write tools. Files live in ~/.repoward, or wherever REPOWARD_HOME points. An existing policy is never overwritten.

Run this first, because the server will not start without a policy. Then add it to your MCP client, and use a token set up as described in GitHub token. Avoid committing a config that holds a real token.

Claude Code
bash
claude mcp add --env GITHUB_TOKEN=<your-token> --transport stdio repoward -- uvx repoward serve
Claude Desktop

In claude_desktop_config.json, under Settings > Developer > Edit Config:

json
{  "mcpServers": {    "repoward": {      "command": "uvx",      "args": ["repoward", "serve"],      "env": { "GITHUB_TOKEN": "<your-token>" }    }  }}
Cursor

In ~/.cursor/mcp.json, reading the token from your environment:

json
{  "mcpServers": {    "repoward": {      "command": "uvx",      "args": ["repoward", "serve"],      "env": { "GITHUB_TOKEN": "${env:GITHUB_TOKEN}" }    }  }}
VS Code

In .vscode/mcp.json or your user profile's mcp.json, which prompts for the token once:

json
{  "inputs": [    { "type": "promptString", "id": "github-token", "description": "GitHub token", "password": true }  ],  "servers": {    "repoward": {      "type": "stdio",      "command": "uvx",      "args": ["repoward", "serve"],      "env": { "GITHUB_TOKEN": "${input:github-token}" }    }  }}
Codex

In ~/.codex/config.toml, forwarding the token from your environment:

toml
[mcp_servers.repoward]command = "uvx"args = ["repoward", "serve"]env_vars = ["GITHUB_TOKEN"]
Gemini CLI

In ~/.gemini/settings.json, reading the token from your environment:

json
{  "mcpServers": {    "repoward": {      "command": "uvx",      "args": ["repoward", "serve"],      "env": { "GITHUB_TOKEN": "$GITHUB_TOKEN" }    }  }}
OpenCode

In opencode.json in your project, or ~/.config/opencode/opencode.json, reading the token from your environment:

json
{  "mcp": {    "repoward": {      "type": "local",      "command": ["uvx", "repoward", "serve"],      "environment": { "GITHUB_TOKEN": "{env:GITHUB_TOKEN}" }    }  }}

Any other client that can launch a stdio MCP server runs the same command: uvx repoward serve.

If your client reports that the server failed to connect, run uvx repoward serve in a terminal to see why. The usual cause is that repoward init has not been run yet, so there is no policy.

Useful commands:

bash
uvx repoward validate-policyuvx repoward audit verify

Approving risky actions

A call that needs approval does not run. It returns an approval_id, and a person decides from a terminal:

bash
uvx repoward approvals listuvx repoward approvals show <id>uvx repoward approvals approve <id>

The agent then repeats the same call. Pushing new commits changes the commit the call names, so the old approval no longer applies, and GitHub refuses a merge whose head has moved.

Approving with a pull request review

A merge can also be approved by a normal GitHub review, so the approver needs their own GitHub identity and not just access to this machine. Turn it on in your policy:

yaml
approvals:  github_review: { enabled: true, min_permission: write }

A review counts only if it approves the exact commit being merged, comes from a user other than the pull request's author and this server's own identity, and that user has the required access. Any reviewer's outstanding request for changes blocks it. Each check is made again at merge time.

This needs the server to act as a GitHub App or a separate bot account. With your own token, your own reviews are refused. If an agent can reach the reviewer's GitHub credentials, such as a logged-in gh on the same machine, this protection is lost.

Limits of approvals

If the agent runs as the same OS user as this server and has a shell, it could run these commands or edit the database itself. Run the server and its files under a separate user or in a container for approvals to mean anything.

GitHub token

Use a fine-grained personal access token limited to the repositories you allow, with short expiry. Choose Only select repositories so that repository permissions appear. The read tools need these, all read-only:

PermissionUsed for
MetadataRequired by GitHub
Contentsgithub_get_file
Issuesgithub_list_issues, github_get_issue
Pull requestsPull requests in those same tools
Actionsci_get_status, ci_get_job_logs
Commit statusesci_get_status

To use the write tools, also give it read and write access to Contents, Issues and Pull requests. Leave the Workflows permission off: GitHub then refuses workflow file changes even if your policy allows the path.

Contents: write lets a token push to any branch and merge, and GitHub cannot limit it to agent/ branches. That limit lives in this server, so also protect your default branch with a ruleset that requires pull requests and has no bypass for the token's owner. If the token leaks or the server is misconfigured, that ruleset still holds.

Limits to know about:

  • ci_get_status does not show third-party checks reported only through the Checks API, which GitHub documents as unavailable to fine-grained tokens.
  • github_search_code covers the default branch and files under 384 KB. New repositories can return nothing until GitHub indexes them, and its handling of real results has so far only been tested against simulated responses.
  • github_get_file refuses symlinks, submodules, binary files and files over 1 MB. It walks the Git tree, so each read makes one request per folder in the path.
  • ci_get_job_logs fails closed if GitHub moves log storage to a host it does not recognize.
  • github_merge_pull_request does not support merge queues or stacked pull requests.
  • github_delete_branch checks the commit and then deletes, because GitHub has no conditional delete, so a small window remains between the two.

Using a GitHub App instead

A GitHub App gives each tool call its own short-lived token, limited to one repository and that tool's permissions. The App also has its own identity, which review approvals need.

Register an App with webhooks off and only the permissions you need, then install it on the repositories in your policy, and generate a private key:

PermissionLevelUsed for
ContentsRead, or write for write toolsFiles, search, branches, commits, merges
IssuesRead, or write for commentsIssues and comments
Pull requestsRead, or write for write toolsPull requests, reviews and comments
ActionsReadCI status and job logs
Commit statusesRead, or write for receiptsCI status and receipts

Then set this in your policy, and point GITHUB_APP_PRIVATE_KEY_FILE at the key in the server's environment:

yaml
github_auth:  mode: app  client_id: Iv1.your-client-id  installation_id: 12345678

The private key is a long-lived secret that can issue new tokens. Keep it away from the agent. A contents: write token can still push to any branch of that repository, so the ruleset advice above still applies.

What the audit log proves

The log is tamper-evident, not tamper-proof.

AttackPlain chainWith an HMAC key the attacker cannot readWith off-host checkpoints
Edit one recordDetectedDetectedDetected
Edit a record and recompute all later hashesNot detectedDetectedDetected back to the last checkpoint
Delete the newest recordsNot detectedNot detectedDetected back to the last checkpoint

Set REPOWARD_AUDIT_HMAC_KEY to use HMAC, and store the output of repoward audit checkpoint somewhere the server cannot write. Comment bodies, titles, commit messages and file contents are logged as a length and hash rather than as text. A crash during a write leaves an incomplete last line, and new writes are then refused until an operator repairs the log. Secret redaction is best effort.

Pull request receipts

Reviewers of an agent's pull request can see how its run has gone. Turn this on in your policy:

yaml
receipts:  enabled: true

After each commit or pull request the agent makes, repoward posts a commit status named repoward/receipt:

text
policy 4c16a8364c1a; audit seq 12-40; 2 denied; 1 escalated; flow labels: yes

That is the policy's hash, the audit records since this server started, how many calls were denied or needed approval, and whether anything restricts the agent's writes. flow labels can also say no, unknown, or off if the flow guard is off.

  • It needs Commit statuses: write. A GitHub App uses a separate token holding only that permission for each receipt. A personal token needs the permission on the token itself, so every tool's calls carry it.
  • A receipt is audited before it is posted. If posting fails, the agent's commit or pull request still succeeds, and the failure is logged.
  • A receipt does not prove a change came through repoward. Anyone with that permission can post the same status, so don't make it a required check.
  • Anyone who can see the repository can read it. On a public repository, that includes how many calls were refused and whether flow labels are set, which can hint that the agent read private content.

Trying a policy change

Replay a policy against your audit log to see what it would have done differently:

bash
repoward policy replay --policy new-policy.yaml
text
3 decisions: 1 unchanged, 1 changed, 1 unknown
Changed:  seq 2  github_comment  org/app: allow -> approval_required  (flow.untrusted_author)
Unknown (the log does not hold what this decision depends on):  seq 5  github_commit_files  org/app: allow -> unknown  (it depends on file sizes or text the log does not hold)

It never contacts GitHub and changes nothing, and it refuses a log that fails verification. Add --key-env to name the variable holding your HMAC key if the log uses one.

The log leaves out content, so some answers are not knowable. A decision can depend on a file's exact size, on whether hidden text held a credential, or on flow guard facts that were not recorded, such as the visibility of a repository the log never read. Replay reports those as unknown and does not guess.

Replay assumes the agent would have made the same calls. A real agent that was refused would have done something else, so treat the report as a guide to the policy's effect and not as a prediction.

Contributing and security

See CONTRIBUTING.md. Please report vulnerabilities as described in SECURITY.md.

License

MIT. This is an independent project, not affiliated with or endorsed by GitHub.

來源:README.md,提交 628923e

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.3.0最新Nov 7, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分