
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
#A lightweight module loader for node and the browser.
The goal of AMD is to create the simplest possible module loader that is compatible with both node and the browser. it is a partial implementation of [CommonJS/Modules/SimpleAsynchronous] (http://wiki.commonjs.org/wiki/Modules/SimpleAsynchronous)
AMD forces you to declare all your dependencies up front, and not require anything new after that point.
This makes module loading easy.
##AMD modules:
It is necessary to define your modules a new way:
###the old way:
//ab.js
var a = require('./a')
, b = require('./b')
exports.ab = function (x){return a(b(x))}
###the NEW way:
//ab.js - amd style
require('amd') // (loads monkeypatch which makes amd work in node)
module.define(['./a', './b'], function AB (a,b){
return {ab: function (x){return a(b(x))} } //exports is returned.
})
module.define
takes two arguments an array of dependencies and a initializer function.
the dependencies are loaded and passed to the initializer in the same order that they are in the array.
The return value of the initializer is the module's exports.
####then do $ amd ab.js > ab-browser.js
:
AMD will load the modules, get their dependencies, topologically sort them, stringify them, and plug dependencies into the correct places, with very little overhead!
then it will return a script that you can simply include on your page:
(function (M){
M[1] =
(function A(){
return function (x){'!' + x + '!'}
})();
M[2] =
(function B(){
return function (x){'?' + x + '?'}
})();
return (function AB(a,b){
return function (x){return a(b(x))} //exports is returned.
})(M[1],M[2]);
})({});
##limitations
AMD does not support:
__filename
, __dirname
, or module
variables (in the browser)If you think these features should be supported please [email me] (mailto:dominic.tarr@gmail.com) with your use-case.
Currently these features are ignored to keep this module simple, or because they aren't appropriate on browser side modules.
##FORTHCOMING FEATURES: (things I am thinking about, at least)
FAQs
Async Module Definition - module loader/bunder for node + browser
We found that amd demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 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.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.