Http2Settings: validate non-standard setting values#13369
Merged
normanmaurer merged 1 commit intonetty:4.1from May 2, 2023
Merged
Http2Settings: validate non-standard setting values#13369normanmaurer merged 1 commit intonetty:4.1from
Http2Settings: validate non-standard setting values#13369normanmaurer merged 1 commit intonetty:4.1from
Conversation
Motivation: RFC9113 Section 6.5.1 defines settings value as unsigned 32-bit. We should validate that users don't pass a `long` value outside of this range. Modifications: - `Http2Settings` throws `IllegalArgumentException` if a non-standard setting has value outside unsigned 32-bit integer range; - `Http2Settings.verifyStandardSetting` always includes expected range when it throws `IllegalArgumentException`; - Enhance `Http2SettingsTest` to validate valid and invalid values for each setting; - `Http2Settings.keyToString` encodes non-standard settings as hex value; Result: Value range for non-standard settings is also validated. Exceptions always include expected range in the message.
idelpivnitskiy
commented
May 1, 2023
| default: | ||
| // Unknown keys. | ||
| return super.keyToString(key); | ||
| return "0x" + toHexString(key); |
Member
Author
There was a problem hiding this comment.
Lmk if you would like this as a separate PR for visibility in changelog
chrisvest
approved these changes
May 2, 2023
Member
|
@ejona86 can you have a look as well ? |
trustin
approved these changes
May 2, 2023
Member
trustin
left a comment
There was a problem hiding this comment.
Nice work! Thanks, @idelpivnitskiy 🙇
ejona86
approved these changes
May 2, 2023
normanmaurer
pushed a commit
that referenced
this pull request
May 2, 2023
Motivation: RFC9113 Section 6.5.1 defines settings value as unsigned 32-bit. We should validate that users don't pass a `long` value outside of this range. Modifications: - `Http2Settings` throws `IllegalArgumentException` if a non-standard setting has value outside unsigned 32-bit integer range; - `Http2Settings.verifyStandardSetting` always includes expected range when it throws `IllegalArgumentException`; - Enhance `Http2SettingsTest` to validate valid and invalid values for each setting; - `Http2Settings.keyToString` encodes non-standard settings as hex value; Result: Value range for non-standard settings is also validated. Exceptions always include expected range in the message.
This was referenced May 4, 2023
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.
Motivation:
RFC9113 Section 6.5.1 defines settings value as unsigned 32-bit. We should validate that users don't pass a
longvalue outside of this range.Modifications:
Http2SettingsthrowsIllegalArgumentExceptionif a non-standard setting has value outside unsigned 32-bit integer range;Http2Settings.verifyStandardSettingalways includes expected range when it throwsIllegalArgumentException;Http2SettingsTestto validate valid and invalid values for each setting;Http2Settings.keyToStringencodes non-standard settings as hex value;Result:
Value range for non-standard settings is also validated. Exceptions always include expected range in the message.