Skip to content

Doc 1834/migration - #671

Open
max-koro wants to merge 503 commits into
mainfrom
DOC-1834/migration
Open

Doc 1834/migration#671
max-koro wants to merge 503 commits into
mainfrom
DOC-1834/migration

Conversation

@max-koro

Copy link
Copy Markdown
Contributor

No description provided.

@max-koro
max-koro requested review from a team as code owners July 22, 2026 11:47
@linear

linear Bot commented Jul 22, 2026

Copy link
Copy Markdown

DOC-1834

@netlify

netlify Bot commented Jul 22, 2026

Copy link
Copy Markdown

Deploy Preview for incomparable-tiramisu-91a96a ready!

Name Link
🔨 Latest commit 853b6a0
🔍 Latest deploy log https://app.netlify.com/projects/incomparable-tiramisu-91a96a/deploys/6aa41a18053fd10008301dc7
😎 Deploy Preview https://deploy-preview-671--incomparable-tiramisu-91a96a.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@wiz-swan

wiz-swan Bot commented Jul 22, 2026

Copy link
Copy Markdown

Wiz Scan Summary

Scanner Findings
Vulnerability Finding Vulnerabilities 1 Medium
Data Finding Sensitive Data -
Secret Finding Secrets -
IaC Misconfiguration IaC Misconfigurations -
SAST Finding SAST Findings 12 Medium 17 Low
Software Management Finding Software Management Findings -
Total 13 Medium 17 Low

View scan details in Wiz

To detect these findings earlier in the dev lifecycle, try the Wiz Code extension for VS Code, JetBrains, or Visual Studio.

const DOCS_DIR = path.join(__dirname, "..", "..", "docs");

