patches: add v1.11.0 atomic Vault IAM update patch and its leil-rig proof

0004-vault-atomic-update-user.patch makes the Vault IAM backend's
UpdateUserAccount -- what admin update-user, and so every key rotation,
runs -- one KV v2 write with cas set to the version it read, retried
from a fresh read on a check-and-set conflict (up to 5 attempts).
Upstream deleted the entry and created it again: in between, another
instance on the same KV path whose IAM cache missed answered
InvalidAccessKeyId, a failure between the two calls lost the account,
and two updates at once lost one of them. Touches only
auth/iam_vault.go and a new auth/iam_vault_update_test.go.

tests/vault-update/proof.sh proves it on leil-rig against an OpenBao
dev server, with two gateways on one KV path and gateway A's OpenBao
calls held 3 s by a proxy so upstream's gap can be observed. On
leil-test-1: patched 20 passed, 0 failed; 0001-0003 control 13 passed,
7 failed (entry missing 3.00 s, 28 InvalidAccessKeyId on the second
gateway, concurrent rotation lost, account gone after a refused
write). go test on the node: 35 of 35 packages ok.

docs/vault-atomic-update.md has the problem, the change, the proof and
its result; README and the multi-version pipeline doc point at it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
57_WolveandClaude Opus 5.5 committed 2026-11-11 02:04:31 -06:00
1 parent 152ea01107
commit a52f92c100
7 files changed
+1204 -22

No files matched your search

+50 -16
View File
@@ -14,12 +14,18 @@ Artifact names are intentionally **unchanged** — the binary stays
drop-in compatible with existing configs, systemd units, and the
`versitygw` CLI. Only the embedded web UI is rebranded to "S3 Gateway".
The v1.11.0 series also carries one behavioural patch,
**owner-scoped bucket access**: a bucket's ACL and policy may name only
the owner's own keys, public access is read-only, and deleting a bucket
or changing its versioning, object lock or ownership controls is left
to the gateway's root and admins. See
[docs/owner-scoped-access.md](docs/owner-scoped-access.md).
The v1.11.0 series also carries two behavioural patches:
- **Owner-scoped bucket access**: a bucket's ACL and policy may name
only the owner's own keys, public access is read-only, and deleting a
bucket or changing its versioning, object lock or ownership controls
is left to the gateway's root and admins. See
[docs/owner-scoped-access.md](docs/owner-scoped-access.md).
- **Atomic Vault IAM update**: with the Vault IAM backend, `update-user`
(a key rotation) is one check-and-set write of the account's KV entry
instead of a delete and a create, so the account never goes missing
and a failed update leaves it as it was. See
[docs/vault-atomic-update.md](docs/vault-atomic-update.md).
```
upstream tag (vX.Y.Z) this repo
@@ -48,18 +54,22 @@ s3-gateway/
│ ├── v1.11.0/ # the supported series
│ │ ├── 0001-webui-debrand.patch
│ │ ├── 0002-webui-dark-theme.patch
│ │ └── 0003-owner-scoped-access.patch
│ │ ├── 0003-owner-scoped-access.patch
│ │ └── 0004-vault-atomic-update-user.patch
│ └── archive/ # superseded; kept, not built
│ ├── v1.10.0/
│ ├── v1.8.0/
│ ├── v1.7.0/
│ ├── v1.6.0/
│ └── v1.5.0/
├── tests/owner-scope/ # leil-rig proof test for 0003 (proof.sh, s3req.py)
├── tests/
│ ├── owner-scope/ # leil-rig proof test for 0003 (proof.sh, s3req.py)
│ └── vault-update/ # leil-rig proof test for 0004 (proof.sh, watch.py, vaultproxy.py)
├── .gitea/workflows/build.yml
└── docs/
├── multi-version-pipeline.md
└── owner-scoped-access.md # what 0003 does, and its proof test
├── owner-scoped-access.md # what 0003 does, and its proof test
└── vault-atomic-update.md # what 0004 does, and its proof test
```
## Build locally
@@ -97,9 +107,9 @@ publish a build of a superseded release.
Currently maintained:
| Upstream tag | Patch set | Contents |
|--------------|---------------|---------------------------------------------------------------------------------------------|
| `v1.11.0` | `v1.11.0/` | `0001-webui-debrand.patch`, `0002-webui-dark-theme.patch`, `0003-owner-scoped-access.patch` |
| Upstream tag | Patch set | Contents |
|--------------|---------------|--------------------------------------------------------------------------------------------------------------------------------|
| `v1.11.0` | `v1.11.0/` | `0001-webui-debrand.patch`, `0002-webui-dark-theme.patch`, `0003-owner-scoped-access.patch`, `0004-vault-atomic-update-user.patch` |
**v1.11.0 is the only supported version.** It supersedes `v1.10.0`
with 42 further upstream fixes, so the older series — `v1.10.0`,
@@ -174,13 +184,37 @@ account's `UserID`.
- An ACL holding the `all-users` `READ` grant can be written back
unchanged (upstream answers `500`).
It is the series' only patch outside `webui/`, and it has unit tests:
after a rebase run `go test ./auth/ ./s3api/...` (on Linux — on Windows
upstream's standalone-IAM, posix and CLI tests fail with or without the
series) and
It and `0004` are the series' only patches outside `webui/`, and both
have unit tests: after a rebase run `go test ./auth/ ./s3api/...` (on
Linux — on Windows upstream's standalone-IAM, posix and CLI tests fail
with or without the series) and
the leil-rig proof test in
[docs/owner-scoped-access.md](docs/owner-scoped-access.md#proving-the-patch-is-in-on-leil-rig).
### What the atomic Vault update patch does
`0004-vault-atomic-update-user.patch` changes one call in
`auth/iam_vault.go`, the Vault IAM backend's `UpdateUserAccount` —
what `versitygw admin update-user`, and so every key rotation, runs.
Upstream deletes the account's KV entry and creates it again; in
between the account does not exist, so another gateway instance on the
same KV path whose IAM cache misses answers `InvalidAccessKeyId`, and a
failure between the two calls loses the account for good.
- **One write.** The entry is read with its KV version, changed, and
written back with `cas` set to that version.
- **Conflicts retry.** If another writer got there first, the update
starts again from a fresh read, up to 5 times.
- **Unchanged:** "user not found" for a missing account (also one
deleted mid-update, which is never re-created), the re-login on a
`403`, and every other Vault call.
- KV v2 now keeps the account's earlier versions, old secrets included,
up to the mount's `max_versions`.
Its unit tests run with the ones above (`go test ./auth/`); its
leil-rig proof test is in
[docs/vault-atomic-update.md](docs/vault-atomic-update.md#proving-the-patch-is-in-on-leil-rig).
## Adding / refreshing a version
When upstream cuts a new release you want a build of, you rebase the