
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
create temporary files and directories
$ npm install mktemp
import * as os from 'node:os';
import * as path from 'node:path';
import * as mktemp from 'mktemp';
const tempDir = os.tmpdir();
mktemp.createFile(path.join(tempDir, 'XXXXX.txt'), function (err, path) {
if (err) throw err;
// path match a /^[\da-zA-Z]{5}\.txt$/
console.log(path);
});
// return value match a /^[\da-zA-Z]{5}\.tmp$/
mktemp.createFileSync(path.join(tempDir, 'XXXXX.tmp'));
mktemp.createDir(path.join(tempDir, 'XXXXXXX'), function (err, path) {
if (err) throw err;
// path match a /^[\da-zA-Z]{7}$/
console.log(path);
});
// return value match a /^XXX-[\da-zA-Z]{3}$/
mktemp.createDirSync(path.join(tempDir, 'XXX-XXX'));
if support Promise, can use Promise style.
import * as mktemp from 'mktemp';
mktemp
.createFile('XXXXX.txt')
.then(function (path) {
// path match a /^[\da-zA-Z]{5}\.txt$/
console.log(path);
})
.catch(function (err) {
console.error(err);
});
mktemp
.createDir('XXXXX')
.then(function (path) {
// path match a /^[\da-zA-Z]{5}$/
console.log(path);
})
.catch(function (err) {
console.error(err);
});
mktemp functions are replace to random string from placeholder "X" in template. see example:
mktemp.createFileSync('XXXXXXX'); // match a /^[\da-zA-Z]{7}$/
mktemp.createFileSync('XXX.tmp'); // match a /^[\da-zA-Z]{3}\.tmp$/
mktemp.createFileSync('XXX-XXX'); // match a /^XXX-[\da-zA-Z]{3}$/
template
String - filename templatemode
Number - file permission mode (default: 0o600)callback
function(err, path) - callback function
err : Error|Null - error objectpath : String - pathcreate blank file of unique filename. return Promise if callback is not passed.
template
String - filename templatemode
Number - file permission mode (default: 0o600)return
String - pathsync version createFile.
template
String - dirname templatemode
Number - directory permission mode (default: 0o700)callback
function(err, path) - callback function
err : Error|Null - error objectpath : String - pathcreate directory of unique dirname. return Promise if callback is not passed.
template
String - dirname templatemode
Number - directory permission mode (default: 0o700)return
String - pathsync version createDir.
The MIT license.
FAQs
create temporary files and directories
The npm package mktemp receives a total of 706,472 weekly downloads. As such, mktemp popularity was classified as popular.
We found that mktemp demonstrated a healthy version release cadence and project activity because the last version was released less than 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
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.