function walk(dir, acc) {
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low SAST Finding

Improper Limitation of Pathname to Restricted Directory (Path Traversal) (CWE-22)

More Details

Path traversal vulnerabilities occur when user-supplied input is used to construct file paths without proper validation or sanitization. This allows an attacker to access files and directories outside the intended scope, potentially exposing sensitive data or enabling unauthorized system access.

The risk stems from the application's failure to properly restrict file operations to a limited directory. By manipulating the file path with special characters like "../", an attacker can traverse the file system hierarchy and access arbitrary files or directories.

Successful exploitation of a path traversal vulnerability can lead to data breaches, unauthorized access to system resources, and potentially complete system compromise. It is crucial to validate and sanitize all user input used in file operations to prevent such attacks.

Attribute Value
Impact Medium
Likelihood Low

Remediation

Path traversal vulnerabilities occur when user-supplied input is used to construct file paths without proper validation or sanitization. This allows an attacker to access files and directories outside the intended scope, potentially exposing sensitive data or enabling unauthorized system access. Successful exploitation of a path traversal vulnerability can lead to data breaches, unauthorized access to system resources, and potentially complete system compromise.

To fix this issue, you should validate and sanitize all user input used in file operations to prevent path traversal attacks. This can be achieved by using a secure path resolution library or by implementing strict input validation and sanitization routines. Avoid concatenating user input directly into file paths, and instead, use platform-specific path normalization functions to resolve paths safely.

Code examples

// VULNERABLE CODE - User input is concatenated directly into the file path
const fs = require('fs');
const userInput = "../../../sensitive.txt";
fs.readFile(`/app/files/${userInput}`, (err, data) => {
  // ...
});
// SECURE CODE - User input is sanitized, and path is resolved securely
const fs = require('fs');
const path = require('path');
const userInput = "../../../sensitive.txt";
const sanitizedPath = path.resolve('/app/files', path.normalize(userInput));
fs.readFile(sanitizedPath, (err, data) => {
  // ...
});

Additional recommendations

  • Use the built-in path module in Node.js to safely construct file paths.
  • Implement strict input validation and sanitization routines for all user input used in file operations.
  • Follow the principle of least privilege and restrict file operations to a limited directory scope.
  • Adhere to security best practices outlined in the OWASP Top 10 and CWE guidelines for handling user input and file operations.
  • Consider using a secure path resolution library like path-sanitizer or secure-path-resolve for additional protection against path traversal attacks.

Rule ID: WS-I011-TYPESCRIPT-00001

Comment thread plugins/llms-txt/index.js
// doc id -> absolute source path, or null if neither .mdx nor .md exists.
function sourceFor(id) {
for (const ext of [".mdx", ".md"]) {
const p = path.resolve(DOCS_DIR, `${id}${ext}`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium SAST Finding

Path Traversal Vulnerability in Node.js (CWE-22)

More Details

This rule detects potential path traversal vulnerabilities in Node.js applications. Path traversal vulnerabilities occur when user input is passed unsanitized to file system operations, allowing attackers to access arbitrary files and directories on the server.

This issue presents a significant security risk as it can lead to unauthorized access to sensitive data, code execution, and complete system compromise. If exploited, an attacker could read confidential files, modify system files, or even execute malicious code on the server.

Attribute Value
Impact Medium
Likelihood Medium

Remediation

Path traversal vulnerabilities allow an attacker to access arbitrary files on the system, potentially exposing sensitive data or enabling further attacks. This vulnerability arises when user input is passed unsanitized to path manipulation functions like path.join or path.resolve, allowing an attacker to traverse the file system using patterns like ../.

To fix this issue, user input should be sanitized or validated before being passed to path manipulation functions. This can be done by using allowlists, removing or encoding special characters, or validating the resulting path against a set of allowed directories.

Code examples

// VULNERABLE CODE - User input is passed directly to path.join
const userInput = req.query.file;
const filePath = path.join(__dirname, userInput);
fs.readFile(filePath, (err, data) => { ... });
// SECURE CODE - User input is sanitized before path manipulation
const userInput = req.query.file;
const sanitizedInput = sanitizeInput(userInput); // Implement sanitization logic
const filePath = path.join(__dirname, sanitizedInput);
fs.readFile(filePath, (err, data) => { ... });

Additional recommendations

  • Follow the principle of least privilege and restrict file access as much as possible.
  • Use allowlists instead of denylist-based input validation when possible.
  • Consider using libraries like path-sanitizer or sanitize-filename for input sanitization.
  • Adhere to the OWASP Input Validation Cheat Sheet and other relevant security standards.
  • As an alternative approach, consider using a virtual file system or sandboxing techniques to isolate file operations from the main system.

Rule ID: WS-I013-JAVASCRIPT-00098

Comment thread plugins/llms-txt/index.js Outdated
const warnings = [];
const { text, sectionCount, linkCount } = buildLlmsTxt(siteConfig, warnings);

fs.writeFileSync(path.join(outDir, "llms.txt"), text);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium SAST Finding

Path Traversal Vulnerability in Node.js (CWE-22)

More Details

This rule detects potential path traversal vulnerabilities in Node.js applications. Path traversal vulnerabilities occur when user input is passed unsanitized to file system operations, allowing attackers to access arbitrary files and directories on the server.

This issue presents a significant security risk as it can lead to unauthorized access to sensitive data, code execution, and complete system compromise. If exploited, an attacker could read confidential files, modify system files, or even execute malicious code on the server.

Attribute Value
Impact Medium
Likelihood Medium

Remediation

Path traversal vulnerabilities allow an attacker to access arbitrary files on the system, potentially exposing sensitive data or enabling further attacks. This vulnerability arises when user input is passed unsanitized to path manipulation functions like path.join or path.resolve, allowing an attacker to traverse the file system using patterns like ../.

To fix this issue, user input should be sanitized or validated before being passed to path manipulation functions. This can be done by using allowlists, removing or encoding special characters, or validating the resulting path against a set of allowed directories.

Code examples

// VULNERABLE CODE - User input is passed directly to path.join
const userInput = req.query.file;
const filePath = path.join(__dirname, userInput);
fs.readFile(filePath, (err, data) => { ... });
// SECURE CODE - User input is sanitized before path manipulation
const userInput = req.query.file;
const sanitizedInput = sanitizeInput(userInput); // Implement sanitization logic
const filePath = path.join(__dirname, sanitizedInput);
fs.readFile(filePath, (err, data) => { ... });

Additional recommendations

  • Follow the principle of least privilege and restrict file access as much as possible.
  • Use allowlists instead of denylist-based input validation when possible.
  • Consider using libraries like path-sanitizer or sanitize-filename for input sanitization.
  • Adhere to the OWASP Input Validation Cheat Sheet and other relevant security standards.
  • As an alternative approach, consider using a virtual file system or sandboxing techniques to isolate file operations from the main system.

Rule ID: WS-I013-JAVASCRIPT-00098

const empty = { inline: [], blocks: [] };

// Field-requirement / support badges.
if (BADGE[name]) return { inline: BADGE[name](), blocks: [] };

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low SAST Finding

Unsafe Dynamic Method Invocation (CWE-94)

More Details

This rule detects instances where non-static data is used to retrieve and execute functions from an object dynamically. This practice can be dangerous as it may allow executing arbitrary code if the data is user-controlled or untrusted.

The vulnerability arises when the application takes user input or external data and uses it to dynamically invoke methods or functions on an object. If an attacker can control the input, they may be able to execute arbitrary code within the application, leading to various security risks such as code injection, data tampering, or unauthorized access. The potential consequences of this vulnerability can range from data leakage to complete system compromise, depending on the application's functionality and the attacker's capabilities.

Attribute Value
Impact Low
Likelihood Low

Remediation

The use of non-static data to retrieve and execute functions from an object can lead to code injection vulnerabilities. If the data used to determine the function to execute is user-controlled or comes from an untrusted source, an attacker could potentially execute arbitrary code on the system, leading to various security risks such as data theft, system compromise, or denial of service.

To remediate this issue, it is recommended to use a whitelist approach, where only a predefined set of allowed functions can be executed. This can be achieved by using an object or map that maps function names to their corresponding function references. When executing a function, check if the requested function name exists in the whitelist, and if so, execute the corresponding function reference. If the requested function is not in the whitelist, do not execute it and handle the case appropriately (e.g., log the attempt, return an error, or take other appropriate actions).

Code examples

// VULNERABLE CODE - Non-static data is used to retrieve and execute a function
const obj = {
  foo: () => console.log('foo'),
  bar: () => console.log('bar')
};
const functionName = getUserInput(); // Potentially untrusted input
obj[functionName](); // Executing the function based on user input
// SECURE CODE - Using a whitelist approach
const allowedFunctions = {
  'foo': () => console.log('foo'),
  'bar': () => console.log('bar')
};
const functionName = getUserInput();
if (allowedFunctions.hasOwnProperty(functionName)) {
  allowedFunctions[functionName](); // Execute the function if it's in the whitelist
} else {
  console.error('Invalid function name');
}

Additional recommendations

  • Follow the principle of least privilege and only allow the minimum set of functions required for the application to function correctly.
  • Consider using a strict Content Security Policy (CSP) to prevent the execution of inline scripts and restrict the sources from which scripts can be loaded.
  • Implement input validation and sanitization to ensure that user input is properly validated and sanitized before being used in any security-sensitive operations.
  • Adhere to the OWASP Top 10 and other relevant security standards to mitigate common web application vulnerabilities.
  • Consider using a secure coding library or framework that provides built-in protection against code injection vulnerabilities.

Rule ID: WS-I013-JAVASCRIPT-00106

Comment thread plugins/llms-txt/index.js
const p = path.resolve(DOCS_DIR, `${id}${ext}`);
// Path-traversal guard (CWE-22): sidebar ids must stay inside docs/.
if (!p.startsWith(DOCS_DIR + path.sep)) return null;
if (fs.existsSync(p)) return p;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low SAST Finding

Improper Limitation of Pathname to Restricted Directory (Path Traversal) (CWE-22)

More Details

Path traversal vulnerabilities occur when user-supplied input is used to construct file paths without proper validation or sanitization. This allows an attacker to access files and directories outside the intended scope, potentially exposing sensitive data or enabling unauthorized system access.

The risk stems from the application's failure to properly restrict file operations to a limited directory. By manipulating the file path with special characters like "../", an attacker can traverse the file system hierarchy and access arbitrary files or directories.

Successful exploitation of a path traversal vulnerability can lead to data breaches, unauthorized access to system resources, and potentially complete system compromise. It is crucial to validate and sanitize all user input used in file operations to prevent such attacks.

Attribute Value
Impact Medium
Likelihood Low

Remediation

Path traversal vulnerabilities occur when user-supplied input is used to construct file paths without proper validation or sanitization. This allows an attacker to access files and directories outside the intended scope, potentially exposing sensitive data or enabling unauthorized system access. Successful exploitation of a path traversal vulnerability can lead to data breaches, unauthorized access to system resources, and potentially complete system compromise.

To fix this issue, you should validate and sanitize all user input used in file operations to prevent path traversal attacks. This can be achieved by using a secure path resolution library or by implementing strict input validation and sanitization routines. Avoid concatenating user input directly into file paths, and instead, use platform-specific path normalization functions to resolve paths safely.

Code examples

// VULNERABLE CODE - User input is concatenated directly into the file path
const fs = require('fs');
const userInput = "../../../sensitive.txt";
fs.readFile(`/app/files/${userInput}`, (err, data) => {
  // ...
});
// SECURE CODE - User input is sanitized, and path is resolved securely
const fs = require('fs');
const path = require('path');
const userInput = "../../../sensitive.txt";
const sanitizedPath = path.resolve('/app/files', path.normalize(userInput));
fs.readFile(sanitizedPath, (err, data) => {
  // ...
});

Additional recommendations

  • Use the built-in path module in Node.js to safely construct file paths.
  • Implement strict input validation and sanitization routines for all user input used in file operations.
  • Follow the principle of least privilege and restrict file operations to a limited directory scope.
  • Adhere to security best practices outlined in the OWASP Top 10 and CWE guidelines for handling user input and file operations.
  • Consider using a secure path resolution library like path-sanitizer or secure-path-resolve for additional protection against path traversal attacks.

Rule ID: WS-I011-TYPESCRIPT-00001

// robots.txt) carrying the Sitemap: hints. If one already exists, we only
// append the Sitemap: lines we're missing — idempotent, never clobbering.
function ensureRobotsSitemaps(outDir, sitemapUrls) {
const robotsPath = path.join(outDir, ROBOTS_FILE);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium SAST Finding

Path Traversal Vulnerability in Node.js (CWE-22)

More Details

This rule detects potential path traversal vulnerabilities in Node.js applications. Path traversal vulnerabilities occur when user input is passed unsanitized to file system operations, allowing attackers to access arbitrary files and directories on the server.

This issue presents a significant security risk as it can lead to unauthorized access to sensitive data, code execution, and complete system compromise. If exploited, an attacker could read confidential files, modify system files, or even execute malicious code on the server.

Attribute Value
Impact Medium
Likelihood Medium

Remediation

Path traversal vulnerabilities allow an attacker to access arbitrary files on the system, potentially exposing sensitive data or enabling further attacks. This vulnerability arises when user input is passed unsanitized to path manipulation functions like path.join or path.resolve, allowing an attacker to traverse the file system using patterns like ../.

To fix this issue, user input should be sanitized or validated before being passed to path manipulation functions. This can be done by using allowlists, removing or encoding special characters, or validating the resulting path against a set of allowed directories.

Code examples

// VULNERABLE CODE - User input is passed directly to path.join
const userInput = req.query.file;
const filePath = path.join(__dirname, userInput);
fs.readFile(filePath, (err, data) => { ... });
// SECURE CODE - User input is sanitized before path manipulation
const userInput = req.query.file;
const sanitizedInput = sanitizeInput(userInput); // Implement sanitization logic
const filePath = path.join(__dirname, sanitizedInput);
fs.readFile(filePath, (err, data) => { ... });

Additional recommendations

  • Follow the principle of least privilege and restrict file access as much as possible.
  • Use allowlists instead of denylist-based input validation when possible.
  • Consider using libraries like path-sanitizer or sanitize-filename for input sanitization.
  • Adhere to the OWASP Input Validation Cheat Sheet and other relevant security standards.
  • As an alternative approach, consider using a virtual file system or sandboxing techniques to isolate file operations from the main system.

Rule ID: WS-I013-JAVASCRIPT-00098


// Path-traversal guard (CWE-22): `rel` derives from frontmatter slugs;
// never write a mirror outside the build output directory.
const outPath = path.resolve(outDir, rel);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium SAST Finding

Path Traversal Vulnerability in Node.js (CWE-22)

More Details

This rule detects potential path traversal vulnerabilities in Node.js applications. Path traversal vulnerabilities occur when user input is passed unsanitized to file system operations, allowing attackers to access arbitrary files and directories on the server.

This issue presents a significant security risk as it can lead to unauthorized access to sensitive data, code execution, and complete system compromise. If exploited, an attacker could read confidential files, modify system files, or even execute malicious code on the server.

Attribute Value
Impact Medium
Likelihood Medium

Remediation

Path traversal vulnerabilities allow an attacker to access arbitrary files on the system, potentially exposing sensitive data or enabling further attacks. This vulnerability arises when user input is passed unsanitized to path manipulation functions like path.join or path.resolve, allowing an attacker to traverse the file system using patterns like ../.

To fix this issue, user input should be sanitized or validated before being passed to path manipulation functions. This can be done by using allowlists, removing or encoding special characters, or validating the resulting path against a set of allowed directories.

Code examples

// VULNERABLE CODE - User input is passed directly to path.join
const userInput = req.query.file;
const filePath = path.join(__dirname, userInput);
fs.readFile(filePath, (err, data) => { ... });
// SECURE CODE - User input is sanitized before path manipulation
const userInput = req.query.file;
const sanitizedInput = sanitizeInput(userInput); // Implement sanitization logic
const filePath = path.join(__dirname, sanitizedInput);
fs.readFile(filePath, (err, data) => { ... });

Additional recommendations

  • Follow the principle of least privilege and restrict file access as much as possible.
  • Use allowlists instead of denylist-based input validation when possible.
  • Consider using libraries like path-sanitizer or sanitize-filename for input sanitization.
  • Adhere to the OWASP Input Validation Cheat Sheet and other relevant security standards.
  • As an alternative approach, consider using a virtual file system or sandboxing techniques to isolate file operations from the main system.

Rule ID: WS-I013-JAVASCRIPT-00098

// Path-traversal guard (CWE-22): `rel` derives from frontmatter slugs;
// never write a mirror outside the build output directory.
const outPath = path.resolve(outDir, rel);
if (!outPath.startsWith(path.resolve(outDir) + path.sep)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium SAST Finding

Path Traversal Vulnerability in Node.js (CWE-22)

More Details

This rule detects potential path traversal vulnerabilities in Node.js applications. Path traversal vulnerabilities occur when user input is passed unsanitized to file system operations, allowing attackers to access arbitrary files and directories on the server.

This issue presents a significant security risk as it can lead to unauthorized access to sensitive data, code execution, and complete system compromise. If exploited, an attacker could read confidential files, modify system files, or even execute malicious code on the server.

Attribute Value
Impact Medium
Likelihood Medium

Remediation

Path traversal vulnerabilities allow an attacker to access arbitrary files on the system, potentially exposing sensitive data or enabling further attacks. This vulnerability arises when user input is passed unsanitized to path manipulation functions like path.join or path.resolve, allowing an attacker to traverse the file system using patterns like ../.

To fix this issue, user input should be sanitized or validated before being passed to path manipulation functions. This can be done by using allowlists, removing or encoding special characters, or validating the resulting path against a set of allowed directories.

Code examples

// VULNERABLE CODE - User input is passed directly to path.join
const userInput = req.query.file;
const filePath = path.join(__dirname, userInput);
fs.readFile(filePath, (err, data) => { ... });
// SECURE CODE - User input is sanitized before path manipulation
const userInput = req.query.file;
const sanitizedInput = sanitizeInput(userInput); // Implement sanitization logic
const filePath = path.join(__dirname, sanitizedInput);
fs.readFile(filePath, (err, data) => { ... });

Additional recommendations

  • Follow the principle of least privilege and restrict file access as much as possible.
  • Use allowlists instead of denylist-based input validation when possible.
  • Consider using libraries like path-sanitizer or sanitize-filename for input sanitization.
  • Adhere to the OWASP Input Validation Cheat Sheet and other relevant security standards.
  • As an alternative approach, consider using a virtual file system or sandboxing techniques to isolate file operations from the main system.

Rule ID: WS-I013-JAVASCRIPT-00098

return matter.stringify("", data).trimEnd();
}

const defaultReadFile = (p) => fs.readFileSync(p, "utf8");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low SAST Finding

Improper Limitation of Pathname to Restricted Directory (Path Traversal) (CWE-22)

More Details

Path traversal vulnerabilities occur when user-supplied input is used to construct file paths without proper validation or sanitization. This allows an attacker to access files and directories outside the intended scope, potentially exposing sensitive data or enabling unauthorized system access.

The risk stems from the application's failure to properly restrict file operations to a limited directory. By manipulating the file path with special characters like "../", an attacker can traverse the file system hierarchy and access arbitrary files or directories.

Successful exploitation of a path traversal vulnerability can lead to data breaches, unauthorized access to system resources, and potentially complete system compromise. It is crucial to validate and sanitize all user input used in file operations to prevent such attacks.

Attribute Value
Impact Medium
Likelihood Low

Remediation

Path traversal vulnerabilities occur when user-supplied input is used to construct file paths without proper validation or sanitization. This allows an attacker to access files and directories outside the intended scope, potentially exposing sensitive data or enabling unauthorized system access. Successful exploitation of a path traversal vulnerability can lead to data breaches, unauthorized access to system resources, and potentially complete system compromise.

To fix this issue, you should validate and sanitize all user input used in file operations to prevent path traversal attacks. This can be achieved by using a secure path resolution library or by implementing strict input validation and sanitization routines. Avoid concatenating user input directly into file paths, and instead, use platform-specific path normalization functions to resolve paths safely.

Code examples

// VULNERABLE CODE - User input is concatenated directly into the file path
const fs = require('fs');
const userInput = "../../../sensitive.txt";
fs.readFile(`/app/files/${userInput}`, (err, data) => {
  // ...
});
// SECURE CODE - User input is sanitized, and path is resolved securely
const fs = require('fs');
const path = require('path');
const userInput = "../../../sensitive.txt";
const sanitizedPath = path.resolve('/app/files', path.normalize(userInput));
fs.readFile(sanitizedPath, (err, data) => {
  // ...
});

Additional recommendations

  • Use the built-in path module in Node.js to safely construct file paths.
  • Implement strict input validation and sanitization routines for all user input used in file operations.
  • Follow the principle of least privilege and restrict file operations to a limited directory scope.
  • Adhere to security best practices outlined in the OWASP Top 10 and CWE guidelines for handling user input and file operations.
  • Consider using a secure path resolution library like path-sanitizer or secure-path-resolve for additional protection against path traversal attacks.

Rule ID: WS-I011-TYPESCRIPT-00001


it("emits many mirrors across the corpus", () => {
const count = (dir) =>
fs.readdirSync(dir, { withFileTypes: true }).reduce((n, e) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low SAST Finding

Improper Limitation of Pathname to Restricted Directory (Path Traversal) (CWE-22)

More Details

Path traversal vulnerabilities occur when user-supplied input is used to construct file paths without proper validation or sanitization. This allows an attacker to access files and directories outside the intended scope, potentially exposing sensitive data or enabling unauthorized system access.

The risk stems from the application's failure to properly restrict file operations to a limited directory. By manipulating the file path with special characters like "../", an attacker can traverse the file system hierarchy and access arbitrary files or directories.

Successful exploitation of a path traversal vulnerability can lead to data breaches, unauthorized access to system resources, and potentially complete system compromise. It is crucial to validate and sanitize all user input used in file operations to prevent such attacks.

Attribute Value
Impact Medium
Likelihood Low

Remediation

Path traversal vulnerabilities occur when user-supplied input is used to construct file paths without proper validation or sanitization. This allows an attacker to access files and directories outside the intended scope, potentially exposing sensitive data or enabling unauthorized system access. Successful exploitation of a path traversal vulnerability can lead to data breaches, unauthorized access to system resources, and potentially complete system compromise.

To fix this issue, you should validate and sanitize all user input used in file operations to prevent path traversal attacks. This can be achieved by using a secure path resolution library or by implementing strict input validation and sanitization routines. Avoid concatenating user input directly into file paths, and instead, use platform-specific path normalization functions to resolve paths safely.

Code examples

// VULNERABLE CODE - User input is concatenated directly into the file path
const fs = require('fs');
const userInput = "../../../sensitive.txt";
fs.readFile(`/app/files/${userInput}`, (err, data) => {
  // ...
});
// SECURE CODE - User input is sanitized, and path is resolved securely
const fs = require('fs');
const path = require('path');
const userInput = "../../../sensitive.txt";
const sanitizedPath = path.resolve('/app/files', path.normalize(userInput));
fs.readFile(sanitizedPath, (err, data) => {
  // ...
});

Additional recommendations

  • Use the built-in path module in Node.js to safely construct file paths.
  • Implement strict input validation and sanitization routines for all user input used in file operations.
  • Follow the principle of least privilege and restrict file operations to a limited directory scope.
  • Adhere to security best practices outlined in the OWASP Top 10 and CWE guidelines for handling user input and file operations.
  • Consider using a secure path resolution library like path-sanitizer or secure-path-resolve for additional protection against path traversal attacks.

Rule ID: WS-I011-TYPESCRIPT-00001

Comment thread plugins/ia-rail-meta/index.js Outdated
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
// Docusaurus excludes `_`-prefixed files/dirs from routing (partials).
if (entry.name.startsWith("_")) continue;
const full = path.join(dir, entry.name);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium SAST Finding

Path Traversal Vulnerability in Node.js (CWE-22)

More Details

This rule detects potential path traversal vulnerabilities in Node.js applications. Path traversal vulnerabilities occur when user input is passed unsanitized to file system operations, allowing attackers to access arbitrary files and directories on the server.

This issue presents a significant security risk as it can lead to unauthorized access to sensitive data, code execution, and complete system compromise. If exploited, an attacker could read confidential files, modify system files, or even execute malicious code on the server.

Attribute Value
Impact Medium
Likelihood Medium

Remediation

Path traversal vulnerabilities allow an attacker to access arbitrary files on the system, potentially exposing sensitive data or enabling further attacks. This vulnerability arises when user input is passed unsanitized to path manipulation functions like path.join or path.resolve, allowing an attacker to traverse the file system using patterns like ../.

To fix this issue, user input should be sanitized or validated before being passed to path manipulation functions. This can be done by using allowlists, removing or encoding special characters, or validating the resulting path against a set of allowed directories.

Code examples

// VULNERABLE CODE - User input is passed directly to path.join
const userInput = req.query.file;
const filePath = path.join(__dirname, userInput);
fs.readFile(filePath, (err, data) => { ... });
// SECURE CODE - User input is sanitized before path manipulation
const userInput = req.query.file;
const sanitizedInput = sanitizeInput(userInput); // Implement sanitization logic
const filePath = path.join(__dirname, sanitizedInput);
fs.readFile(filePath, (err, data) => { ... });

Additional recommendations

  • Follow the principle of least privilege and restrict file access as much as possible.
  • Use allowlists instead of denylist-based input validation when possible.
  • Consider using libraries like path-sanitizer or sanitize-filename for input sanitization.
  • Adhere to the OWASP Input Validation Cheat Sheet and other relevant security standards.
  • As an alternative approach, consider using a virtual file system or sandboxing techniques to isolate file operations from the main system.

Rule ID: WS-I013-JAVASCRIPT-00098

Comment thread plugins/ia-rail-meta/index.js Outdated
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
// Docusaurus excludes `_`-prefixed files/dirs from routing (partials).
if (entry.name.startsWith("_")) continue;
const full = path.join(dir, entry.name);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium SAST Finding

Path Traversal Vulnerability in Node.js (CWE-22)

More Details

This rule detects potential path traversal vulnerabilities in Node.js applications. Path traversal vulnerabilities occur when user input is passed unsanitized to file system operations, allowing attackers to access arbitrary files and directories on the server.

This issue presents a significant security risk as it can lead to unauthorized access to sensitive data, code execution, and complete system compromise. If exploited, an attacker could read confidential files, modify system files, or even execute malicious code on the server.

Attribute Value
Impact Medium
Likelihood Medium

Remediation

Path traversal vulnerabilities allow an attacker to access arbitrary files on the system, potentially exposing sensitive data or enabling further attacks. This vulnerability arises when user input is passed unsanitized to path manipulation functions like path.join or path.resolve, allowing an attacker to traverse the file system using patterns like ../.

To fix this issue, user input should be sanitized or validated before being passed to path manipulation functions. This can be done by using allowlists, removing or encoding special characters, or validating the resulting path against a set of allowed directories.

Code examples

// VULNERABLE CODE - User input is passed directly to path.join
const userInput = req.query.file;
const filePath = path.join(__dirname, userInput);
fs.readFile(filePath, (err, data) => { ... });
// SECURE CODE - User input is sanitized before path manipulation
const userInput = req.query.file;
const sanitizedInput = sanitizeInput(userInput); // Implement sanitization logic
const filePath = path.join(__dirname, sanitizedInput);
fs.readFile(filePath, (err, data) => { ... });

Additional recommendations

  • Follow the principle of least privilege and restrict file access as much as possible.
  • Use allowlists instead of denylist-based input validation when possible.
  • Consider using libraries like path-sanitizer or sanitize-filename for input sanitization.
  • Adhere to the OWASP Input Validation Cheat Sheet and other relevant security standards.
  • As an alternative approach, consider using a virtual file system or sandboxing techniques to isolate file operations from the main system.

Rule ID: WS-I013-JAVASCRIPT-00098

…arts at 1, SupportingDocumentCollection.Updated webhook, AccountHolderProjectSettingsNotEligibleRejection, accountId and conditional consentRedirectUrl, projectInfo scope
…n's voice, plainer connectives, emoji-free tab labels
…ejection, consent ordering semantics, exportUserData filters, addDigitalCards, retired idVerified and Authenticator.type, S2S consents query
…n-up confirmation step, deduplicated consent notification facts, placeholder-only Dashboard deactivation
Comment thread package.json
"react-dom": "^18.2.0"
},
"devDependencies": {
"vitest": "3.2.7"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium Vulnerability Finding

The following vulnerability impacts vitest versions <4.1.11: CVE-2026-84373.

It can be remediated by updating to version 4.1.11 or higher.

Suggested change
"vitest": "3.2.7"
"vitest": "4.1.11"

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.

1 participant