-
-
Notifications
You must be signed in to change notification settings - Fork 113
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
Catch exceptions thrown when page number is not an integer #492
Comments
Was able to verify the issue, and there are some questions for me (or anyone else) in order to not waste effort on a solution without agreement on what to do. Technically, the request contains invalid query parameters and a 400 Bad Request would be the strict http response code. Should an exception with this status code be created (and then handled) in order to communicate the problem to the user? How much and what details are appropriate to include on the error page? |
400 sounds good. I think an error coming back saying that |
See #472 for details on how to throw without reporting to Yeller. |
I'm attempting this on windows, and the path to running locally is mighty perilous. I have more detailed information, but the main issues are:
Thought I might just mention what I've done so far in case I am missing something. As for a solution to the actual problem, I was thinking about modifying the |
Hi Tom, thanks heaps for your detailed writeup of your (frustrating) experience. That's really useful as I don't run Clojars on Windows so I miss these kind of cross platform issues.
I think what is happening is that an exception is being thrown at https://github.com/clojars/clojars-web/blob/master/src/clojars/db/migrate.clj#L12, but it is being silently swallowed. I've pushed eb7b0ba, can you take another pass and see if that fixes that problem?
Try using
I've noticed this too lately, try running
Have you set up the search repo for this? I'm out this weekend so I don't have time to dig into this too much, but I'll definitely take a look next week and try setting up Clojars on my Windows laptop to see if I can fix some of these bugs. Thanks for your detailed notes, they are really really helpful! |
Thanks for replying so quickly.
NOTE: Looks like markdown doesn't respect numbering for the items, they are in order 1-4 |
Alright, so one final clarification: The verification of the :page param is done early in the /search handler. The name Is the desire to push page verification into both the json-search and html-search functions so they can each separately handle it? I do have a working implementation similar to what I described for the html handler, but wanted to get context for the desire overall. |
Alright, I made a fork and put in changes that solve the issue for both html and json versions. https://github.com/tomjkidd/clojars-web I am hesitant to make a pull request because the tests don't pass on windows (I don't believe this has anything to do with code I wrote), but could you review the changes just as a sanity check that this is what you want? Note there are 2 commits at the top. The first is trivial to get the regex working on windows, the second is the actual handling of a bad page parameter. |
Making a PR is probably the easiest way for us to review and comment. Sorry I haven't gotten back to you about the Windows specific issues, been dealing with a young family :) |
And thanks! |
No worries. I've done the pull request. Thank you |
We get lots of garbage error reports from people fuzzing the page parameter. This will return a specific error for them, and won't report them to Yeller. Relates to #492
At https://github.com/clojars/clojars-web/blob/33/src/clojars/web.clj#L52, there is no exception handling for when the parameters can't be parsed as an integer. This should be handled and return an error page (500?) to the user.
A test case is: https://clojars.org/search?q=3&page=%26%2339%3b%2cnetsparker(0x000C93)%2c%26%2339%3b
or for your local app: http://localhost:8080/search?q=3&page=%26%2339%3b%2cnetsparker(0x000C93)%2c%26%2339%3b
The text was updated successfully, but these errors were encountered: