Compare commits

...

9 Commits

Author SHA1 Message Date
Bark
346d63b964
Merge 8066dc8511 into 1aab8b2d5a 2025-06-23 23:51:28 +00:00
Jordan Harband
1aab8b2d5a
[meta] update security policy; add IRP 2025-06-23 16:11:48 -07:00
Stiliyan Tonev (Bark)
8066dc8511 remove test from slow folder 2024-07-31 16:44:25 +03:00
Stiliyan Tonev (Bark)
59b40b8ae7 Rookie mistake from my side, forgot to clean-up the nvmrc, which caused other tests to fail.
Updated version color printing test because it did not pass.
2024-07-31 16:42:03 +03:00
Stiliyan Tonev (Bark)
ce777fa5cf Merge branch 'fork-dev' of https://github.com/userwiths/nvm into fork-dev 2024-07-31 12:02:53 +03:00
Stiliyan Tonev (Bark)
650b069bb8 Seems changes done in docker do not persist, had to reapply them 2024-07-30 11:56:35 +03:00
Stiliyan Tonev (Bark)
5a28180ed6 tests: Add test to check if the message contains the relevant information. 2024-07-30 11:51:32 +03:00
Bark
05feeaa927
[Fix] nvm exec: Do a version check on nvm-exec
This check would display a message in case the `.nvmrc` version is not installed, and would not alter the output otherwise.
2024-03-06 16:03:10 +02:00
Bark
e2ff1e7f08 fix: Do a version check on nvm-exec
This check would display a message in case the `.nvmrc` version is not installed, and would not alter the output otherwise.
2024-03-06 16:03:10 +02:00
5 changed files with 150 additions and 12 deletions

117
.github/INCIDENT_RESPONSE_PLAN.md vendored Normal file
View File

@ -0,0 +1,117 @@
# Incident Response Process for **nvm**
## Reporting a Vulnerability
We take the security of **nvm** very seriously. If you believe youve found a security vulnerability, please inform us responsibly through coordinated disclosure.
### How to Report
> **Do not** report security vulnerabilities through public GitHub issues, discussions, or social media.
Instead, please use one of these secure channels:
1. **GitHub Security Advisories**
Use the **Report a vulnerability** button in the Security tab of the [nvm-sh/nvm repository](https://github.com/nvm-sh/nvm).
2. **Email**
Follow the posted [Security Policy](https://github.com/nvm-sh/nvm/security/policy).
### What to Include
**Required Information:**
- Brief description of the vulnerability type
- Affected version(s) and components
- Steps to reproduce the issue
- Impact assessment (what an attacker could achieve)
**Helpful Additional Details:**
- Full paths of affected scripts or files
- Specific commit or branch where the issue exists
- Required configuration to reproduce
- Proof-of-concept code (if available)
- Suggested mitigation or fix
## Our Response Process
**Timeline Commitments:**
- **Initial acknowledgment**: Within 24 hours
- **Detailed response**: Within 3 business days
- **Status updates**: Every 7 days until resolved
- **Resolution target**: 90 days for most issues
**What Well Do:**
1. Acknowledge your report and assign a tracking ID
2. Assess the vulnerability and determine severity
3. Develop and test a fix
4. Coordinate disclosure timeline with you
5. Release a security update and publish an advisory and CVE
6. Credit you in our security advisory (if desired)
## Disclosure Policy
- **Coordinated disclosure**: Well work with you on timing
- **Typical timeline**: 90 days from report to public disclosure
- **Early disclosure**: If actively exploited
- **Delayed disclosure**: For complex issues
## Scope
**In Scope:**
- **nvm** project (all supported versions)
- Installation and update scripts (`install.sh`, `nvm.sh`)
- Official documentation and CI/CD integrations
- Dependencies with direct security implications
**Out of Scope:**
- Third-party forks or mirrors
- Platform-specific installs outside core scripts
- Social engineering or physical attacks
- Theoretical vulnerabilities without practical exploitation
## Security Measures
**Our Commitments:**
- Regular vulnerability scanning via GitHub Actions
- Automated security checks in CI/CD pipelines
- Secure scripting practices and mandatory code review
- Prompt patch releases for critical issues
**User Responsibilities:**
- Keep **nvm** updated
- Verify script downloads via PGP signatures
- Follow secure configuration guidelines for shell environments
## Legal Safe Harbor
**We will NOT:**
- Initiate legal action
- Contact law enforcement
- Suspend or terminate your access
**You must:**
- Only test against your own installations
- Not access, modify, or delete user data
- Not degrade service availability
- Not publicly disclose before coordinated disclosure
- Act in good faith
## Recognition
- **Advisory Credits**: Credit in GitHub Security Advisories (unless anonymous)
## Security Updates
**Stay Informed:**
- Subscribe to GitHub releases for **nvm**
- Enable GitHub Security Advisory notifications
**Update Process:**
- Patch releases (e.g., v0.40.3 → v0.40.4)
- Out-of-band releases for critical issues
- Advisories via GitHub Security Advisories
## Contact Information
- **Security reports**: Security tab of [nvm-sh/nvm](https://github.com/nvm-sh/nvm/security)
- **General inquiries**: GitHub Discussions or Issues

17
.github/SECURITY.md vendored
View File

@ -1,6 +1,6 @@
# Security # Security
Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report. Please file a private vulnerability report via GitHub, email [@ljharb](https://github.com/ljharb), or see https://tidelift.com/security if you have a potential security vulnerability to report.
## OpenSSF CII Best Practices ## OpenSSF CII Best Practices
@ -12,16 +12,17 @@ There are three “tiers”: passing, silver, and gold.
We meet 100% of the “passing” criteria. We meet 100% of the “passing” criteria.
### Silver ### Silver
We meet 95% of the “silver” criteria. The gaps are as follows: We meet 100% of the “silver” criteria.
- we do not have a DCO or a CLA process for contributions.
- because we only have one maintainer, the project has no way to continue if that maintainer stops being active.
- we do not currently document “what the user can and cannot expect in terms of security” for our project. This is planned to be completed in 2023.
### Gold ### Gold
We meet 65% of the “gold” criteria. The gaps are as follows: We meet 78% of the “gold” criteria. The gaps are as follows:
- we do not yet have the “silver” badge; see all the gaps above. - because we only have one maintainer, the project has no way to continue if that maintainer stops being active.
- We do not include a copyright or license statement in each source file. Efforts are underway to change this archaic practice into a suggestion instead of a hard requirement. - We do not include a copyright or license statement in each source file. Efforts are underway to change this archaic practice into a suggestion instead of a hard requirement.
## Threat Model ## Threat Model
See [THREAT_MODEL.md](./THREAT_MODEL.md). See [THREAT_MODEL.md](.github/THREAT_MODEL.md).
## Incident Response Plan
Please see our [Incident Response Plan](.github/INCIDENT_RESPONSE_PLAN.md).

View File

@ -7,6 +7,7 @@ unset NVM_CD_FLAGS
# shellcheck disable=SC1090,SC1091 # shellcheck disable=SC1090,SC1091
\. "$DIR/nvm.sh" --no-use \. "$DIR/nvm.sh" --no-use
nvm_rc_version > /dev/null && nvm_ensure_version_installed "$NVM_RC_VERSION";
if [ -n "$NODE_VERSION" ]; then if [ -n "$NODE_VERSION" ]; then
nvm use "$NODE_VERSION" > /dev/null || exit 127 nvm use "$NODE_VERSION" > /dev/null || exit 127
elif ! nvm use >/dev/null 2>&1; then elif ! nvm use >/dev/null 2>&1; then

View File

@ -0,0 +1,19 @@
#!/bin/bash
set -x
\. ../../nvm.sh
NVM_TEST_VERSION=v0.42
# Write it to nvmrc
echo "$NVM_TEST_VERSION" > .nvmrc
OUTPUT="$(../../nvm-exec 2>&1)";
EXPECTED="N/A: version \"${NVM_TEST_VERSION}\" is not yet installed.
You need to run \`nvm install ${NVM_TEST_VERSION}\` to install and use it.
No NODE_VERSION provided; no .nvmrc file found";
# Skip install, we want to test the error message
diff <(echo "${EXPECTED}") <(echo "${OUTPUT}")
rm .nvmrc

View File

@ -2,7 +2,7 @@
\. ../../../nvm.sh \. ../../../nvm.sh
set -e #set -e #nvm use system returns 127 and No system set message
die () { die () {
# echo "$@" ; # echo "$@" ;
@ -24,7 +24,7 @@ fi
# default system color # default system color
nvm use system nvm use system
OUTPUT=$(nvm_print_versions system) OUTPUT=$(nvm_print_versions system)
FORMAT="\033[0;32m-> %12s\033[0m" FORMAT="\033[0;33m%15s\033[0m"
VERSION='system' VERSION='system'
EXPECTED_OUTPUT=$(command printf -- "${FORMAT}\\n" "${VERSION}") EXPECTED_OUTPUT=$(command printf -- "${FORMAT}\\n" "${VERSION}")
@ -34,7 +34,7 @@ nvm_ls_current() { echo "current";}
# default current color # default current color
OUTPUT=$(nvm_print_versions current) OUTPUT=$(nvm_print_versions current)
FORMAT="\033[0;32m-> %12s\033[0m" FORMAT="\033[0;32m->%13s\033[0m"
VERSION="current" VERSION="current"
EXPECTED_OUTPUT=$(command printf -- "${FORMAT}\\n" "${VERSION}") EXPECTED_OUTPUT=$(command printf -- "${FORMAT}\\n" "${VERSION}")
@ -43,7 +43,7 @@ EXPECTED_OUTPUT=$(command printf -- "${FORMAT}\\n" "${VERSION}")
# custom current color # custom current color
nvm set-colors YCMGR nvm set-colors YCMGR
OUTPUT=$(nvm_print_versions current) OUTPUT=$(nvm_print_versions current)
FORMAT="\033[1;35m-> %12s\033[0m" FORMAT="\033[1;35m->%13s\033[0m"
VERSION="current" VERSION="current"
EXPECTED_OUTPUT=$(command printf -- "${FORMAT}\\n" "${VERSION}") EXPECTED_OUTPUT=$(command printf -- "${FORMAT}\\n" "${VERSION}")