Skip to content

fix(id): cap didit entity aliases and hours spans at 512 (#5991) - #6030

Merged
dezren39 merged 1 commit into
mainfrom
queue/9865-5991-didit-caps
Nov 5, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/9865-5991-didit-caps

Conversation

@dezren39

@dezren39 dezren39 commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Fixes #5991. Queue task 9865.

What

Entity::check capped no alias count and ActiveWindow::check (Hours arm) capped no hours-span count, while the didit CBOR decoder refuses arrays over its 8192-element limit — so a body with 8193 aliases or hours spans encoded successfully and then failed to decode (triage evidence in task 9861 / issue #5991, confirmed at main ec2ac0e).

  • pkgs/id/src/didit/body.rs: named caps MAX_ALIASES = 512 and MAX_HOURS_SPANS = 512 (mirroring MAX_SUBJECTS/MAX_DETAILS, well under the decoder limit). Entity::check and the Hours arm of ActiveWindow::check now refuse over-cap collections with DiditError::Invalid errors naming the count and the limit, in the check_subjects shape.
  • No change to the decoder LENGTH_LIMIT, MAX_SUBJECTS/MAX_DETAILS, or the 1 MiB body cap.

Tests (oracle: the named caps)

New boundary tests in pkgs/id/src/didit/tests.rs name the caps as their oracle:

  • entity_alias_count_is_capped: exactly 512 aliases encode + round-trip; 513 is refused by encode_entity_body with an error naming 513 and 512.
  • hours_span_count_is_capped: exactly 512 hours spans encode + round-trip; 513 is refused by encode_expectation_body the same way.

Verified on the laptop worktree: cargo test --lib didit in pkgs/id — 27 passed, 0 failed (all pre-existing didit tests stay green). cargo fmt --check diffs in this package are pre-existing (waiting.rs, earlier tests.rs hunks) and untouched by this PR.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Entity::check capped no alias count and ActiveWindow::check (Hours arm) capped no hours-span count, while the CBOR decoder refuses arrays over 8192 elements — an over-limit body encoded fine and then failed to decode. Add named MAX_ALIASES and MAX_HOURS_SPANS caps (512, mirroring MAX_SUBJECTS/MAX_DETAILS) with DiditError::Invalid errors naming the count and the limit, plus boundary tests pinning at-cap round-trips and over-cap refusal for both collections. Queue task 9865.
@dezren39
dezren39 requested a review from a team as a code owner November 5, 2026 05:21
@coderabbitai

coderabbitai Bot commented Nov 5, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 15 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 262327d2-6871-4173-9fcc-957fe4c05dbc
Commits

Reviewing files that changed from the base of the PR and between ec2ac0e and b9d39cd.

Files selected for processing: 2

  • pkgs/id/src/didit/body.rs
  • pkgs/id/src/didit/tests.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T05:23:27.076986Z b9d39cd PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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.

id(didit): entity aliases and expectation hours spans have no count cap — the encoder produces bodies the decoder's 8192-element limit refuses

1 participant