Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
autodata-foreign-domain-routing
Advanced tools
= Foreign Domain Request Routing
Foreign Domain Routing provides simple handling of foreign domains in Rails. It borrows largely from SubdomainFu and some other snippets found around the web.
Request routing allows you to define routing conditions that test methods/properties of the request object such as subdomain, domain, port. You can test them either against a value or with a Regexp (assuming the method returns a string)
Merging these two plugins allows them to work together and enhance the routing capability of Rails.
Documentation from the original plugins follows...
Foreign Domain Routing is available as a plugin. To install it with Rails 2.1 or later):
script/plugin install git://github.com/brianmulloy/foreign-domain-routing.git
Foreign Domain Routing extends Rails's routing mechanisms to provide a way to redirect non-native domains.
Let's say my rails app domain is 'mydomain.com' and I am creating an app that allows users to add a CNAME record to map their subdomain so that 'foo.usersdomain.com' would actually point to 'mydomain.com/users/1234'.
The route at the top of config/routes.rb would look like:
map.connect '*path', :controller => 'users', :action => 'index', :conditions => { :foreign_domain => true }
And in the users controller:
@user = User.find_by_foreign_domain(request.host.downcase)
You will need to configure Foreign Domain Routing based on your native hostnames.
A hash of arrays for the native domain names for each relevant environment.
Create the file config/initializers/native_domains.rb and put something like:
ForeignDomainRouting.init_native_domains = { :development => ['localhost'], :staging => ['staging.example.com'], :production => ['example.com', 'example.org', 'example.net'] } # set all at once (also the defaults)
Or set the native domains on the fly with:
ForeignDomainRouting.native_domains = ['example.com', 'example.org', 'example.net'] # sets for current environment
(c) Dan Webb 2006 (dan@vivabit.com)
Plugin that allows you to define routing conditions that test methods/properties of the request object such as subdomain, domain, port. You can test them either against a value or with a Regexp (assuming the method returns a string)
UPDATE Now works with the new routing code as implemented in edge rails. Note the change in API: use :conditions instead of :requirements.
== Installation
ruby script/plugin install http://svn.vivabit.net/external/rubylibs/request_routing/
== Usage
In routes.rb you can specify use the :requirements hash with request properties:
map.connect '', :controller => 'main', :conditions => { :subdomain => 'www' }
map.connect 'admin', :controller => 'admin', :conditions => { :remote_ip => /^127\.0\.0\.[0-9]$/ }
You can also, of course, use the conditions hash in map.with_options calls.
The allowed properties are:
:subdomain (only checks the first subdomain)
:domain (only accurate for single tld domain names at the moment)
:method (a symbol)
:port (a number)
:remote_ip
:content_type (content type of the post body)
:accepts
:request_uri (the entire request uri)
:protocol (either http:// or https://)
== Copyright
Copyright (c) 2009 Joe Scharf. See LICENSE for details.
FAQs
Unknown package
We found that autodata-foreign-domain-routing demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.