Skip to content

fix _require_key_id leaking _key_id into JOSE payload - #84

Draft
toddr-bot wants to merge 1 commit into
mainfrom
koan.toddr.bot/fix-require-key-id-leak
Draft

fix _require_key_id leaking _key_id into JOSE payload#84
toddr-bot wants to merge 1 commit into
mainfrom
koan.toddr.bot/fix-require-key-id-leak

Conversation

@toddr-bot

@toddr-bot toddr-bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

What

Stops _require_key_id() from injecting _key_id into the JOSE payload of create_order() requests.

Why

_require_key_id() mutated the caller's %opts hash by setting $opts_hr->{'_key_id'} = $self->{'_key_id'}. In create_order(), this caused the account key ID URL to be included in the newOrder JOSE payload — e.g. {"_key_id":"https://acme.example.com/acct/12345","identifiers":[...]}. The key ID already travels in the JWS kid header; the payload copy was unintentional data leakage.

How

Simplified _require_key_id() to a pure validation check: it reads $self->{'_key_id'}, dies if falsy, and returns — no hash argument, no mutation. Updated all three callers (create_order, change_key, deactivate_account) to call it without arguments.

Testing

Added t/Net-ACME2-create-order-payload.t which intercepts the newOrder JOSE payload via the mock server and asserts _key_id is absent. Full suite passes (382 tests).


Quality Report

Changes: 3 files changed, 82 insertions(+), 6 deletions(-)

Code scan: clean

Tests: passed (OK)

Branch hygiene: clean

Generated by Kōan

_require_key_id() mutated the caller's opts hash by assigning
$self->{_key_id} into $opts_hr->{_key_id}. In create_order(), this
caused the account key ID URL to be included in the newOrder JOSE
payload sent to the ACME server. The key ID already travels in the
JWS kid header — the payload copy was unintentional data leakage.

Simplified _require_key_id() to a pure validation check with no
hash argument. Added a test that intercepts the newOrder payload
and verifies _key_id is absent.
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.

1 participant