Skip to content

fix(hosted): prevent credential disclosure by gating mentions and redacting published results - #81

Open
BunsDev wants to merge 1 commit into
mainfrom
codex/fix-vulnerability-in-hosted-adapter
Open

fix(hosted): prevent credential disclosure by gating mentions and redacting published results#81
BunsDev wants to merge 1 commit into
mainfrom
codex/fix-vulnerability-in-hosted-adapter

Conversation

@BunsDev

@BunsDev BunsDev commented Aug 14, 2026

Copy link
Copy Markdown
Member

Motivation

  • Close a high-severity data-leak where attacker-controlled issue/PR review comments could queue work that runs with live installation and Codex/OpenAI tokens and then publish unsanitized runtime result fields back to GitHub comments.

Description

  • Add a trust gate comment_author_is_trusted() and refuse to queue tasks for issue_comment and pull_request_review_comment events when the comment author association is not OWNER, MEMBER, or COLLABORATOR.
  • Sanitize published comment bodies by introducing redact_secrets() and applying it to the rendered publication body to remove the installation token, the Codex/OpenAI token, recognized GitHub token markers, and OpenAI-style sk- tokens before POSTing to GitHub.
  • Add regression tests covering rejection of untrusted commenters, acceptance of trusted commenters, and that published comments redact runtime credentials and recognizable token forms.

Testing

  • Ran python -m unittest deploy/coven-github/test_coven_github_adapter.py, and the adapter unit tests passed (8 tests).
  • Ran python -m py_compile on the modified Python files and it succeeded.
  • Ran cargo check --all-targets and cargo clippy --all-targets -- -D warnings, which completed successfully.
  • Ran cargo test --all; the Rust suites largely passed, but the worker integration suite reported 73 passing tests and 21 failures caused by environment-level HTTP 403 responses to mocked GitHub calls in this execution environment (failures are test-environment related and not caused by the Python adapter change).

Codex Task

Signed-off-by: Codex <codex@openai.com>
Copilot AI lite review requested due to automatic review settings August 14, 2026 14:40

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.

Pull request overview

This PR hardens the hosted GitHub adapter against credential disclosure by (1) preventing untrusted users’ mentions from queuing privileged work and (2) redacting secrets from runtime results before publishing them back to GitHub comments.

Changes:

  • Add comment_author_is_trusted() and gate issue_comment / pull_request_review_comment mention-triggered task creation to OWNER/MEMBER/COLLABORATOR.
  • Introduce redact_secrets() and apply it to published comment bodies in publish_result_if_configured().
  • Add adapter unit tests covering the trust gate and publication redaction behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
deploy/coven-github/coven_github_adapter.py Adds comment-author trust gating for mention triggers and redacts secrets before publishing results as GitHub comments.
deploy/coven-github/test_coven_github_adapter.py Adds regression tests for rejecting untrusted comment authors, allowing trusted authors, and ensuring published comments redact credentials/token-like strings.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +1667 to +1676
def redact_secrets(text, secret_values=()):
redacted = str(text)
for secret in secret_values:
if secret:
redacted = redacted.replace(str(secret), "[redacted]")
redacted = redact_tokenish(redacted)
return re.sub(
r"(?<![A-Za-z0-9])sk-[A-Za-z0-9_-]{12,}",
"sk-[redacted]",
redacted,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants