garage/src
smattymatty 54c63387cb fix(cors): include Access-Control-Allow-Headers in permissive OPTIONS placeholder (#1450)
The OPTIONS placeholder for buckets without a resolvable global alias returns` Access-Control-Allow-Origin: *` and `Access-Control-Allow-Methods: *` but omits `Access-Control-Allow-Headers`.

Bug verified against Garage v2.2.0 with a local-aliased bucket: OPTIONS placeholder doesn't have `Access-Control-Allow-Headers`, causes the browser to reject signed PUT preflights

The current placeholder fails open for unsigned simple requests but blocks every signed request, undermining the design intent flagged in the FIXME:

```rs
// We take the permissive approach of allowing everything,
// because we don't want to prevent web apps that use
// local bucket names from making API calls.
```

Adds `Access-Control-Allow-Headers: *` so the permissive default is actually permissive for the request shapes that exist in practice.

Refs #258. Does not address the broader FIXME (CORS rule resolution for local-aliased buckets); the placeholder approach is preserved.

All tests are fine locally:

```bash
 ▲ ~/opensource/garage cargo test -p garage_api_common cors::

running 5 tests
test cors::tests::preflight_with_single_allowed_origin_returns_request_origin ... ok
test cors::tests::preflight_with_multiple_allowed_origins_reflects_request_origin ... ok
test cors::tests::preflight_with_wildcard_allowed_origin_returns_wildcard ... ok
test xml::cors::tests::test_deserialize_norules ... ok
test xml::cors::tests::test_deserialize ... ok

test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 16 filtered out; finished in 0.00s
```

Co-authored-by: smattymatty <smattymatt@gmail.com>
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1450
Reviewed-by: Alex <lx@deuxfleurs.fr>
2026-05-12 08:17:48 +00:00
..
api fix(cors): include Access-Control-Allow-Headers in permissive OPTIONS placeholder (#1450) 2026-05-12 08:17:48 +00:00
block bg vars: return "never" when scrub never ran (fix #1421) (#1430) 2026-05-01 15:06:02 +00:00
db Replace the existential lifetime in sqlite adapter with a static one (#1407) 2026-04-20 09:28:46 +00:00
format-table fix clippy lint in format-table crate 2023-05-17 13:06:37 +02:00
garage simplify the garage health subcommand 2026-05-01 21:32:50 +02:00
k2v-client docs: add missing backticks in documentation 2026-02-17 18:38:44 +00:00
model Add fuzing for AdminApiToken CRDT (#1443) 2026-05-07 11:43:25 +00:00
net set some flaky tests as #[ignore] (#1432) 2026-05-01 14:44:28 +00:00
rpc admin api: return full layout computation statistics as json (fix #1428) 2026-05-01 17:53:39 +00:00
table bump version number to v2.3.0 2026-04-16 18:34:27 +02:00
util Fuzz Bucket CRDT (#1442) 2026-05-06 18:55:47 +00:00
web fix(cors): return single matching origin instead of multiple values in Access-Control-Allow-Origin (#1419) 2026-04-28 14:48:02 +00:00