Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(iri): Add control character validation to IRI class #2

Merged

Conversation

bivens-dev
Copy link
Owner

Implements the _isValidControlCharacters function to validate that IRI strings do not contain control characters (U+0000-U+001F, U+007F, U+0080-U+009F) outside of valid percent-encoded sequences, as required by RFC 3987.

  • Checks for control characters in the specified ranges.
  • Throws InvalidIRIException if invalid control characters are found.
  • Ignores control characters within valid percent-encoded sequences.
  • Does not reject TAB, CR and LF.
  • Adds comprehensive tests to verify the behavior for valid and invalid cases, including characters inside percent-encoded sequences and TAB, CR and LF.

This change enhances the robustness of the IRI class by ensuring that it correctly handles control characters according to the specification.

Fixes: #1

Implements the `_isValidControlCharacters` function to validate that
IRI strings do not contain control characters (U+0000-U+001F, U+007F,
U+0080-U+009F) outside of valid percent-encoded sequences, as required by
RFC 3987.

- Checks for control characters in the specified ranges.
- Throws InvalidIRIException if invalid control characters are found.
- Ignores control characters within valid percent-encoded sequences.
- Does not reject TAB, CR and LF.
- Adds comprehensive tests to verify the behavior for valid and
  invalid cases, including characters inside percent-encoded sequences
  and TAB, CR and LF.

This change enhances the robustness of the IRI class by ensuring that
it correctly handles control characters according to the specification.

Fixes: #1
@bivens-dev bivens-dev linked an issue Mar 13, 2025 that may be closed by this pull request
@bivens-dev bivens-dev merged commit 5b1afcc into main Mar 13, 2025
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.

Implement Control Character Validation in IRI Class
1 participant