Skip to content

fix(security): frame untrusted external tool outputs and PR comments (CLO-1113) - #221

Open
nullStack65 wants to merge 1 commit into
release/native-0.1.10from
fix/clo-1113-untrusted-tool-output-fencing
Open

nullStack65 wants to merge 1 commit into
release/native-0.1.10from
fix/clo-1113-untrusted-tool-output-fencing

Conversation

@nullStack65

Copy link
Copy Markdown
Owner

Summary

Implements the PR-eligible t3code scope of CLO-1113 (audit finding A-P1-10: reduce blast radius) targeting release/native-0.1.10:

  • Untrusted-content framing helper (apps/server/src/security/untrustedContent.ts):
    • Classifies external untrusted sources (mail/Gmail/IMAP, Twenty CRM, web fetch/browser snapshots, PR/issue comments) via isUntrustedExternalSource.
    • Wraps untrusted content in unpredictable per-call <untrusted-<source>-<id>> tags, neutralizes spoofed closing tags and provider mentions, and appends an explicit data-not-instructions notice.
    • Adds defaultRuntimeModeForThreadTrigger (keeping founder-started threads full-access, narrowing webhook/mail/external_event to approval-required).
  • PR comments & descriptions (apps/server/src/pullRequest/pullRequestReviewGuideInput.ts): wraps PR description and settled review comments in untrusted-content frames before passing to review guide generation.
  • External MCP app context (apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts): wraps external-source MCP appContext entries inside the untrusted fence before sending to provider input.

Verification

  • pnpm --filter t3 exec vp test run src/security/untrustedContent.test.ts src/pullRequest/PullRequestReviewGuideService.test.ts — 2/2 files, 12/12 tests passed.
  • pnpm --filter t3 run typecheck — passed cleanly.
  • Out of PR scope (flagged for Kameron's security sign-off per CLO-1113): live Tailscale ACL root SSH narrowing (machines/tailscale/policy.hujson) and undeclared laptop auth_sessions revocation.
  • Deploy: none.

…(CLO-1113)

Implements the PR-eligible t3code scope of CLO-1113 (audit finding A-P1-10):

- Add apps/server/src/security/untrustedContent.ts with unpredictable
  per-call <untrusted-<source>-<id>> framing, closing-tag & provider
  mention neutralization, external-source classification (mail/Gmail,
  Twenty CRM, web fetch/preview, PR/issue comments), and trigger-based
  defaultRuntimeModeForThreadTrigger (keeping founder threads full-access
  and narrowing webhook/mail/external triggers to approval-required).
- Frame PR descriptions and review comments in
  apps/server/src/pullRequest/pullRequestReviewGuideInput.ts.
- Frame external-source MCP appContext values in
  apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts.
- Add unit tests in apps/server/src/security/untrustedContent.test.ts.

Model: gemini-4-neon
Task: CLO-1113
Agent: implementation-subagent
Harness: t3/antigravity
Model-family: gemini
Model-generation: 4
Skills-SHA: 648bce52b3575d550528afb0c5cc178f75199a55
@coderabbitai

coderabbitai Bot commented Nov 25, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant