Skip to content
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

HTTP errors are not handled and result in cache poisoning #50

Open
tdltdl opened this issue Sep 8, 2024 · 0 comments
Open

HTTP errors are not handled and result in cache poisoning #50

tdltdl opened this issue Sep 8, 2024 · 0 comments

Comments

@tdltdl
Copy link

tdltdl commented Sep 8, 2024

In BaseRequest, the only response code handled is 429 (Rate Limit).

Any other code are just ignored and an empty result is returned. If a cache defined, it will poisoning it with an empty value.

If the token is incorrect (or the service has not been renewed on time) will result in silent errors. Same if your service has a glitch and return 5xx error.

As I expect the service would always return 200 in case of success (I assume it will not return 302 or any partial response), any non 200 code could return null and not be stored in the cache.

"Expected" errors like 403 could raise their own exception - probably same for 5xx. I would also add some logging in there.

tdltdl pushed a commit to tdltdl/ipInfojava that referenced this issue Sep 11, 2024
…s with cache poisoning.

WARNING This change is not a drop in replacement as if we get 403 because the token is incorrect, a checked exception is raised.
Also note that, if an empty or null token is passed, it is now a fail fast (instead of getting a null pointer exception at the first request)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant