-
Notifications
You must be signed in to change notification settings - Fork 654
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
npm search _something_ doesn't work #36
Comments
"Unexpected token C" is from "Cannot GET /-/all/...", it's default express 404 handler. This feature is missing entirely. I'd say it's a "patch welcome" kind of thing. What is expected to be in the output anyway? Should somebody be able to search in local (restricted) packages? Or just proxy an output from npmjs.org and get it over with? |
I would say that people can search yeah, the same way that they can install them, so I don't see the point to restrict access. But local packages would have priority over npmjs.org. I can write a patch for it if you agree with this workflow :) |
Sinopia does not use database. Currently each package is separated to it's own folder on the filesystem. If you try to implement search on all local packages, it'll either require some kind of a database to keep track of all packages (bye simplicity) or open a door to a DoS. So I don't see how complete search can be implemented at this point. |
A solution for a complete search can be to make the search on registry.npmjs.org then, for private packages, search in There is certainly some edge cases to address (first build with an empty local index, how reliable can be the |
At least it should proxy the request to http://registry.npmjs.org |
@rlidwka if your concern is DoS what it can be done is create some kind of cached response which would have a limited lifetime and that lifetime could be controlled by the config.yml like: cache_search: 5000 (5s) That way even if someone tried to hack the system it would work properly. Does someone have a better/different solution? |
We could alternatively limit the number of concurrent search requests to something sane (configurable) and return a HTTP 503 if the limit is exceeded. For normal use cases this is unlikely to happen and in the case of DoS - only the search feature would be affected. |
If I execute:
npm search _my_package_
it gives me an error:It seems that the output from sinopia is not compatible with the parser of npm-search (I only tried with a non-existent package, I can't test with an existing one right now).
This are my current versions:
node --version
v0.10.5
npm --version
1.2.18
sinopia --version
0.5.5
The text was updated successfully, but these errors were encountered: