Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
= Usher
Tree-based router library. Useful for (specifically) for Rails and Rack, but probably generally useful for anyone interested in doing routing. Based on Ilya Grigorik suggestion, turns out looking up in a hash and following a tree is faster than Krauter's massive regex approach.
== Features
== Route format
From the rdoc:
Creates a route from +path+ and +options+
=== +path+ A path consists a mix of dynamic and static parts delimited by /
==== Dynamic Dynamic parts are prefixed with either :, *. :variable matches only one part of the path, whereas *variable can match one or more parts.
Example: /path/:variable/path would match
In the above examples, 'test', 'something_else' and 'one_more' respectively would be bound to the key :variable. However, /path/test/one_more/path would not be matched.
Example: /path/*variable/path would match
In the above examples, ['one', 'two', 'three'] and ['four', 'five'] respectively would be bound to the key :variable.
As well, variables can have a regex matcher.
Example: /product/{:id,\d+} would match
But not
As well, the same logic applies for * variables as well, where only parts matchable by the supplied regex will actually be bound to the variable
Variables can also have a greedy regex matcher. These matchers ignore all delimiters, and continue matching for as long as much as their regex allows.
Example: /product/{!id,hello/world|hello} would match
==== Static
Static parts of literal character sequences. For instance, /path/something.html would match only the same path. As well, static parts can have a regex pattern in them as well, such as /path/something.{html|xml} which would match only /path/something.html and /path/something.xml
==== Optional sections
Sections of a route can be marked as optional by surrounding it with brackets. For instance, in the above static example, /path/something(.html) would match both /path/something and /path/something.html.
==== One and only one sections
Sections of a route can be marked as "one and only one" by surrounding it with brackets and separating parts of the route with pipes. For instance, the path, /path/something(.xml|.html) would only match /path/something.xml and /path/something.html. Generally its more efficent to use one and only sections over using regex.
=== +options+
== Rails
script/plugin install git://github.com/joshbuddy/usher.git
== Rack
=== config.ru
require 'usher' app = proc do |env| body = "Hi there #{env['usher.params'][:name]}" [ 200, # Status code { # Response headers 'Content-Type' => 'text/plain', 'Content-Length' => body.size.to_s, }, [body] # Response body ] end
routes = Usher::Interface.for(:rack) do add('/hello/:name').to(app) end
run routes
curl http://127.0.0.1:3000/hello/samueltanders << Hi there samueltanders
== DONE
== TODO
(Let me show you to your request)
FAQs
Unknown package
We found that joshbuddy-usher demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.