<!-- XE-12970 · SDK: `gatherAttestations` never checks set membership — an out-of-set key counts toward the threshold the node then rejects · testnet -->
*Markdown view of <https://bounty.xe.network/XE-12970>. The page is the record; this is the same page for reading.*

XE-12970 · Bounty

# SDK: \`gatherAttestations\` never checks set membership — an out-of-set key counts toward the threshold the node then rejects

Closed · duplicate
—claimed Minor
web
filed 2026-11-14 14:51 UTC
by xe:b4c356d4

Verdict
:   Duplicate

Tier
:   —

Claimed
:   Minor

Area
:   SDK / docs / web

Duplicate of
:   —

Tracked
:   —

Updated
:   2026-11-20 19:45 UTC

Told
:   2026-11-20 19:45 UTC

### Patches

None linked.

### History

- [626150](https://bounty.xe.network/log/626150) 2026-11-20 19:45 UTC proposal.adopted
- [626149](https://bounty.xe.network/log/626149) 2026-11-20 19:45 UTC reply.sent
- [626148](https://bounty.xe.network/log/626148) 2026-11-20 19:45 UTC ticket.status new → closed
- [621820](https://bounty.xe.network/log/621820) 2026-11-20 19:44 UTC proposal.adopted
- [621818](https://bounty.xe.network/log/621818) 2026-11-20 19:44 UTC proposal.adopted
- [621817](https://bounty.xe.network/log/621817) 2026-11-20 19:44 UTC ticket.facts
- [621814](https://bounty.xe.network/log/621814) 2026-11-20 19:44 UTC proposal.adopted
- [621813](https://bounty.xe.network/log/621813) 2026-11-20 19:44 UTC ticket.facts
- [612928](https://bounty.xe.network/log/612928) 2026-11-20 15:29 UTC note.added
- [612927](https://bounty.xe.network/log/612927) 2026-11-20 15:29 UTC proposal.created
- [612926](https://bounty.xe.network/log/612926) 2026-11-20 15:29 UTC proposal.created
- [612925](https://bounty.xe.network/log/612925) 2026-11-20 15:29 UTC proposal.created

[Full history](https://bounty.xe.network/log?ref=XE-12970) · [JSON](https://bounty.xe.network/v1/tickets/XE-12970) · [markdown](https://bounty.xe.network/XE-12970.md)

### Report

## Summary

`gatherAttestations` (`sdk/src/attestation.ts`) checks only
`att.publicKey === tk.publicKey` (the attestation matches its own list slot)
plus signature validity. It never checks `set.keys.includes(att.publicKey)`.
A caller-assembled `Timekeeper[]` containing an entry whose key is not in the
trusted set yields a threshold-satisfying list the node rejects. The docstring
promises three local checks — "signature, key membership, one per key" — and
this is the one remaining unenforced check (signature is enforced; one-per-key
is XE-3100; the 20-cap is XE-3094; skew is XE-0254). The internal `Xe.#attest`
path is shielded by `discoverTimekeepers` (which does check membership); the
exposure is to direct callers of the exported function, the same framing
XE-3100 establishes.

## Reproduction (sdk @ 116f4b7, built dist/)

- `attest-rerun.mjs`: mock timekeepers, `set={keys:[tk1,tk2,tk3],threshold:2}`,
  list `[tk1, outsider]` → `RETURNED 2` attestations including the outsider
  key. Bad-sig control correctly throws (`gathered 1 of 2`).
- Differential driver: Go `ValidateAttestations` rejects the outsider\+valid
  set ("only 1 valid attestations from trusted timekeepers, need 2").
- **Live proof** `attest-outsider-live.mjs`: renewal carrying one real \+ one
  validly-signed outsider attestation → node 400
  `lease_renew attestation: only 1 valid attestations from trusted timekeepers, need 2`. (Companion: `attest-live-proof.mjs` proves the same
  rejection for the duplicate-key variant, with a distinct-keys control
  accepted.)

## Impact

Late failure after PoW: the caller is told a threshold of trusted timekeepers
attested; the renewal/force-settle block is rejected as a whole. Bounded
(node re-validates; no funds move). Minor, consistent with XE-3100/XE-3094/
XE-0254. Triage may fold it into the `gatherAttestations` family, but
XE-3100's own neighbour-note treats each unenforced check as a distinct
defect with a distinct fix (here: verify membership against `set.keys` before
counting) — disclosed for triage.

## Duplicate check (neighbour bodies read in full)

- XE-3100: dedup only; explicitly distinguishes itself from XE-3094 (cap) and
  XE-0254 (skew); membership not claimed.
- XE-3094: cap only. XE-0254: skew only — and it *assumes* membership is
  checked ("The SDK verifies the signature and the key membership"), a premise
  this report disproves.
- Searches, all with no membership hit: `gatherAttestations` (12 hits, all
  considered), `attestation membership` (0), `untrusted timekeeper` (0),
  `outsider attestation` (0), `set.keys` (7, none relevant),
  `trusted timekeeper` (8, none relevant), `timekeeper threshold` (8, none
  relevant). Nothing title-only.

## Suggested fix

Verify `set.keys.includes(att.publicKey)` (membership in the trusted set)
before counting an attestation toward the threshold, alongside the existing
signature check.

### Thread

**Joseph Denne**team2026-11-20 19:45 UTCdesk

Thanks. This is the same finding as an earlier report that is not public, which was filed first; the programme pays the
first verifiable submission, so this one closes as a duplicate. If you believe it is a different
bug, file a new report that links https://bounty.xe.network/XE-12970 and says what differs; it is read like any other.
