Files
codeql/python/ql/src/Expressions/UseofInput.ql
2025-04-30 16:47:35 +01:00

26 lines
714 B
Plaintext

/**
* @name 'input' function used in Python 2
* @description The built-in function 'input' is used which, in Python 2, can allow arbitrary code to be run.
* @kind problem
* @tags security
* correctness
* external/cwe/cwe-094
* external/cwe/cwe-095
* @problem.severity error
* @security-severity 9.8
* @sub-severity high
* @precision high
* @id py/use-of-input
*/
import python
import semmle.python.dataflow.new.DataFlow
import semmle.python.ApiGraphs
from DataFlow::CallCfgNode call
where
major_version() = 2 and
call = API::builtin("input").getACall() and
call != API::builtin("raw_input").getACall()
select call, "The unsafe built-in function 'input' is used in Python 2."