fix(spoolman): remove SPOOLMAN_CORS_ORIGIN=* wildcard - #1683
Merged
Conversation
Restores upstream Spoolman v0.26.1's CSRF/origin guard, which the wildcard silently disabled entirely (not just relaxed CORS). No PrintFarmer client (backend HttpClient, React proxy controller, iOS app) sets an Origin header, so this is functionally a no-op while restoring the protection. Closes #1682 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Collaborator
Author
|
Squad-Reviewer: bishop Diff is exactly the one-line removal of SPOOLMAN_CORS_ORIGIN=*. Grep confirms no other occurrence in the repo. No PrintFarmer client (backend HttpClient, React proxy controller, iOS app) sets an Origin header, so no functional regression. YAML remains valid. |
Collaborator
Author
|
Squad-Reviewer: vasquez Diff correctly removes only the wildcard CORS origin line. Repo-wide grep confirms no other definition site. No client code injects an Origin header that the new upstream guard would trip. No structural YAML issues introduced. |
Collaborator
Author
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
Removes
SPOOLMAN_CORS_ORIGIN=*fromscripts/docker/compose-templates/docker-compose.spoolman.yml. In the upcoming Spoolman v0.26.1 image (upstream-synced fork), this wildcard completely disables a new CSRF/origin guard middleware — not just CORS. Upstream'strusts_all_origins()returnstruewhenever the value contains*, andadd_trusted_origin_middleware()skips installing the guard entirely when that's the case.Nothing in PrintFarmer relies on the wildcard:
src/infra/Services/Spoolman/SpoolmanService.cs(backendHttpClient) never sets anOriginheader.src/api/Controllers/SpoolmanController.cs— no direct Spoolman URL is constructed client-side.SpoolService.swiftalso calls/api/spoolman/*exclusively.The origin guard only inspects
Originon state-changing requests and trusts requests with noOriginheader, so all of the above remain unaffected. Same-origin browsing of the Spoolman web UI (${SPOOLMAN_PORT:-7912}) is unaffected either, since same-origin requests don't carry a foreignOrigin.Closes #1682
Scope confirmation
Grepped the repo before changing anything —
SPOOLMAN_CORS_ORIGINappeared in exactly one place (this file, this line). No occurrence in.env.template, helm charts, ordeploy-docker.sh.Validation
bash tests/test-compose-generator.sh— 67/67 passed.scripts/docker/compose-generator.sh --include-spoolmanand confirmed the generatedspoolmanservice'senvironment:block now contains onlyTZ=${TZ:-UTC}— noSPOOLMAN_CORS_ORIGIN— and the YAML is otherwise valid.origin/development(fast-forward, no merge/conflicts needed — confirmed viagit fetch origin && git merge origin/development→ "Already up to date").Not verifiable in this environment
403behavior (issue's negative test) requires the fork's Spoolman image rebuilt on upstream v0.26.1. The currently deployed image is0.24.5, which predates the origin guard entirely, so no live container in this environment can demonstrate the guard being active. This change is a no-op on0.24.5and becomes protective automatically once the image is rebuilt, per the issue's sequencing note.Pre-PR review gate
3-way adversarial review (Bishop, Hicks, Vasquez) completed on the branch prior to opening this PR — consensus 3/3 APPROVE. Verdicts will also be posted as PR comments in the canonical format for the
squad/pre-pr-verdictgate.