Add request body redaction and size limits#21
Open
craigpotter wants to merge 1 commit into
Open
Conversation
Request bodies were always stored in full with no redaction or size cap, unlike responses. Adds excluded_request_body (mirroring excluded_response_body: '*', connector or request classes -> REDACTED) and max_request_size (kilobytes, byte-measured, default 100; oversized bodies stored as a placeholder). Bodies are now always persisted as strings, with a JSON fallback for custom non-Stringable repositories.
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.
Overview of change
Closes the request/response asymmetry from the review pass: responses have
excluded_response_bodyandmax_response_size, but request bodies were always stored in full — login payloads, personal data, large uploads and all.excluded_request_body— mirrorsexcluded_response_body:'*', connector classes, or request classes; matching bodies are stored asREDACTED. Empty by default (no behaviour change).max_request_size— mirrorsmax_response_size: kilobytes, measured in bytes, default 100. Oversized bodies are stored as<Unsupported Barstool Request Content>.Stringable; custom repositories that are not fall back tojson_encode($body->all())(previously a non-Stringable repository would have crashed the PDO insert).README updated with matching sections; new
JsonPostRequesttest fixture.Testing
Six new tests: JSON body stored as string, redaction via
'*'/connector/request class, byte-measured size cap with a multibyte body, and null body passthrough. Full suite: 53 passed (191 assertions), PHPStan level 8 clean, Pint clean.