Skip to content

Conversation

@asambstack
Copy link
Collaborator

@asambstack asambstack commented Aug 22, 2024

  • Handling promise rejections for build artifacts unzipping failures
  • Added unzipper library fallback to decompress library for reducing unzipping failures

await decompress(path.join(filePath, fileName), filePath)
.then((files) => {
try {
await decompress(path.join(filePath, fileName), filePath);

Check warning

Code scanning / Semgrep OSS

Semgrep Finding: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal

Detected possible user input going into a `path.join` or `path.resolve` function. This could possibly lead to a path traversal vulnerability, where the attacker can access arbitrary files stored in the file system. Instead, be sure to sanitize or validate user input first.
await decompress(path.join(filePath, fileName), filePath)
.then((files) => {
try {
await decompress(path.join(filePath, fileName), filePath);

Check warning

Code scanning / Semgrep OSS

Semgrep Finding: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal

Detected possible user input going into a `path.join` or `path.resolve` function. This could possibly lead to a path traversal vulnerability, where the attacker can access arbitrary files stored in the file system. Instead, be sure to sanitize or validate user input first.
} catch (error) {
logger.debug(`Error unzipping with decompress, trying with unzipper. Stacktrace: ${error}.`);
try {
fs.createReadStream(path.join(filePath, fileName))

Check warning

Code scanning / Semgrep OSS

Semgrep Finding: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal

Detected possible user input going into a `path.join` or `path.resolve` function. This could possibly lead to a path traversal vulnerability, where the attacker can access arbitrary files stored in the file system. Instead, be sure to sanitize or validate user input first.
} catch (error) {
logger.debug(`Error unzipping with decompress, trying with unzipper. Stacktrace: ${error}.`);
try {
fs.createReadStream(path.join(filePath, fileName))

Check warning

Code scanning / Semgrep OSS

Semgrep Finding: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal

Detected possible user input going into a `path.join` or `path.resolve` function. This could possibly lead to a path traversal vulnerability, where the attacker can access arbitrary files stored in the file system. Instead, be sure to sanitize or validate user input first.
@ShashankG-Gollapally
Copy link
Contributor

RUN_SCA

@bstack-security-github bstack-security-github merged commit 2660676 into master Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants