Skip to content

Reject empty or oversized RP IDs in the setMinPINLength parameters - #807

Merged
kaczmarczyck merged 1 commit into
google:developfrom
17krishna8:fix/reject-long-min-pin-rp-ids
Oct 20, 2026
Merged

kaczmarczyck merged 1 commit into
google:developfrom
17krishna8:fix/reject-long-min-pin-rp-ids

Conversation

@17krishna8

Copy link
Copy Markdown
Contributor

The minPinLengthRPIDs entries are defined as fully qualified domain names, which RFC 1035 limits to 253 bytes in presentation format.

Longer strings are currently accepted while parsing and only rejected later, when storing the list fails because the serialized value exceeds the maximum value size of the persistent store, after the token permissions were already checked.

Reject such entries when parsing the parameters, so the request fails with CTAP1_ERR_INVALID_PARAMETER before anything else runs.

@google-cla

google-cla Bot commented Oct 16, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a maximum length validation of 253 bytes for RP IDs within SetMinPinLengthParams to prevent storing excessively large serialized values, accompanied by new unit tests. Feedback suggests optimizing this validation by performing the length check inside the mapping closure during parsing, which avoids unnecessary heap allocations and improves efficiency in memory-constrained environments.

Comment thread libraries/opensk/src/ctap/data_formats.rs Outdated
@kaczmarczyck kaczmarczyck self-assigned this Oct 16, 2026
@17krishna8
17krishna8 force-pushed the fix/reject-long-min-pin-rp-ids branch 2 times, most recently from 08c7cbf to e5cbbda Compare October 17, 2026 04:56
@17krishna8

Copy link
Copy Markdown
Contributor Author

The length check moved into the mapping closure: the request now fails with CTAP1_ERR_INVALID_PARAMETER as soon as an oversized entry is parsed, before the rest of the list is allocated.

kaczmarczyck
kaczmarczyck previously approved these changes Oct 19, 2026
@kaczmarczyck

Copy link
Copy Markdown
Collaborator

This is somewhat inconsistent with #805. There we introduce MAX_RP_ID_LENGTH instead of MAX_MIN_PIN_LENGTH_RP_ID_LENGTH with the same value. Also the other PR checks for empty sttrings, this one doesn't.

I think the changes here generally make sense. We might want to merge them into #805. Or we merge that, and then import and reuse the constant.

@coveralls

coveralls commented Oct 19, 2026 •

Copy link
Copy Markdown

Coverage Status

Coverage is 97.37% — 17krishna8:fix/reject-long-min-pin-rp-ids into google:develop. No base build found for google:develop.

@17krishna8
17krishna8 force-pushed the fix/reject-long-min-pin-rp-ids branch from e5cbbda to d6ad057 Compare October 20, 2026 13:34
@17krishna8 17krishna8 changed the title Reject oversized RP IDs in the setMinPINLength parameters Reject empty or oversized RP IDs in the setMinPINLength parameters Oct 20, 2026
@17krishna8

Copy link
Copy Markdown
Contributor Author

Thanks for the review! I aligned this PR with #805:

  • The constant is now named MAX_RP_ID_LENGTH with the same value and doc comment.
  • Empty entries are rejected as well, with a matching test.

Happy to fold these changes into #805 if that is easier for you. Otherwise, once #805 lands I will rebase this PR and import the constant from there instead of redefining it.

@17krishna8
17krishna8 force-pushed the fix/reject-long-min-pin-rp-ids branch from d6ad057 to f1f9182 Compare October 20, 2026 13:36
The minPinLengthRPIDs entries are defined as fully qualified domain
names, which RFC 1035 limits to 253 bytes in presentation format.

Empty or longer strings are currently accepted while parsing and only
rejected later, when storing the list fails because the serialized value
exceeds the maximum value size of the persistent store, after the token
permissions were already checked.

Reject such entries while parsing, matching the checks that
MakeCredential performs on its RP ID.
@kaczmarczyck
kaczmarczyck force-pushed the fix/reject-long-min-pin-rp-ids branch from f1f9182 to 2d4d728 Compare October 20, 2026 20:46
@kaczmarczyck
kaczmarczyck merged commit 309cd3f into google:develop Oct 20, 2026
13 checks passed
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.

3 participants