Skip to content

Add Psalm taint analysis annotations - #635

Open
danog wants to merge 1 commit into
Webklex:masterfrom
danog:psalm-taint-annotations
Open

danog wants to merge 1 commit into
Webklex:masterfrom
danog:psalm-taint-annotations

Conversation

@danog

@danog danog commented Oct 23, 2026

Copy link
Copy Markdown

Adds Psalm taint analysis annotations, so that Psalm follows untrusted data through php-imap in the projects that use it:

  • The headers and bodies of received emails (Message getters, Attribute values) are untrusted input, as their sender chose them.

Attachment::getContent() and getName() are also input, but they are @method magic methods, which Psalm can't annotate with taints, so they are left to Psalm's stub.

These are docblock-only changes, with no effect at runtime or on other tools. Psalm currently ships them as a stub for this library (vimeo/psalm#12467); having them here keeps them in step with the code.

Psalm's taint analysis can only follow untrusted data through this library if its docblocks say which
parameters are sinks and which return values are sources. These annotations are docblock-only and have no
effect at runtime.
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