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.
= Buttons
NOTE: This is a very early version of Buttons. Expect it to change rapidly.
Buttons is a Rack framework for working with JavaScript-heavy applications. It automatically creates Ajax endpoints for Ruby methods, and creates a set of JavaScript functions to access those endpoints.
== Example
Here's an example. The Ruby class below will automatically generate the JavaScript found beneath it. For now, we only generate code that relies on jQuery, but that's planned to change.
Ruby code:
class ProfileButton < Buttons::Button
get :show
post :login
def login(username, password)
# The variable's set just to show that it's being returned.
token = generate_login_token(username, password)
token
end
def show(profile_id)
Profile.find(profile_id)
end
end
JavaScript code (found at /profile.js):
(function () {
this.Profile = {};
Profile.login = function (username, password, _ajaxOptions) {
var data = { 'username': username, 'password': password };
if (_ajaxOptions === undefined || typeof(_ajaxOptions) != "object") {
_ajaxOptions = {};
}
_ajaxOptions['type'] = "POST";
_ajaxOptions['url'] = "/profile/login";
_ajaxOptions['data'] = data;
if (_ajaxOptions['dataType'] === 'undefined') {
_ajaxOptions['dataType'] = 'json';
}
return jQuery.ajax(_ajaxOptions);
};
Profile.show = function (profileId, _ajaxOptions) {
var data = { 'profile_id': profileId };
if (_ajaxOptions === undefined || typeof(_ajaxOptions) != "object") {
_ajaxOptions = {};
}
_ajaxOptions['type'] = "GET";
_ajaxOptions['url'] = "/profile/show";
_ajaxOptions['data'] = data;
if (_ajaxOptions['dataType'] === 'undefined') {
_ajaxOptions['dataType'] = 'json';
}
return jQuery.ajax(_ajaxOptions);
};
})();
== How to use this
Run buttons to create a new Buttons application in that directory. There's not any helpers or generators yet, but you can look at the generated application to figure it out for now.
FAQs
Unknown package
We found that buttons 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.