Skip to main content

CVE-2022-31051: CWE-200: Exposure of Sensitive Information to an Unauthorized Actor in semantic-release semantic-release

Medium
Published: Thu Jun 09 2022 (06/09/2022, 20:05:12 UTC)
Source: CVE
Vendor/Project: semantic-release
Product: semantic-release

Description

semantic-release is an open source npm package for automated version management and package publishing. In affected versions secrets that would normally be masked by semantic-release can be accidentally disclosed if they contain characters that are excluded from uri encoding by `encodeURI`. Occurrence is further limited to execution contexts where push access to the related repository is not available without modifying the repository url to inject credentials. Users are advised to upgrade. Users unable to upgrade should ensure that secrets that do not contain characters that are excluded from encoding with `encodeURI` when included in a URL are already masked properly.

AI-Powered Analysis

AILast updated: 06/23/2025, 05:05:33 UTC

Technical Analysis

CVE-2022-31051 is a medium-severity vulnerability affecting the semantic-release npm package, which is widely used for automated version management and package publishing in JavaScript projects. The vulnerability arises from improper handling of secrets within the package's code, specifically related to URI encoding. Semantic-release attempts to mask sensitive information such as tokens or credentials to prevent accidental exposure in logs or outputs. However, if these secrets contain characters that are excluded from encoding by JavaScript's native encodeURI function, they may not be masked properly. This leads to the potential exposure of sensitive information to unauthorized actors. The vulnerability is further constrained by the execution context: it only manifests when the user does not have push access to the repository unless the repository URL is modified to inject credentials. This means an attacker would need to manipulate the repository URL or have a specific environment setup to exploit the flaw. The affected versions range from 17.0.4 up to but not including 19.0.3, and users are advised to upgrade to versions beyond 19.0.3 where the issue is resolved. For those unable to upgrade, it is recommended to ensure that secrets do not contain characters excluded from encodeURI encoding or that such secrets are masked by other means before inclusion in URLs. No known exploits have been reported in the wild, and no CVSS score is assigned to this vulnerability. The root cause is classified under CWE-200, indicating exposure of sensitive information to unauthorized actors due to insufficient masking or sanitization of secrets in the codebase.

Potential Impact

The primary impact of CVE-2022-31051 is the potential unauthorized disclosure of sensitive information such as authentication tokens or credentials used in automated publishing workflows. For European organizations relying on semantic-release in their CI/CD pipelines, this could lead to leakage of secrets that might be used to gain unauthorized access to code repositories or package registries. Such exposure could facilitate further attacks, including code tampering, supply chain compromise, or unauthorized package publication. Although exploitation requires specific conditions (e.g., repository URL manipulation and lack of push access), the risk remains significant in environments where multiple contributors or automated systems interact with repositories. The exposure of secrets can undermine the confidentiality and integrity of software supply chains, which is a critical concern for European organizations subject to stringent data protection regulations and supply chain security mandates. Additionally, organizations in sectors with high regulatory scrutiny (finance, healthcare, critical infrastructure) could face compliance risks if sensitive credentials are leaked. The vulnerability does not directly impact availability but could indirectly cause service disruptions if attackers leverage exposed secrets to compromise build or deployment pipelines.

Mitigation Recommendations

1. Upgrade semantic-release to version 19.0.3 or later, where this vulnerability has been addressed. 2. Review all secrets used in semantic-release configurations to ensure they do not contain characters excluded from encodeURI encoding, such as certain punctuation marks. 3. Implement additional masking or sanitization of secrets before they are included in URLs or logs, using custom encoding or escaping mechanisms beyond encodeURI. 4. Restrict repository URL modifications and enforce strict access controls to prevent unauthorized injection of credentials into repository URLs. 5. Audit CI/CD pipelines and automated publishing workflows to detect any accidental exposure of secrets in logs, environment variables, or output files. 6. Employ secret scanning tools that can detect exposed credentials in code repositories and build artifacts. 7. Educate developers and DevOps teams about secure handling of secrets, emphasizing the limitations of encodeURI and the importance of proper masking. 8. Consider using dedicated secret management solutions that integrate with CI/CD pipelines to avoid embedding secrets directly in URLs or configuration files. These steps go beyond generic advice by focusing on the specific encoding issue and the contextual conditions required for exploitation.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
GitHub_M
Date Reserved
2022-05-18T00:00:00.000Z
Cisa Enriched
true

Threat ID: 682d9844c4522896dcbf3458

Added to database: 5/21/2025, 9:09:24 AM

Last enriched: 6/23/2025, 5:05:33 AM

Last updated: 8/12/2025, 9:03:43 AM

Views: 15

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats