Skip to content

Register only verified parties, bound to subject keys with key lineage - #13

Open
samlown wants to merge 11 commits into
mainfrom
net-key-lineage
Open

samlown wants to merge 11 commits into
mainfrom
net-key-lineage

Conversation

@samlown

@samlown samlown commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Updates the lookup to the GOBL Net changes in invopop/gobl#1036: the lookup registers only verified parties, binds registrations to the subject's key, and keeps each address's key lineage (spec §7.3). It is the public index of verified GOBL Net parties.

  • Verified parties only. A registration needs a countersignature from an accepted verifier with aud = subject and a cnf in the lineage. Without one the request is rejected with 403, or 503 when the verifier's key can't be fetched. The gobl.lookup verify command is removed; a subject registers again instead.
  • Registration is a normal delivery. The subject sends its party envelope from its address to the lookup, signed for the lookup, with no request token. The lookup drops that request signature, countersigns with cnf binding the subject's key and naming the verifier, and addresses the envelope back to the subject.
  • Key lineage. Registration.Lineage stores each key bound, by RFC 7638 thumbprint and kid, in order. A request is handled by which keys signed it within the last 5 minutes; older signatures don't count, so an earlier request can't be replayed (401 when none is fresh):
    • the current key: a renewal;
    • the current key, naming a new key with cnf, and that new key (goblnet.SignKeyChange): a key change, and the new key is bound without a new verification;
    • one key not in the lineage: a first registration, lost key or new domain owner, so a new lineage starts and needs a verification for that key;
    • anything else is rejected, including two keys at a first registration and an earlier key, alone or in a key change. An earlier key alone used to start a new lineage, which the original verification still covered.
  • No inherited verifications. A new holder of a lapsed domain can't inherit the old holder's verification. When an envelope carries verifications for both an old and a new key, the one in the lineage is used.
  • No forwarding. Verifiers no longer deliver results to the lookup on a subject's behalf: they return them to the subject, who registers with them. The old "unchanged digest keeps the verifier" renewal rule is replaced by the lineage check.
  • /parties listing. Every registered party has a public record with its address, verifier and registration dates. Its name and tax ID are added only when the registration request sets header meta lookup-listing: public (private removes them; new registrations start private). The full envelope is no longer served there.
  • /who. The lookup's response is addressed and signed for each requester.
  • Deliveries. Outgoing deliveries carry no request token, follow no redirects, and refuse every address that is not globally reachable, matching gobl/net.
  • gobl is pinned to the #1036 branch commit and should be bumped to a release once that PR is merged.

Existing records have no lineage, so those subjects must register once more, with a verification.

Testing

go test -race ./... and golangci-lint pass. web_test.go is rewritten for the new flow and covers:

  • each lineage case above, including a new key needing a new verification;
  • a replayed old signature plus a new key, a stale request, a key change the current key doesn't name, two keys at a first registration, and a retired key taking the address back, all rejected;
  • rejected registrations without a verification, and 503 when the verifier's key is unreachable;
  • ignored verifications: another key, no cnf, another address, forged;
  • renewals of the delivered envelope;
  • other rejected requests;
  • listing: public, kept on renewal, made private, other meta kept, unknown values rejected;
  • who signing.

identity_test.go checks the lookup refuses to countersign without a verifier.

🤖 Generated with Claude Code

samlown and others added 2 commits November 13, 2026 22:48
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings November 13, 2026 22:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Approval is blocked by unresolved moderate and critical findings that permit lineage rollback, mismatched party registration, and cross-request caching of caller-specific responses.

3 open issues
What changed in this PR

Updates registration and verification flows to align with the key-bound GOBL Net protocol, including subject key lineage, addressed signatures, requester-bound responses, and tokenless inbox deliveries.

Changes:

  • Reworks registration, renewal, rotation, and verification around subject-bound keys and lineage.
  • Makes /who responses requester-specific and removes request tokens from outbound deliveries.
  • Updates tests, documentation, setup wiring, and pinned dependencies.
File Description
README.md Documents the revised signed-registration, key-lineage, verification, and delivery flows.
internal/​interfaces/​web/​who.go Returns identity envelopes addressed and signed for the authenticated requester.
internal/​interfaces/​web/​web.go Removes bearer-token authentication from inbox deliveries.
internal/​interfaces/​web/​web_test.go Rewrites integration coverage for delivery authentication, lineage, verification, and requester-bound responses.
internal/​interfaces/​web/​inbox.go Routes signature-authenticated inbox deliveries to registration handling.
internal/​domain/​registrations.go Implements signed delivery verification, lineage updates, verifier binding, countersigning, and renewal handling.
internal/​domain/​models/​registration.go Persists subject key lineage records and exposes the current bound key.
internal/​domain/​lineage.go Adds key-lineage transition logic for registrations, renewals, rotations, and resets.
internal/​domain/​identity.go Generates requester-bound identity envelopes and subject-key-bound authority signatures.
internal/​domain/​identity_test.go Tests requester-bound identity responses and key-bound countersignatures.
internal/​domain/​delivery/​delivery.go Removes request tokens from outbound inbox deliveries.
internal/​domain/​delivery/​delivery_test.go Updates delivery tests for tokenless requests.
go.sum Refreshes dependency checksums for the updated protocol dependencies.
go.mod Updates the GOBL and Go JOSE dependency versions.
cmd/​gobl.lookup/​setup.go Wires the tokenless delivery sender and updated GOBL client configuration.
CHANGELOG.md Records the updated registration, verification, endpoint, and delivery behavior.

Review effort: Lite

Comment thread internal/domain/registrations.go Resolved
Comment thread internal/domain/lineage.go Resolved
Comment thread internal/interfaces/web/who.go Resolved
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings November 13, 2026 23:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Two critical logic flaws remain: lineage validation can reappend an existing key and registrations can publish a party document whose declared address does not match the verified sender.

3 open issues

Review effort: Lite

Registrations need a verifier countersignature binding the subject's key;
without one the request is rejected with 403, or 503 when the verifier key
is unavailable. The verify command is removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings November 15, 2026 13:29
@samlown samlown changed the title Bind registrations to subject keys and keep key lineage Register only verified parties, bound to subject keys with key lineage Nov 15, 2026
A key bound before cannot become current again, and /who responses
vary by Authorization.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Approval is blocked by an unresolved critical lineage-validation flaw that can reintroduce an existing key and by contradictory Unreleased documentation that still describes the removed command.

4 open issues
1 previously missed issue

In code that hasn't changed since last review

High severity Reject renewal keys already present in the lineage

internal/​domain/​lineage.go:48

This branch only checks that one of the two signatures is the current key, so it also accepts a current-plus-previous pair and appends the previous key as the new current key. For lineage [A, B], a request signed by [A, B] produces [A, B, A]; the old key can then renew alone and the Authority binds it again. Reject the second key whenever its JKT is already present in the lineage so only an unseen key can be appended.

Review effort: Lite

Comment thread CHANGELOG.md Resolved
Copilot AI lite review requested due to automatic review settings November 15, 2026 13:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Approval is blocked by a critical identity-validation flaw that can publish a verifier-signed party for the wrong sender, along with contradictory superseded Unreleased changelog entries.

2 open issues
2 resolved since last review

Review effort: Lite

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings November 15, 2026 13:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Human assessment is needed because the registration flow may accept an unendorsed sender identity, creating a moderate verification gap.

2 open issues

Review effort: Lite

/parties returns the address, verifier and registration dates of every
registered party, adding its name and tax ID when the registration
request sets header meta lookup-listing: public.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings November 15, 2026 17:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

CHANGELOG.md still contains obsolete Unreleased bullets that contradict the removed flow and could mislead operators about verification and bearer-token behavior, so those entries should be corrected or removed.

2 open issues

Review effort: Lite

Entries shipped in v0.1.0, v0.2.0 and v0.4.0 move under those releases,
leaving only this branch's changes as unreleased.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings November 15, 2026 22:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Human review is needed because the changes contain a critical network-safety gap and a moderate error-path inconsistency that could permit unsafe dialing and misclassify unavailable verifier keys.

No open issues 🎉

2 resolved since last review

Review effort: Lite

Registration requests count only confirming signatures made within the
last 5 minutes, and a key change needs the current key's signature to
name the new key with cnf, so a replayed request cannot move a lineage
to another key. Deliveries follow no redirects and refuse every address
that is not globally reachable. Uses gobl from invopop/gobl#1036.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings November 15, 2026 22:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The registration freshness check accepts timestamps arbitrarily far in the future, allowing signed requests to be replayed beyond the intended five-minute window until an upper-bound check is added.

1 open issue

Review effort: Lite

Comment on lines +463 to +469
oldest := now.Add(-goblnet.MaxRequestAge - requestClockSkew)
var out []*goblnet.ConfirmingSignature
for _, c := range confs {
if !c.IssuedAt.Before(oldest) {
out = append(out, c)
}
}
A first registration takes one key, and a key bound before can no longer
start a lineage again, which let a retired key take an address back while
the original verification still bound it. Tests sign key changes with
goblnet.SignKeyChange. Uses gobl from invopop/gobl#1036.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings November 15, 2026 23:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

A moderate security issue remains because future-dated request signatures bypass the intended five-minute replay window and must be bounded by the allowed clock skew.

1 open issue

Review effort: Lite

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings November 19, 2026 14:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Human assessment is needed because the change may accept malformed key rotations and allow registration of an unverified identity, creating significant lineage and authorization risks.

1 open issue

Review effort: Lite

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.

2 participants