Repository navigation
Let the native app create papers and import ZIPs through /api/latex - #80
Merged
Merged
Conversation
The POST path required an Origin equal to our own host, which an app never sends, so paper creation and ZIP import returned 403. Use the shared write origin rule (Bearer, no Origin, no cookie, no Sec-Fetch-*) like the school, GPU, arcade, deploy and study routes. A present Origin is still checked exactly as before; host, action and authentication checks are unchanged. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The route now uses the shared write-origin rule, and this test's module whitelist did not know it. Inject the real module so the test keeps exercising the actual policy. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019WGLWH38z9TSjANcYp59QN
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.
Follow-up to #78. `/api/latex/{action}` POST required `Origin === https://`, so the app got 403 when creating a paper or importing a ZIP (`new`, `import`, `upload-begin|chunk|finish|cancel`, `trash`, `allocate`).
Change
One line: the Origin check now uses the shared `writeOriginAllowed` rule from `schoolsProxySecurity` (Bearer, no Origin, no Cookie, no Sec-Fetch-*). A present Origin is checked exactly as before. Host allow-list (`cbgpu.com`, `researcher`, `app`), action allow-list, token verification and rate limits are unchanged.
Tests
`tests/latex-native-origin.test.mts` runs the real route: all five write actions succeed for an app request and reach the editor service with the identity taken from the verified token; own-page requests still work; foreign / suffix-spoofed Origin, cookie without Origin, browser metadata without Origin and no credentials are all 403 and never reach the editor service; invalid token still 401; wrong host and unknown action still 404.
🤖 Generated with Claude Code