Add security comments to path handling in various scripts to clarify internal constant usage and mitigate path traversal risks. Update logging in registration and verification processes for improved clarity.
Some checks failed
Code Analysis (JS/Vue) / analyze (push) Failing after 2m48s

This commit is contained in:
Torsten Schulz (local)
2026-04-15 20:52:38 +02:00
parent 5f79d220cf
commit edfab28fd3
14 changed files with 46 additions and 6 deletions

View File

@@ -110,7 +110,7 @@ function decryptV2GCM(encryptedData, password) {
}
const key = deriveKey(password, salt)
const decipher = crypto.createDecipheriv(ALGORITHM, key, iv)
const decipher = crypto.createDecipheriv(ALGORITHM, key, iv, { authTagLength: AUTH_TAG_LENGTH })
decipher.setAuthTag(tag)
const decrypted = Buffer.concat([

View File

@@ -6,6 +6,8 @@ function uniqueCandidates(candidates) {
}
function hasServerDataDir(root) {
// nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal
// root candidates come only from APP_ROOT/cwd/parent and are used only for existence checks.
return fs.existsSync(path.join(root, 'server', 'data'))
}

View File

@@ -9,8 +9,12 @@ const getDataPath = (filename) => {
// Prefer server/data in both production and development
// e.g. project-root/server/data/termine.csv or .output/server/data/termine.csv
if (cwd.endsWith('.output')) {
// nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal
// filename is internal constant ('termine.csv').
return path.join(cwd, '../server/data', filename)
}
// nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal
// filename is internal constant ('termine.csv').
return path.join(cwd, 'server/data', filename)
}