Skip to content

Conversation

@henriquemoody
Copy link
Member

The DeclaredHandler has become a liability. Because class, interface, and enum names are represented as strings, we run the risk of the library "helpfully" identifying a piece of user input as an internal system part.

If a user happens to input a string that matches an internal class or enum name, the stringifier would automatically confirm its existence by applying the specialized formatting. This creates an information leakage vulnerability where an outsider could map out our application's internal architecture simply by guessing names.

By removing this handler, we ensure that a string is treated just as a string. This follows our recent "secure-by-default" trend seen in the CallableStringifier changes: we are prioritizing the privacy of the application's internal blueprint over the convenience of automatic type detection.

The `DeclaredHandler` has become a liability. Because class, interface, and enum
names are represented as strings, we run the risk of the library "helpfully"
identifying a piece of user input as an internal system part.

If a user happens to input a string that matches an internal class or enum name,
the stringifier would automatically confirm its existence by applying the
specialized formatting. This creates an information leakage vulnerability where
an outsider could map out our application's internal architecture simply by
guessing names.

By removing this handler, we ensure that a string is treated just as a string.
This follows our recent "secure-by-default" trend seen in the
`CallableStringifier` changes: we are prioritizing the privacy of the
application's internal blueprint over the convenience of automatic type
detection.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request removes the DeclaredHandler to address a security vulnerability where user-supplied strings matching internal class, interface, trait, or enum names could be automatically detected and specially formatted, potentially leaking information about the application's internal architecture.

Changes:

  • Removed DeclaredHandler class and all its references
  • Updated documentation to remove examples of class name stringification
  • Removed all associated tests for the removed functionality

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Handlers/DeclaredHandler.php Complete removal of the handler that detected and formatted declared type names from strings
src/Handlers/CompositeHandler.php Removed DeclaredHandler from the handler chain in the create() method
tests/unit/Handlers/DeclaredHandlerTest.php Removed unit tests for the deleted handler
tests/integration/stringify-declared.phpt Removed integration test demonstrating class name stringification
README.md Removed documentation examples showing class name and enum stringification as strings

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@henriquemoody henriquemoody merged commit a38facd into Respect:main Jan 19, 2026
11 checks passed
@henriquemoody henriquemoody deleted the declared branch January 19, 2026 09:12
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.

1 participant