Repository navigation
Validate untrusted DpfKey fields and fix DPF value type helpers. - #242
Merged
Merged
Conversation
copybara-service
Bot
force-pushed
the
test_1013666045
branch
from
November 4, 2026 14:04
5664371 to
1649ff6
Compare
copybara-service
Bot
force-pushed
the
test_1013666045
branch
4 times, most recently
from
November 6, 2026 08:33
9adc13b to
526e32f
Compare
ProtoValidator::ValidateDpfKey checked the structure of a DpfKey but not its contents: it accepted party values other than 0 and 1, which evaluation inconsistently treats as party 1 for control bits and as party 0 for output negation, and it did not check that value corrections are valid elements of the level's value type. Uint128To<T> only range-checked the low 64 bits, so a 128-bit proto integer with non-zero high bits was silently truncated when converted to a narrower type. BitsNeeded indexed the first num_other tuple elements instead of the non-IntModN ones, so a tuple listing IntModN elements first was sized from the wrong element types. A malformed key, which only affects the submitting client's own evaluation, was evaluated into meaningless output shares instead of being rejected, and the same correction could be encoded in several ways; these are robustness and canonical-encoding fixes, not a privacy fix. The BitsNeeded fix changes PRG output sizing, and therefore generated keys, only for tuples in which IntModN elements precede other elements. No production value type is affected: the Privacy Sandbox ReachTuple types are all-integer or all-IntModN. Reject keys whose party is not 0 or 1 or whose value corrections fail ValidateValue, reject non-zero high 64 bits in Uint128To<T>, and skip IntModN elements when sizing the remaining tuple elements. A stale 34-bit value for a 32-bit type in the validator's test key is corrected. Tests cover invalid parties at validation and evaluation time, oversized and high-bit corrections, high-bit conversion for every integer width, and order-independent BitsNeeded for mixed tuples. PiperOrigin-RevId: 1015333534
copybara-service
Bot
force-pushed
the
test_1013666045
branch
from
November 6, 2026 08:37
526e32f to
f9aaca0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Validate untrusted DpfKey fields and fix DPF value type helpers.
ProtoValidator::ValidateDpfKey checked the structure of a DpfKey but not its
contents: it accepted party values other than 0 and 1, which evaluation
inconsistently treats as party 1 for control bits and as party 0 for output
negation, and it did not check that value corrections are valid elements of
the level's value type. Uint128To only range-checked the low 64 bits, so a
128-bit proto integer with non-zero high bits was silently truncated when
converted to a narrower type. BitsNeeded indexed the first num_other tuple
elements instead of the non-IntModN ones, so a tuple listing IntModN elements
first was sized from the wrong element types.
A malformed key, which only affects the submitting client's own evaluation,
was evaluated into meaningless output shares instead of being rejected, and
the same correction could be encoded in several ways; these are robustness
and canonical-encoding fixes, not a privacy fix. The BitsNeeded fix changes
PRG output sizing, and therefore generated keys, only for tuples in which
IntModN elements precede other elements. No production value type is
affected: the Privacy Sandbox ReachTuple types are all-integer or all-IntModN.
Reject keys whose party is not 0 or 1 or whose value corrections fail
ValidateValue, reject non-zero high 64 bits in Uint128To, and skip IntModN
elements when sizing the remaining tuple elements. A stale 34-bit value for a
32-bit type in the validator's test key is corrected. Tests cover invalid
parties at validation and evaluation time, oversized and high-bit
corrections, high-bit conversion for every integer width, and order-independent
BitsNeeded for mixed tuples.