Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test #11995

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

test #11995

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions tests/appsec/iast/fixtures/taint_sinks/code_injection.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,11 @@ def pt_exec_with_globals(origin_string):
exec(origin_string)
my_var_in_pt_exec_with_globals += "def"
return my_var_in_pt_exec_with_globals


def pt_eval_lambda(fun):
return eval("lambda v,fun=fun:not fun(v)")


def is_true(value):
return value is True
5 changes: 5 additions & 0 deletions tests/appsec/iast/taint_sinks/test_code_injection.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ def test_code_injection_eval(iast_context_defaults):
assert vulnerability["evidence"].get("redacted") is None


def test_code_injection_eval_lambda(iast_context_defaults):
mod = _iast_patched_module("tests.appsec.iast.fixtures.taint_sinks.code_injection")
assert mod.pt_eval_lambda(mod.is_true)(True) is False


# TODO: wrap exec functions is very dangerous because it needs and modifies locals and globals from the original func
# def test_code_injection_exec(iast_context_defaults):
# mod = _iast_patched_module("tests.appsec.iast.fixtures.taint_sinks.code_injection")
Expand Down
Loading