Skip to content

feat(server): opt-in CORS for browser SDK clients (#346); bump Go to 1.26.5 - #347

Merged
scttfrdmn merged 1 commit into
mainfrom
chore/health-2026-07-20
Jul 20, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
chore/health-2026-07-20

Conversation

@scttfrdmn

Copy link
Copy Markdown
Owner

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 / OPTIONS handler, 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) to buildRouter:

  • gated on server.cors.enabled (off by default; non-browser callers unaffected)
  • origin allowlist via server.cors.allowed_origins (default reflect-any *)
  • OPTIONS preflight → 2xx; permits the AWS SDK's x-amz-* / amz-sdk-* / authorization / content-type headers
  • exposes x-amzn-RequestId / x-amz-request-id / x-amzn-ErrorType / x-amz-id-2 so 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)

govulncheck started failing on every PR due to a new call-reachable crypto/tls stdlib advisory GO-2026-5856 (fixed in go1.26.5). Bumped toolchain in both go.mod and test/e2e/go.mod; CI reads it from go.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 lint clean on go1.26.5; govulncheck ./... → no vulnerabilities. New tests: TestServer_CORS_Preflight (origin reflection + exposed headers) and TestServer_CORS_DisabledByDefault. CORS semantics verified against the go-chi/cors and AWS SDK preflight behavior.

Closes #346

…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

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
emulator/server.go 83.33% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit d1fa2c9 into main Jul 20, 2026
10 checks passed
@scttfrdmn
scttfrdmn deleted the chore/health-2026-07-20 branch July 20, 2026 20:22
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.

Add CORS support so browser-based AWS SDK clients can use the emulator

1 participant