Skip to content

Mark the body of a response as a Psalm taint source - #403

Merged
kelunik merged 1 commit into
amphp:5.xfrom
danog:psalm-response-sources
Oct 25, 2026
Merged

kelunik merged 1 commit into
amphp:5.xfrom
danog:psalm-response-sources

Conversation

@danog

@danog danog commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Marks Response::getBody() as a Psalm taint source (@psalm-taint-source input): what another server sends back is untrusted. With amphp/byte-stream#118 (Payload's methods return what the payload holds), what the code reads from the body is tainted too, so Psalm follows it into the sinks it reaches.

Docblock only, no change at runtime. Psalm ships the same source in its stub for this library (vimeo/psalm#12482), which also declares the response's headers (getHeaders(), getHeaderArray(), getHeader()) as sources; those methods are inherited from amphp/http's HttpMessage, which also holds the requests the code builds, so they can't be annotated here without overriding them. The sinks of Request and Form are in #402.

@kelunik
kelunik merged commit e0d374e into amphp:5.x Oct 25, 2026
0 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants