Skip to content

fix(cli): reject cross-site loopback writes - #315

Merged
xingkaixin merged 1 commit into
mainfrom
feat/cs-193-loopback-write-guard
Aug 11, 2026
Merged

fix(cli): reject cross-site loopback writes#315
xingkaixin merged 1 commit into
mainfrom
feat/cs-193-loopback-write-guard

Conversation

@xingkaixin

Copy link
Copy Markdown
Owner

Summary

  • guard every unauthenticated loopback API mutation before route handlers run
  • require JSON media types for POST, PUT, and PATCH requests
  • reject mismatched Origin values and Fetch Metadata sites other than same-origin or none
  • preserve bodyless DELETE requests and non-browser clients that omit browser-only metadata

Security impact

This blocks cross-site pages from importing bookmarks or injecting client logs through CORS-safelisted POST bodies. The Fetch Metadata policy follows the W3C Sec-Fetch-Site relationship model: https://www.w3.org/TR/fetch-metadata/

Test plan

  • pnpm lint
  • pnpm format:check
  • pnpm test
  • pnpm build

Issue: CS-193

@xingkaixin
xingkaixin merged commit beec134 into main Aug 11, 2026
10 checks passed
@xingkaixin
xingkaixin deleted the feat/cs-193-loopback-write-guard branch August 11, 2026 16:04
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