Repository navigation
fix: honor include_request: false in all errors - #1729
Merged
olleolleolle merged 1 commit intoOct 26, 2026
Merged
Conversation
The option was only read by RaiseError#response_values, so a
ParsingError raised by the Json middleware still carried the full
request Env, leaking credentials such as Authorization headers to
error trackers.
RaiseError now marks the shared Env in on_request, and Error replaces
a flagged Response or Env with a request-less {status, headers, body}
hash, the same shape 4xx/5xx errors already use under the option.
olleolleolle
approved these changes
Oct 26, 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.
Description
response :raise_error, include_request: falseonly stripped request data from the exceptions thatRaiseErrorraises itself. When a 200 response fails to parse, thejsonmiddleware raisesFaraday::ParsingErrorinitialized with the liveFaraday::Response, whoseenvstill exposesrequest_headersandrequest_body:Applications forwarding such an exception (e.g. as a
cause) to error trackers can leak credentials such as OAuth bearer tokens. This behavior has existed since the option was introduced in #1526.With this change,
RaiseErrormarks the opt-out on the requestEnvfromon_request, andFaraday::Errorreplaces a flaggedFaraday::Response(or flaggedFaraday::Env) with a request-less{ status:, headers:, body: }hash — the same shape#response_valuesalready produces for 4xx/5xx errors underinclude_request: false. The option now applies consistently to errors raised by other middlewares, while the default (include_request: true) is unchanged.Todos
Additional Notes
Envmember (env[:include_request]), the same mechanism thejsonmiddleware uses forraw_body, so no publicEnvAPI changes.include_request: falseonly:ParsingError#responseis now a Hash without request data instead of aFaraday::Responsecarrying it, matching the Hash shape 4xx/5xx errors already use under the same option. Default mode is unchanged.