Repository navigation
fix(web): same-origin check on cookie-authenticated mutations - #103
Merged
Merged
Conversation
… usage routes Closes #47 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Closes #49 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…efore scan Closes #61 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Closes #79 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ndow edges Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
SameSite=Lax still lets a sibling subdomain send the session cookie, and these routes parse bodies without requiring application/json, so a no-preflight POST could act as the signed-in user. - favorite, vote, rate and review (session-only) call crossOriginRefusal before reading the session. - register checks only when authenticateRequest fell back to the session. - resolveLimitedActor (release state, personal kits, publisher provision) answers 403 cross_origin when neither Authorization nor X-Admin-Secret is present and the origin is foreign. API-key and admin-secret requests are not ambient and stay unchecked. Refs #101 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S4FiHPufhLdcCyhMszKa95
The vote endpoint takes { type: up|down|none } and returns
{ vote_type, net_votes }; docs described { direction } with toggle-off.
Also fix /api/report auth (API key only), the votes column name, the
protected-endpoint table, and drop the nonexistent references route.
Document the same-origin rule and the issue claim labels in CLAUDE.md.
Refs #102
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S4FiHPufhLdcCyhMszKa95
…e-http release-state-http.ts was past the 200-line limit. The capped application/json body reader moves to release-json-body.ts and is re-exported, so callers keep their imports. The same-origin state tests get their own file, and the publisher provisioning docs list the 403 cross_origin case. Refs #101 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S4FiHPufhLdcCyhMszKa95
…/modest-wozniak-8uwf2a
Contributor
Author
|
Status: CI ( Blocked on #96. This PR is stacked on Generated by Claude Code |
…indow-edge false positives A licence file that is not valid UTF-8 skipped the instruction scan entirely. It is now decoded lossily and scanned; markup such as LICENSE.md never gets the latin-1 allowance and is quarantined as non-UTF-8 text. A secret token ending exactly at a non-final window edge was matched because the end of the string acted as a word boundary; those matches are now left to the next window, which sees the following bytes. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ence names, keep long tokens at window edges A non-UTF-8 licence file is now scanned as lossy UTF-8 and as latin-1 (soft hyphens removed), so NBSP or soft-hyphen tricks that only a latin-1 reader sees no longer slip past the instruction scan. Only a match lying wholly inside the window overlap is treated as a cut artifact; a long secret that began before the overlap is still reported. Licence names are upper-case LICENSE/LICENCE/COPYING/NOTICE/AUTHORS with an optional upper-case suffix and .txt/.md/.markdown; free suffixes such as NOTICE-install or LICENSE.rst keep every rule. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…nical names Licence-like names in any spelling (NOTICE-install, LICENSE_MIT, PATENTS, license) are instruction documents again, so injection, shell/URL syntax and non-UTF-8 text are all checked. Only the canonical upper-case names get the syntax and latin-1 exemptions. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…/modest-wozniak-8uwf2a
Keeps the same-origin refusal in resolveLimitedActor alongside main's narrowed return type, so promote, review and collections writes inherit it; documents cross_origin on those endpoints. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S4FiHPufhLdcCyhMszKa95
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SameSite=Laxstill lets a sibling subdomain send the session cookie. These routes read their bodies withrequest.json(), which does not requireapplication/json. Atext/plainPOST, which needs no preflight, could therefore act as the signed-in user.getSessiononly, so none of them has a Bearer path.crossOriginRefusalruns before the session is read. A refused request gets403.authenticateRequestcan fall back to the session. The check runs only whenmethod === "session", so CLIpublishandusecalls that send a key are unaffected.resolveLimitedActorcallers: these are release state, promote, review, trusted publishers, collections writes, personal-kit writes, and publisher provisioning. When neitherAuthorizationnorX-Admin-Secretis present and the origin is foreign, the request gets403 cross_origin. That happens before any limiter runs, any session is read, or the DB is touched. A key or the admin secret is never sent automatically by the browser, and both force a CORS preflight anyway.release-json-body.tsand is re-exported, so existing callers keep their imports. This keepsrelease-state-http.tsunder the 200-line limit.{type: up|down|none}in,{vote_type, net_votes}out, and 429./api/reportauth (API key only), thevotes.vote_typecolumn name, the protected-endpoint table, and the stale vote flow./api/skills/:slug/referencesroute is dropped from the docs.cross_originis documented for release state, publishers, collections, promote and personal kits.CLAUDE.mdgets a same-origin caveat and an issue-claim label workflow.Tests
app/routes/api.cookie-mutation-origin.test.ts, with one block per route:http:on the same host, andSec-Fetch-Site: same-site/cross-siteeach get 403, with no session read and no write.Sec-Fetch-Site: same-origin/none, and header-less requests get 200.tests/releases/release-state-origin.test.tsand a new case intests/personal-kits/kit-revisions.test.ts:cross_originand nothing is written. The audit is empty, and the follow-up write withexpectedGeneration: 0gets 201.main(fix: alias slugs, .pi untracking, release scan tuning, API key settings follow-ups #96, feat: collections API and verified CLI installer with lockfile, sync and local MCP (#35 phase 3) #98, fix(scan): normalize separators before prompt-injection matching #111),pnpm typecheckis clean andnpx vitest runpasses 115 files (2309 passed, 2 skipped).pnpm buildsucceeds.Requestheaders.Closes #101
Closes #102
🤖 Generated with Claude Code
https://claude.ai/code/session_01S4FiHPufhLdcCyhMszKa95