Repository navigation
Add library stubs for the taints of amphp/http-client, byte-stream, file and process, and amp's delay() - #12482
Merged
Merged
Conversation
…in their library stubs
…ile and process, and amp's delay()
This was referenced Oct 23, 2026
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.
Library stubs (
stubs/libraries/amphp/*.phpstub) for the amphp packages:Request(constructor andsetUri()) is an SSRF sink, the pathForm::addFile()uploads a file sink; the headers (getHeaders(),getHeaderArray(),getHeader()) and the body (getBody()) of aResponseareinputsources.Payload::read(),buffer()and__toString()return what the payload holds (@psalm-flow ($this) -> return), so the body of a response taints what is read from it.openFile(),read(),write(),deleteFile(),move(),createSymlink(), ...) are file sinks.Process::start()runs is a shell sink.delay()does I/O (@psalm-capabilities io), asusleep()does: it suspends the fiber and runs the event loop meanwhile.The response sources are declared on
Amp\Http\Client\Responseitself rather than on the amphp/httpHttpMessageit inherits the header methods from, or on byte-stream'sPayload: those also hold the messages and streams the code builds itself, which would all become sources. A payload is only tainted when it comes from a source, such asResponse::getBody().The amp and file stubs declare functions only, so they need #12481 to be loaded; this PR is stacked on it and on #12480 (for
LibraryStubsTestCase::getReportedIssueTypePrefixes(), used by thedelay()case).Tests:
AmphpHttpClientLibraryStubsTest(http-client, byte-stream, process) andAmphpLibraryStubsTest(amp, file). They are two classes because the declarations of the functions must not share a file with classes the stubs extend: a stub's parent queues its file again, which then redeclares the functions over the stub's.Inline PRs for the libraries: amphp/http-client#402 and amphp/http-client#403, amphp/byte-stream#118, amphp/file#102, amphp/process#87.