
Research
/Security News
npm Package Uses Prompt Injection and Token Flooding to Disrupt AI Malware Scanners
A new npm package tests AI malware scanners with prompt injection, safety-triggering comments, context flooding, and obfuscated JavaScript.
It requires files from the base path of your app and let you configure alias to other paths for faster refactoring. No more ../..!!
$ npm install xreq --save
Use it in your modules:
//Current js file at foo/bar/a.js
var xreq = require('xreq');
//Require a file at other/folder/b.js, only searh from the base path
var b = xreq('other/folder/b');
It searches the package.json of your project, and build routes from that point.
Add some custom paths at package.json
"xreq": {
"server": "src/server",
"services": "src/server/services",
"models": "src/server/models",
"test": "test"
}
Use it in your modules:
//Current js file at foo/bar/a.js
var xreq = require('xreq');
//Require a file at "src/server/services". Use "service" alias as in the xreq
var AService = xreq.services('AService');
// That is better than require('../../src/server/services/AService');
Add a second parameter with value true
var xreq = require('xreq');
// Print the base location, the folder where the xreq file resides.
console.log(xreq('.', true));
// Print the complete path to file a.hbs
console.log(xreq('a.hts', true));
// It works the same way for aliases
console.log(xreq.templates('products.hts', true));
This method is quite useful for resolve template location or other static files in the local application.
xreq(function (file) {
return require('another_folder/' + file);
});
The following line use the proxy function.
var bar = xreq('foo.js');
If the proxy function returns a falsy value the resolution continues normally.
xreq(null);
FAQs
Extended require
We found that xreq 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
A new npm package tests AI malware scanners with prompt injection, safety-triggering comments, context flooding, and obfuscated JavaScript.

Product
Socket now detects supply chain risks in project manifests, starting with missing lockfiles that can make dependency installs non-reproducible.

Research
/Security News
The trojanized extensions use TinyGo-compiled WebAssembly and Solana transaction memos to resolve command-and-control infrastructure.