feat(routes): add product packaging leaflet (rerun) - #23
ogulcan-gurcaglar wants to merge 2 commits into
Conversation
|
❌ 1 possible security or compliance issue detected. Reviewed everything up to 8942e5c. The following issues were found:
Evidence:
Security Overview
Detected Code Changes
|
| module.exports = function productLeaflet () { | ||
| return (req: Request, res: Response, next: NextFunction) => { | ||
| const leaflet = req.query.leaflet ?? 'default.md' | ||
| fs.readFile(path.join('ftp/leaflets', String(leaflet)), 'utf8', (error, text) => { |
There was a problem hiding this comment.
Path Traversal in /rest/products/leaflet (routes/productLeaflet.ts) (Severity: HIGH)
An unauthenticated request to /rest/products/leaflet can read arbitrary files. This occurs because leaflet is concatenated directly to a path under ftp/leaflets via path.join and fs.readFile, which allows traversal like ../../package.json, potentially exposing secrets. The route in server.ts:572 is mounted without auth, and routes/productLeaflet.ts:13-14 uses the attacker-controlled parameter to form the filesystem path, resulting in unintended file access.
View details in ZeroPath
| fs.readFile(path.join('ftp/leaflets', String(leaflet)), 'utf8', (error, text) => { | |
| fs.readFile(path.join('ftp/leaflets', path.basename(String(leaflet))), 'utf8', (error, text) => { |
💬 Reply @ZeroPath false-positive because … or @ZeroPath accepted-risk because … to triage this finding, or ask it any question.
|
❌ 1 possible security or compliance issue detected. Reviewed everything up to 8942e5c. The following issues were found:
Evidence:
Security Overview
Detected Code Changes
|
| module.exports = function productLeaflet () { | ||
| return (req: Request, res: Response, next: NextFunction) => { | ||
| const leaflet = req.query.leaflet ?? 'default.md' | ||
| fs.readFile(path.join('ftp/leaflets', String(leaflet)), 'utf8', (error, text) => { |
There was a problem hiding this comment.
Path Traversal in /rest/products/leaflet (routes/productLeaflet.ts) (Severity: HIGH)
Path traversal vulnerability: an unauthenticated request to /rest/products/leaflet with a attacker-controlled leaflet parameter leads to arbitrary file reads. The code uses req.query.leaflet directly and feeds it into path.join('ftp/leaflets', leaflet) which causes the server to escape the intended directory and read arbitrary files, resulting in exposure of source, configs, secrets, or other sensitive content.
View details in ZeroPath
| fs.readFile(path.join('ftp/leaflets', String(leaflet)), 'utf8', (error, text) => { | |
| fs.readFile(path.join('ftp/leaflets', path.basename(String(leaflet))), 'utf8', (error, text) => { |
💬 Reply @ZeroPath false-positive because … or @ZeroPath accepted-risk because … to triage this finding, or ask it any question.
Controlled re-run: tree is byte-identical to the pre-deploy probe branch, so discovery prompts hit the AI cache and only the confirmation stage differs.