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.
Add shortcuts to make PUT
and DELETE
AJAX requests:
$.put('/posts/1', { title: 'New' }, function(message) {
alert('Saved. ' + message)
})
$.del('/posts/1', function(message) {
alert('Deleted. ' + message)
})
Because some browsers and firewalls have problems with PUT
and DELETE
requests, shortcuts create POST
request with X-HTTP-Method-Override
header
with correct method name.
All Rack frameworks (Ruby on Rails, Sinatra) support this override.
For plain Rack app you need to use Rack::MethodOverride
middleware.
Shorcuts have same arguments as $.post
(url, data, callback, dataType),
so you can set response type on last argument.
They just shortcuts under $.ajax
, so they return $.Deferred
object:
$.delete('/posts/1').
success(function() { alert('Deleted') }).
error(function() { alert('Error') })
In Rails 3.1 (or another project with Sprockets 2) just add jquery-rest
to
Gemfile
:
gem 'jquery-rest'
and add require to app/assets/javascripts/application.js.coffee
:
#= require "jquery.rest"
If you use Jammit or another package manager just copy lib/jquery.rest.js
to
public/javascripts/lib
in your project and add library to config/assets.yml
:
javascripts:
application:
- public/javascripts/lib/jquery.rest.js
If you didn’t use Rails 3.1 or assets packaging manager you can use already
minimized version of library at lib/jquery.rest.min.js
.
To run project tests and minimize source you must have Ruby and Bundler. For example, on Ubuntu:
sudo apt-get install ruby rubygems
sudo gem install bundler
Next you need install Jasmine, UglifyJS and other dependencies by Bundler. Run in project root:
bundle install --path=.bundle
That’s all. To run tests start server and open http://localhost:8888/:
bundle exec rake server
Before commit minimize project source:
bundle exec rake min
FAQs
Unknown package
We found that jquery-rest 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.