|
| 1 | +/** |
| 2 | + * Provides classes modeling security-relevant aspects of the `idna` PyPI package. |
| 3 | + * See https://pypi.org/project/idna/. |
| 4 | + */ |
| 5 | + |
| 6 | +private import python |
| 7 | +private import semmle.python.dataflow.new.DataFlow |
| 8 | +private import semmle.python.dataflow.new.TaintTracking |
| 9 | +private import semmle.python.Concepts |
| 10 | +private import semmle.python.ApiGraphs |
| 11 | + |
| 12 | +/** |
| 13 | + * Provides models for the `idna` PyPI package. |
| 14 | + * See https://pypi.org/project/idna/. |
| 15 | + */ |
| 16 | +private module IdnaModel { |
| 17 | + /** A call to `idna.encode`. */ |
| 18 | + private class IdnaEncodeCall extends Encoding::Range, DataFlow::CallCfgNode { |
| 19 | + IdnaEncodeCall() { this = API::moduleImport("idna").getMember("encode").getACall() } |
| 20 | + |
| 21 | + override DataFlow::Node getAnInput() { result = [this.getArg(0), this.getArgByName("s")] } |
| 22 | + |
| 23 | + override DataFlow::Node getOutput() { result = this } |
| 24 | + |
| 25 | + override string getFormat() { result = "IDNA" } |
| 26 | + } |
| 27 | + |
| 28 | + /** A call to `idna.decode`. */ |
| 29 | + private class IdnaDecodeCall extends Decoding::Range, DataFlow::CallCfgNode { |
| 30 | + IdnaDecodeCall() { this = API::moduleImport("idna").getMember("decode").getACall() } |
| 31 | + |
| 32 | + override DataFlow::Node getAnInput() { result = [this.getArg(0), this.getArgByName("s")] } |
| 33 | + |
| 34 | + override DataFlow::Node getOutput() { result = this } |
| 35 | + |
| 36 | + override string getFormat() { result = "IDNA" } |
| 37 | + |
| 38 | + override predicate mayExecuteInput() { none() } |
| 39 | + } |
| 40 | +} |
0 commit comments