Skip to content

Commit ef0ec39

Browse files
authored
Merge pull request #9754 from erik-krogh/chownr
JS: add model for chownr
2 parents 08b1c54 + eaec1ac commit ef0ec39

File tree

5 files changed

+223
-2
lines changed

5 files changed

+223
-2
lines changed

javascript/externs/nodejs/fs.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1696,4 +1696,3 @@ module.exports.R_OK = fs.R_OK;
16961696
module.exports.W_OK = fs.W_OK;
16971697

16981698
module.exports.X_OK = fs.X_OK;
1699-
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: minorAnalysis
3+
---
4+
* The `chownr` library is now modeled as a sink for the `js/path-injection` query.

javascript/ql/lib/semmle/javascript/frameworks/Files.qll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,18 @@ private class WriteFileAtomic extends FileSystemWriteAccess, DataFlow::CallNode
192192
override DataFlow::Node getADataNode() { result = this.getArgument(1) }
193193
}
194194

195+
/**
196+
* A call to the library `chownr`.
197+
* The library changes the owner of a file or directory recursively.
198+
*/
199+
private class Chownr extends FileSystemWriteAccess, DataFlow::CallNode {
200+
Chownr() { this = DataFlow::moduleImport("chownr").getACall() }
201+
202+
override DataFlow::Node getAPathArgument() { result = this.getArgument(0) }
203+
204+
override DataFlow::Node getADataNode() { none() }
205+
}
206+
195207
/**
196208
* A call to the library `recursive-readdir`.
197209
*/

0 commit comments

Comments
 (0)