Repository navigation
feat(server): opt-in CORS for browser SDK clients (#346); bump Go to 1.26.5 - #347
Merged
Merged
Conversation
…1.26.5 #346: add CORS middleware (github.com/go-chi/cors) to buildRouter, gated on server.cors.enabled. Reflects the configured origin allowlist (default '*'), handles OPTIONS preflight, permits the AWS SDK's x-amz-*/amz-sdk-*/authorization headers, and exposes x-amzn-RequestId/x-amz-request-id/x-amzn-ErrorType/x-amz-id-2 so browser SDK clients can read request IDs and seeded error types. Off by default (non-browser callers unaffected). New CORSConfig; documented in substrate.yaml.example. Tests cover preflight reflection, exposed headers, and disabled-by-default. Security: bump toolchain go1.26.4 -> go1.26.5 in both modules to clear the call-reachable crypto/tls advisory GO-2026-5856 (was failing govulncheck on every PR). govulncheck now clean. make test (race) + lint clean on go1.26.5.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Health + up-to-date pass for 2026-07-20, folding in #346.
#346 — CORS for browser-based AWS SDK clients (Added)
The HTTP server had no CORS headers /
OPTIONShandler, so browser SDK clients (served from another origin) couldn't reach it — every call failed at preflight. Adds opt-in CORS middleware (github.com/go-chi/cors) tobuildRouter:server.cors.enabled(off by default; non-browser callers unaffected)server.cors.allowed_origins(default reflect-any*)OPTIONSpreflight → 2xx; permits the AWS SDK'sx-amz-*/amz-sdk-*/authorization/content-typeheadersx-amzn-RequestId/x-amz-request-id/x-amzn-ErrorType/x-amz-id-2so the browser SDK can read request IDs and seeded error types (keeps failure-path testing usable from the browser)Unblocks spawn-ts (browser-native port of spore.host spawn). Documented in
substrate.yaml.example.Go toolchain → 1.26.5 (Security)
govulncheckstarted failing on every PR due to a new call-reachablecrypto/tlsstdlib advisory GO-2026-5856 (fixed in go1.26.5). Bumpedtoolchainin bothgo.modandtest/e2e/go.mod; CI reads it fromgo.mod, so the check passes again. This also unblocks the open Dependabot PRs (#342/#343), which were red for the same reason.Verification
make test(race) +make lintclean on go1.26.5;govulncheck ./...→ no vulnerabilities. New tests:TestServer_CORS_Preflight(origin reflection + exposed headers) andTestServer_CORS_DisabledByDefault. CORS semantics verified against the go-chi/cors and AWS SDK preflight behavior.Closes #346