Skip to content

Conversation

erik-krogh
Copy link
Contributor

Recognize the following prefix check for js/path-injection.

app.get('/yet-another-prefix', (req, res) => {
	let path = pathModule.resolve(req.query.path);

	fs.readFileSync(path); // NOT OK

	var abs = pathModule.resolve(path); 

	if (abs.indexOf(root) !== 0) {
		fs.readFileSync(path); // NOT OK
		return;
	}
	fs.readFileSync(path); // OK - previously FP. 
});

@erik-krogh erik-krogh added JS Awaiting evaluation Do not merge yet, this PR is waiting for an evaluation to finish labels Feb 28, 2020
@erik-krogh erik-krogh requested a review from a team as a code owner February 28, 2020 14:04
@erik-krogh
Copy link
Contributor Author

An evaluation was entirely uneventful.

@semmle-qlci semmle-qlci merged commit 228bd73 into github:master Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting evaluation Do not merge yet, this PR is waiting for an evaluation to finish JS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants