Files
codeql/javascript/ql/lib/semmle/javascript/frameworks/TorrentLibraries.qll
2022-02-16 11:47:08 +00:00

43 lines
1.1 KiB
Plaintext

/**
* Provides classes for modeling Torrent libraries.
*/
import javascript
/**
* Provides classes for working with [parse-torrent](https://github.com/webtorrent/parse-torrent) code.
*/
module ParseTorrent {
private API::Node mod() { result = API::moduleImport("parse-torrent") }
/**
* A torrent that has been parsed into a JavaScript object.
*/
class ParsedTorrent extends DataFlow::SourceNode {
API::Node node;
ParsedTorrent() {
(
node = mod().getReturn() or
node = mod().getMember("remote").getParameter(1).getParameter(1)
) and
this = node.getAnImmediateUse()
}
/** Gets the API node for this torrent object. */
API::Node asApiNode() { result = node }
}
/** Gets a data flow node referring to a parsed torrent. */
DataFlow::SourceNode parsedTorrentRef() { result = any(ParsedTorrent t).asApiNode().getAUse() }
/**
* An access to user-controlled torrent information.
*/
class UserControlledTorrentInfo extends RemoteFlowSource {
UserControlledTorrentInfo() { none() }
override string getSourceType() { result = "torrent information" }
}
}