Skip to content

id: verify the ingest funnel and key custody end to end (#6379 F3+F4) #13531

Open

Description

@dezren39

Stage-2 verification packet for #6379 (findings F3 + F4 from the stage-1 audit, task 14441; routed by the 2026-11-17 triage, task 18481). Verification only — any bypass or custody defect found is filed separately and treated as fail-closed until fixed; do not fix in this packet.

F3 — the fold trusts ingested events; verify the funnel is total

pkgs/id/crates/id-events/src/groups/* contains no signature verification; authenticity rests entirely on every write path funnelling through event-store ingest (pkgs/id/crates/id-events/src/event_store/ingest.rs, verify_strict; bytes that do not verify are refused and change nothing).

Trace end to end, per path, whether any route writes the group log bypassing ingest verification:

  • local CLI writes (id-cli commands),
  • sync ingest (event_store/sync.rs),
  • hosted ingest (pkgs/id/src/hosted_ingest.rs and the hosted bridge surface),
  • relay/envelope delivery paths.

Acceptance: a per-path verdict recorded on this issue (funnels through ingest / bypasses — with the bypass's code path named). A confirmed bypass is a separate security issue, filed in the same pass.

F4 — key custody at the account boundary

The CLI identity is the local keypair file (load_or_create_keypair, now in pkgs/id/crates/id-store/src/store.rs; creation goes through write_private_file + restrict_key_permissions — verify the actual mode applied, on create and on load of a pre-existing loose file, incl. non-Unix behaviour). Also check the hosted/serve path's key handling (which key signs hosted actions, where it lives, what mode).

Acceptance: recorded verdict per surface (CLI create, CLI load-existing, hosted/serve) with the observed file mode or custody fact for each.

Activity

  1. developing-today commented on Nov 23, 2026

    @developing-today
    Contributor
  2. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Filed by lane felix (2026-11-23) as a stage-2 packet of #6379, without a pilot packet: Felix's lane queue is operator-managed via the prioritized shortlist (the #13342 pattern), so follow-ups are picked up from the shortlist in order rather than enqueued separately. The parent record is #6379; the design core is PR #13535.

  3. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Verification verdict (lane code-g, queue task 21477, 2026-11-23, main at 8baa8b4dda5)

    Verification only; nothing fixed in this packet. Paths read by trace and grep, not by running the suite.

    F3: write paths to the group log

    Group log = pkgs/id/crates/id-groups/src/groups/log.rs (the issue's groups/* path moved here). Its module doc says "Events are not signed here … Signature checks belong to the event store." Writers:

    Path Writes group log? Verdict
    Local CLI (id-cli/src/commands/group.rs:277, 496, 530) yes via GroupLog::record(author, …) Local trusted writes. The author key is a caller-supplied field, unsigned. Not reachable from a peer.
    Sync ingest (id-events/src/event_store/sync.rs) no GroupLog reference Funnels through EventStore::ingest (ingest.rs step 1, chain::decode → AnyHeader::decode → verify_strict). Verified.
    Hosted ingest (pkgs/id/src/hosted_ingest.rs:182) no GroupLog reference; calls store.ingest Funnels through event-store ingest after verify_import. Verified.
    Relay / envelope / gossip (id-cli/src/commands/serve/gossip.rs) read only (GroupLog::open, fold); presence heartbeats verify()'d before any use No peer-supplied write to the group log.
    Server config seeding (id-cli/src/commands/serve/startup.rs:79-95) yes via GroupLog::record_preformed(event) for events provisioned by the operator's config Bypass by design: no signature check. Input is the operator's own config file on the serving host, not peer input. Not peer-reachable.

    Result: no peer or relay route writes the group log bypassing ingest. One local-trust bypass (startup seeding via record_preformed) is recorded. No security issue filed: nothing is peer-reachable. Limit: I did not trace every consumer of the group fold to prove none treats the group log as authenticated by a remote peer.

    F4: key custody

    Surface Observed Verdict
    CLI create (id-store/src/store.rs write_private_file_sync) temp file opened with create_new and mode(0o600), then published by hard_link Owner-only at creation on Unix. The umask can only clear bits, so the result is never wider than 0600.
    CLI load of existing file (restrict_key_permissions) if mode & 0o077 != 0, set_permissions(0o600); failure is only logged Tightened best-effort. The key is loaded even when the chmod fails, so a loose file that cannot be fixed stays readable and is still used. Fail-open, logged.
    Non-Unix (Windows) restrict_key_permissions is a no-op (let _ = path); write_private_file sets no mode No custody enforcement. Relies on the default ACL of the directory. Unverified.
    Hosted / serve (id-cli/src/commands/serve/*, hosted_ingest) serve reads the group log only; hosted import ingests verified events and does not load a signing key from disk in hosted_ingest.rs No separate hosted key-file surface found in this trace. The serving node's key is the same load_or_create_keypair path (id-native-shell, id-cli/src/commands/id.rs), so it inherits the Unix 0600 behaviour above.

    Existing tests that pin the Unix mode: store.rs:630-658 (0600 on create; 0600 after load of a loose file).

    Summary

    • F3: no peer-reachable bypass. One local-trust record_preformed seeding path, recorded above. No security issue filed.
    • F4: Unix create is 0600; loose-file tightening is best-effort and fail-open (logged). Non-Unix has no enforcement.

    Suggested follow-up, not filed here (it is hardening, not a confirmed bypass): make non-Unix custody explicit (ACL check or refuse-to-load) and make restrict_key_permissions failure fatal on Unix.

  4. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Lane code-g, queue task 21477: note on a claim collision — task 21477 was parked at 2026-11-23T21:08:05Z while my claimed run (claimed 2026-11-23T20:58:36Z) was in progress, so fleet queue complete was refused ("task … is parked"). The packet work itself is done and recorded in the verdict comment above (F3/F4 per-path verdicts, main 8baa8b4dda5; no peer-reachable bypass, no security issue filed). I hold no claim on 21477 now. If this task returns to the queue, the remaining step is only the queue-side completion with the recorded evidence; no further issue work is needed.

  5. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Supplemental verification (lane code-j, task 21477, 2026-11-23, main cc464cc8ea6) — independent spot-check of the code-g verdict above, same conclusion. Exact commands and counts:

    1. grep -rn "GroupLog::record\|record_preformed" --include="*.rs" pkgs/id/ → group-log writers are groups/log.rs itself (defs + unit tests) and id-cli/src/commands/serve/startup.rs:90 (record_preformed, operator config seeding). No other GroupLog::record/record_preformed call site.
    2. grep -n "GroupLog\|store.ingest|\.ingest(" …/event_store/sync.rs pkgs/id/src/hosted_ingest.rs → sync.rs has no GroupLog reference; funnels via ingest_with_bodies/ingest_events. hosted_ingest.rs:182 calls store.ingest. Both verified.
    3. grep -rn "\.record(\|record_preformed" --include="*.rs" pkgs/id/ (full sweep) → remaining hits are tracing spans, envelope_outbox delivery records, actions.rs local builders, and tests. serve.rs GroupLog uses (lines 2676+) sit inside mod tests (starts line 2458). id-web/src/groups.rs .record hits are inside #[cfg(test)]. gossip.rs verifies heartbeats (heartbeat.verify()) before use.
    4. grep -n "0o600\|restrict_key_permissions\|write_private_file" …/id-store/src/store.rs → create path mode(0o600) (line 185); restrict_key_permissions tightens loose files best-effort, fail-open with warn (lines 221–236); #[cfg(not(unix))] let _ = path (line 235–236, no enforcement). Tests pin 0600 at lines 640/658.

    Conclusion unchanged: no peer-reachable bypass of ingest verification; no security issue filed (criterion: file only a confirmed bypass — none found). F4 Unix posture confirmed as verdict states. Suggested hardening (explicit non-Unix custody, fatal chmod failure) remains unfiled follow-up material.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions