Open Similadayo opened 2 months ago
Thanks for contributing @Similadayo.
I'm not sure which type check error this PR is addressing. Could you maybe share an example of the error you encountered during the scan?
Regarding the changes in your PR, I see you've added Cache-Control request headers. It's true that APIs should not allow public
cacheable responses if authentication is required. Testing for this behavior is actually planned for the next version (see issue #187). If you're interested in working on this feature as well. I will be happy to welcome your contributions!
Thanks for getting back to me @emmanuelgautier
My PR tackles the same issue about Cache-Control
headers for authenticated APIs. It makes sure that public cacheable responses aren’t allowed when authentication is used, which helps protect confidential data. I’d love to contribute more to this issue and help with testing in the next version. Let me know how I can help.
The goal of the scan is not necessarily to ensure that requests made during the scan aren't cached, but rather to check if there are any shared cache directives (like public Cache-Control) in the response, which could expose sensitive data.
I think, you should add a new scan for this specific case. You can refer to one of the existing scans in this repository: https://github.com/cerberauth/vulnapi/tree/main/scan.
I'd be happy to assist. One approach for the scan would involve making a request with an authentication method in place and then inspecting the response headers. If the response is successful (e.g., 2xx status code), and it includes public cache control directives, the test would fail as this could expose protected data. Do not hesitate to suggest another approach if you think there’s a better way to perform this scan.
Thanks for the clarification.
I will go through the scan directory to understand better and won't hesistate to reach out incase I need understanding.
This pull request fixes a problem with the GetHeaders method in the OAuth and JWT Bearer security schemes. It wasn't handling cases where attack and valid values were nil, which could cause errors. I changed the code to fix this, making sure headers are generated more reliably for requests.
Changes:
Fixed errors with type checks in GetHeaders.
Improved how attack and valid values are handled in headers.
I look forward to your feedback on these updates!