Skip to content

fix(consent): send CSRF token on agent auth-request approve/deny#1969

Merged
jaylfc merged 1 commit into
devfrom
fix/consent-actions-csrf
Jul 18, 2026
Merged

fix(consent): send CSRF token on agent auth-request approve/deny#1969
jaylfc merged 1 commit into
devfrom
fix/consent-actions-csrf

Conversation

@jaylfc

@jaylfc jaylfc commented Jul 18, 2026

Copy link
Copy Markdown
Owner

ConsentActions used a plain fetch() with no X-CSRF-Token header, so every external-agent access approval/denial (bell notification, toast, Decisions app) failed with 'CSRF token missing'. Wraps the fetch init in withCsrf() like AgentKillSwitch. tsc clean. Unblocks the whole agent consent flow.


Summary by Gitar

  • New doc-review system:
    • Added DocReviewStore for tracking document states (awaiting_review, approved, changes_requested) with SQL persistence.
    • Implemented project_doc_review API routes for managing state transitions and actor tracking.
  • UI integration:
    • Integrated ReviewBadge into FilesApp to display and cycle review states for project documents.
  • Security:
    • Added _AGENT_DOC_REVIEW_ROUTES allowlist and middleware gating to ensure agents can only access doc-review routes for their scoped projects.
  • Testing:
    • Added comprehensive test_doc_review.py covering state transitions, actor recording, and security gating (scoped tokens vs 404/403 scenarios).

This will update automatically on new commits.

Summary by CodeRabbit

  • Bug Fixes
    • Improved security handling for consent approval and denial requests.
    • Preserved existing request details while ensuring required CSRF protection is applied.

ConsentActions used a plain fetch() with no X-CSRF-Token header, so every
external-agent access approval/denial (bell notification, toast, and the
Decisions app) failed with 'CSRF token missing' on the CSRF-gated approve/deny
route. Wrap the fetch init in withCsrf() like AgentKillSwitch does.
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@jaylfc
jaylfc merged commit b4c5f32 into dev Jul 18, 2026
1 check passed
@jaylfc
jaylfc deleted the fix/consent-actions-csrf branch July 18, 2026 01:31
@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 66e1534a-b64f-4cfd-b7ab-3e4403ba9a5f

📥 Commits

Reviewing files that changed from the base of the PR and between af97986 and b49844e.

📒 Files selected for processing (1)
  • desktop/src/components/ConsentActions.tsx

📝 Walkthrough

Walkthrough

Changes

Consent decision request

Layer / File(s) Summary
Wrap consent POST with CSRF handling
desktop/src/components/ConsentActions.tsx
The approve/deny POST options are passed through withCsrf, preserving the request body and included credentials.

Estimated code review effort: 2 (Simple) | ~5 minutes

Possibly related PRs

  • jaylfc/taOS#1777: Updates the same consent decision payload in ConsentActions.tsx.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/consent-actions-csrf

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

Comment @coderabbitai help to get the list of available commands.

@gitar-bot

gitar-bot Bot commented Jul 18, 2026

Copy link
Copy Markdown

Important

You are using the Gitar free plan. Upgrade to unlock code review, CI analysis, auto-apply, custom automations, and more.

Gitar

@kilo-code-bot

kilo-code-bot Bot commented Jul 18, 2026

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 files)
  • desktop/src/components/ConsentActions.tsx

Reviewed by hy3:free · Input: 37.7K · Output: 1.5K · Cached: 97.5K

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