fix: provisioner + signer repro-blockers for local bring-up - #58
fix: provisioner + signer repro-blockers for local bring-up#58rickstaa wants to merge 4 commits into
Conversation
8c49a5c to
342466d
Compare
… env The entrypoint only read the password from /data/.eth-password, so a password supplied via .env (SIGNER_ETH_PASSWORD) never reached the file and the signer could not unlock its keystore. Write the env value to the password file when set, falling back to the existing file otherwise. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Querying client-grants with a raw audience query param left the URL unencoded and returned a mismatched grant, causing a 409 client_grant_conflict on re-run. Query by client_id only and select the matching audience in jq instead. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The action bootstrap only accepted the CLI via [ -x "$AUTH0_BIN" ], which fails when auth0 is resolved from PATH rather than a local file. Accept either form. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
342466d to
131a5b7
Compare
eliteprox
left a comment
There was a problem hiding this comment.
LGTM! Approved with small nites
| local client_id="$1" audience="$2" scopes_json="$3" gid body resp | ||
| ENSURED_GRANT_CREATED=0 | ||
| gid="$(aapi_get "client-grants?client_id=${client_id}&audience=${audience}" | jq -r '.[0].id // empty')" | ||
| gid="$(aapi_get "client-grants?client_id=${client_id}" | jq -r --arg a "$audience" '[.[] | select(.audience==$a) | .id] | first // empty')" |
There was a problem hiding this comment.
[.[] | select(.audience==$a) | .id] | first // empty picks an arbitrary match if multiple client-grants exist for the same (client_id, audience) pair, without detecting or reporting the duplication. Failure scenario: since the old unencoded-query bug likely caused previous runs to create duplicate grants instead of finding the existing one (plausibly the actual root cause of the 409 this PR fixes), a tenant carrying that leftover state could now have the script non-deterministically PATCH a different grant on each rerun rather than surfacing the conflict. Worth a guard that errors (or warns) if more than one grant matches.
|
|
||
| if [ ! -f /data/.eth-password ]; then | ||
| if [ -n "${SIGNER_ETH_PASSWORD:-}" ]; then | ||
| printf '%s' "$SIGNER_ETH_PASSWORD" >/data/.eth-password |
There was a problem hiding this comment.
Small nit, you could optionally log what is happening here (without logging any secrets of course).
…n fallbacks - bootstrap.sh: percent-encode client_id + audience (RFC 3986) and keep the Management API filter instead of client-side jq matching; die when more than one grant matches a (client_id, audience) pair rather than PATCHing an arbitrary one. - bootstrap-credentials-exchange-action.sh: resolve the auth0 CLI via a single path (PATH, else local copy) instead of a dual command -v / -x chain. - entrypoint.sh: require an explicit keystore password (SIGNER_ETH_PASSWORD or a mounted /data/.eth-password) and fail loudly instead of silently writing an empty password file; log the non-secret source.
Cherry-picks the two auth0-provisioner fixes from #58 (rickstaa). Both are repro-blockers for the one-command bootstrap this PR adds, and the second one undermines the idempotency claim that is the main argument for keeping this provisioner over the Go CLI in #33. - bootstrap-credentials-exchange-action.sh: when the auth0 CLI is on PATH, command -v succeeds and AUTH0_BIN stays "auth0", after which [ -x "auth0" ] tests a relative path in the working directory and fails. The script died precisely when the CLI was available. - bootstrap.sh: the client-grants filter sent the audience unencoded. An audience is a URI, so ":" and "/" broke the query and the Management API returned a mismatched grant, producing 409 client_grant_conflict on re-run. Both filters are now percent-encoded, and more than one matching grant is a hard stop rather than a silent .[0] pick. #58's third fix (remote-signer/entrypoint.sh reading SIGNER_ETH_PASSWORD) is not included: that bug is on main, no PR in this stack touches remote-signer, and it should land independently rather than ride along here. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Cherry-picks the two auth0-provisioner fixes from #58 (rickstaa). Both are repro-blockers for the one-command bootstrap this PR adds, and the second one undermines the idempotency claim that is the main argument for keeping this provisioner over the Go CLI in #33. - bootstrap-credentials-exchange-action.sh: when the auth0 CLI is on PATH, command -v succeeds and AUTH0_BIN stays "auth0", after which [ -x "auth0" ] tests a relative path in the working directory and fails. The script died precisely when the CLI was available. - bootstrap.sh: the client-grants filter sent the audience unencoded. An audience is a URI, so ":" and "/" broke the query and the Management API returned a mismatched grant, producing 409 client_grant_conflict on re-run. Both filters are now percent-encoded, and more than one matching grant is a hard stop rather than a silent .[0] pick. #58's third fix (remote-signer/entrypoint.sh reading SIGNER_ETH_PASSWORD) is not included: that bug is on main, no PR in this stack touches remote-signer, and it should land independently rather than ride along here. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Adopted two of these three into #82, which carries Taken:
Not taken:
One thing worth a conscious nod when the grant fix is reviewed: |
Cherry-picks the two auth0-provisioner fixes from #58 (rickstaa). Both are repro-blockers for the one-command bootstrap this PR adds, and the second one undermines the idempotency claim that is the main argument for keeping this provisioner over the Go CLI in #33. - bootstrap-credentials-exchange-action.sh: when the auth0 CLI is on PATH, command -v succeeds and AUTH0_BIN stays "auth0", after which [ -x "auth0" ] tests a relative path in the working directory and fails. The script died precisely when the CLI was available. - bootstrap.sh: the client-grants filter sent the audience unencoded. An audience is a URI, so ":" and "/" broke the query and the Management API returned a mismatched grant, producing 409 client_grant_conflict on re-run. Both filters are now percent-encoded, and more than one matching grant is a hard stop rather than a silent .[0] pick. #58's third fix (remote-signer/entrypoint.sh reading SIGNER_ETH_PASSWORD) is not included: that bug is on main, no PR in this stack touches remote-signer, and it should land independently rather than ride along here. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Cherry-picks the two auth0-provisioner fixes from #58 (rickstaa). Both are repro-blockers for the one-command bootstrap this PR adds, and the second one undermines the idempotency claim that is the main argument for keeping this provisioner over the Go CLI in #33. - bootstrap-credentials-exchange-action.sh: when the auth0 CLI is on PATH, command -v succeeds and AUTH0_BIN stays "auth0", after which [ -x "auth0" ] tests a relative path in the working directory and fails. The script died precisely when the CLI was available. - bootstrap.sh: the client-grants filter sent the audience unencoded. An audience is a URI, so ":" and "/" broke the query and the Management API returned a mismatched grant, producing 409 client_grant_conflict on re-run. Both filters are now percent-encoded, and more than one matching grant is a hard stop rather than a silent .[0] pick. #58's third fix (remote-signer/entrypoint.sh reading SIGNER_ETH_PASSWORD) is not included: that bug is on main, no PR in this stack touches remote-signer, and it should land independently rather than ride along here. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Cherry-picks the two auth0-provisioner fixes from #58 (rickstaa). Both are repro-blockers for the one-command bootstrap this PR adds, and the second one undermines the idempotency claim that is the main argument for keeping this provisioner over the Go CLI in #33. - bootstrap-credentials-exchange-action.sh: when the auth0 CLI is on PATH, command -v succeeds and AUTH0_BIN stays "auth0", after which [ -x "auth0" ] tests a relative path in the working directory and fails. The script died precisely when the CLI was available. - bootstrap.sh: the client-grants filter sent the audience unencoded. An audience is a URI, so ":" and "/" broke the query and the Management API returned a mismatched grant, producing 409 client_grant_conflict on re-run. Both filters are now percent-encoded, and more than one matching grant is a hard stop rather than a silent .[0] pick. #58's third fix (remote-signer/entrypoint.sh reading SIGNER_ETH_PASSWORD) is not included: that bug is on main, no PR in this stack touches remote-signer, and it should land independently rather than ride along here. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Cherry-picks the two auth0-provisioner fixes from #58 (rickstaa). Both are repro-blockers for the one-command bootstrap this PR adds, and the second one undermines the idempotency claim that is the main argument for keeping this provisioner over the Go CLI in #33. - bootstrap-credentials-exchange-action.sh: when the auth0 CLI is on PATH, command -v succeeds and AUTH0_BIN stays "auth0", after which [ -x "auth0" ] tests a relative path in the working directory and fails. The script died precisely when the CLI was available. - bootstrap.sh: the client-grants filter sent the audience unencoded. An audience is a URI, so ":" and "/" broke the query and the Management API returned a mismatched grant, producing 409 client_grant_conflict on re-run. Both filters are now percent-encoded, and more than one matching grant is a hard stop rather than a silent .[0] pick. #58's third fix (remote-signer/entrypoint.sh reading SIGNER_ETH_PASSWORD) is not included: that bug is on main, no PR in this stack touches remote-signer, and it should land independently rather than ride along here. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Cherry-picks the two auth0-provisioner fixes from #58 (rickstaa). Both are repro-blockers for the one-command bootstrap this PR adds, and the second one undermines the idempotency claim that is the main argument for keeping this provisioner over the Go CLI in #33. - bootstrap-credentials-exchange-action.sh: when the auth0 CLI is on PATH, command -v succeeds and AUTH0_BIN stays "auth0", after which [ -x "auth0" ] tests a relative path in the working directory and fails. The script died precisely when the CLI was available. - bootstrap.sh: the client-grants filter sent the audience unencoded. An audience is a URI, so ":" and "/" broke the query and the Management API returned a mismatched grant, producing 409 client_grant_conflict on re-run. Both filters are now percent-encoded, and more than one matching grant is a hard stop rather than a silent .[0] pick. #58's third fix (remote-signer/entrypoint.sh reading SIGNER_ETH_PASSWORD) is not included: that bug is on main, no PR in this stack touches remote-signer, and it should land independently rather than ride along here. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Three small fixes hit while bringing up this PR's stack (auth0-provisioner + remote-signer) locally. Each is an independent repro-blocker; no functional change to the exchange/provisioning flow.
Fixes
SIGNER_ETH_PASSWORDwhen set. Previously the password was only read from/data/.eth-password, so a password supplied via.envnever reached the file and the signer could not unlock its keystore.client_idonly and select the matching audience injq. The prior rawaudiencequery param went out unencoded and returned a mismatched grant, causing a409 client_grant_conflicton re-run.auth0CLI when resolved fromPATH(command -v), not just as a local executable ([ -x ]).Notes
feat/session-exchange-openmeter-provisioningso it layers directly onto PR feat(builder-api): OpenMeter session exchange with provisioning #57..env, override, keystore mount kept local).