-
Notifications
You must be signed in to change notification settings - Fork 397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aiohttp stub records the full url in the recorded data regardless of parameter filtering #517
Comments
Just wanted to note here that this can be remedied "in the mean time" with something like this: def filter_response(response):
response["url"] = '' # hide the URL
return response ..., and then making your own VCR instance, passing |
Here's a more elaborate implementation I've been using that does the actual Haven't tried just emptying the whole URL myself, nice if that works, but this one FTR in case someone finds a problem with the emptying approach. |
For some unknown reason, the aiohttp stub was recording the unfiltered *request* URL as part of the response in the cassette. Other stubs do not seem to do this and I found no other requirement for response.url to be present, therefore the easy fix was to remove it entirely. Fixes kevin1024#517.
…er-for-aiohttp Fix query param filter for aiohttp (fixes #517)
Now that kevin1024/vcrpy#517 has been fixed in vcrpy v5.1.0
When using the
filter_query_parameters
argument, the aiohttp stub still records the full url given by the response object for later reconstruction of the yarl response. This is an unexpected behavior and can lead to secrets being leaked. Based on a review of the code, I think the Tornado stub may also have this same issue (but I haven't verified that). This leads us to having to manually scrub filtered values from cassettes to avoid secrets being committed into repositories.Here is an example test case and recorded cassettes. The query parameter
sometoken
is intended to be dropped from storage (please ignore the fact that that the test target, httpbin, includes the query parameters in the response body).This is the requests output which does not have the filtered value present in any vcrpy constructs:
This is the aiohttp response which does include the unfiltered token in the
url
key of the response:Edit:
This behavior was tested against the current master of the vcrpy project, but has also been observed in the latest 4.x release as well.
The text was updated successfully, but these errors were encountered: