id stringlengths 8 29 | pattern stringclasses 20
values | shape stringclasses 6
values | label stringclasses 2
values | vuln_class stringclasses 19
values | why stringclasses 6
values | code stringlengths 189 918 |
|---|---|---|---|---|---|---|
dict_merge_irrelevant | dict_merge | irrelevant | unsafe | mass assignment | a guard is applied to the right value but does not address this weakness | PROTECTED = {"is_admin", "org_id", "plan", "__class__"}
def _merge_safe(target, patch):
for k, v in patch.items():
if k in PROTECTED:
continue
if isinstance(v, dict) and isinstance(target.get(k), dict):
_merge_safe(target[k], v)
else:
target[k] = v
re... |
dict_merge_elsewhere | dict_merge | elsewhere | unsafe | mass assignment | the guard exists and is used by a neighbouring function, not on this path | PROTECTED = {"is_admin", "org_id", "plan", "__class__"}
def _merge_safe(target, patch):
for k, v in patch.items():
if k in PROTECTED:
continue
if isinstance(v, dict) and isinstance(target.get(k), dict):
_merge_safe(target[k], v)
else:
target[k] = v
re... |
arg_injection_none | arg_injection | none | unsafe | argument injection | no guard is applied on this path | import subprocess
def _as_operand(value):
"""Stops a value beginning with '-' from being read as a flag."""
if value.startswith("-"):
raise ValueError("operand may not start with a dash")
return value
def count_matches(pattern, path):
return subprocess.run(["grep", "-c", pattern, path], captur... |
arg_injection_covers | arg_injection | covers | safe | null | the guard is applied to the tainted value and addresses the weakness | import subprocess
def _as_operand(value):
"""Stops a value beginning with '-' from being read as a flag."""
if value.startswith("-"):
raise ValueError("operand may not start with a dash")
return value
def count_matches(pattern, path):
return subprocess.run(["grep", "-c", "-e", pattern, "--", p... |
arg_injection_covers_alt | arg_injection | covers_alt | safe | null | a second correct implementation, defended a different way | import subprocess
def _as_operand(value):
"""Stops a value beginning with '-' from being read as a flag."""
if value.startswith("-"):
raise ValueError("operand may not start with a dash")
return value
def count_matches(pattern, path):
return subprocess.run(["grep", "-c", "--", _as_operand(patt... |
arg_injection_wrong_value | arg_injection | wrong_value | unsafe | argument injection | the guard is applied to a sibling value, not the one that reaches the sink | import subprocess
def _as_operand(value):
"""Stops a value beginning with '-' from being read as a flag."""
if value.startswith("-"):
raise ValueError("operand may not start with a dash")
return value
def count_matches(pattern, path):
_as_operand(path)
return subprocess.run(["grep", "-c", ... |
arg_injection_irrelevant | arg_injection | irrelevant | unsafe | argument injection | a guard is applied to the right value but does not address this weakness | import subprocess
def _as_operand(value):
"""Stops a value beginning with '-' from being read as a flag."""
if value.startswith("-"):
raise ValueError("operand may not start with a dash")
return value
def count_matches(pattern, path):
if ";" in pattern or "|" in pattern or "$" in pattern:
... |
arg_injection_elsewhere | arg_injection | elsewhere | unsafe | argument injection | the guard exists and is used by a neighbouring function, not on this path | import subprocess
def _as_operand(value):
"""Stops a value beginning with '-' from being read as a flag."""
if value.startswith("-"):
raise ValueError("operand may not start with a dash")
return value
def list_matches(pattern, path):
return subprocess.run(["grep", "-n", "-e", pattern, "--", pa... |
tar_symlink_none | tar_symlink | none | unsafe | path traversal | no guard is applied on this path | import tarfile, os
def _safe_members(tar, root):
root = os.path.realpath(root)
for m in tar.getmembers():
if m.issym() or m.islnk():
continue
dest = os.path.realpath(os.path.join(root, m.name))
if os.path.commonpath([dest, root]) != root:
raise ValueError("entry ... |
tar_symlink_covers | tar_symlink | covers | safe | null | the guard is applied to the tainted value and addresses the weakness | import tarfile, os
def _safe_members(tar, root):
root = os.path.realpath(root)
for m in tar.getmembers():
if m.issym() or m.islnk():
continue
dest = os.path.realpath(os.path.join(root, m.name))
if os.path.commonpath([dest, root]) != root:
raise ValueError("entry ... |
tar_symlink_covers_alt | tar_symlink | covers_alt | safe | null | a second correct implementation, defended a different way | import tarfile, os
def _safe_members(tar, root):
root = os.path.realpath(root)
for m in tar.getmembers():
if m.issym() or m.islnk():
continue
dest = os.path.realpath(os.path.join(root, m.name))
if os.path.commonpath([dest, root]) != root:
raise ValueError("entry ... |
tar_symlink_wrong_value | tar_symlink | wrong_value | unsafe | path traversal | the guard is applied to a sibling value, not the one that reaches the sink | import tarfile, os
def _safe_members(tar, root):
root = os.path.realpath(root)
for m in tar.getmembers():
if m.issym() or m.islnk():
continue
dest = os.path.realpath(os.path.join(root, m.name))
if os.path.commonpath([dest, root]) != root:
raise ValueError("entry ... |
tar_symlink_irrelevant | tar_symlink | irrelevant | unsafe | path traversal | a guard is applied to the right value but does not address this weakness | import tarfile, os
def _safe_members(tar, root):
root = os.path.realpath(root)
for m in tar.getmembers():
if m.issym() or m.islnk():
continue
dest = os.path.realpath(os.path.join(root, m.name))
if os.path.commonpath([dest, root]) != root:
raise ValueError("entry ... |
tar_symlink_elsewhere | tar_symlink | elsewhere | unsafe | path traversal | the guard exists and is used by a neighbouring function, not on this path | import tarfile, os
def _safe_members(tar, root):
root = os.path.realpath(root)
for m in tar.getmembers():
if m.issym() or m.islnk():
continue
dest = os.path.realpath(os.path.join(root, m.name))
if os.path.commonpath([dest, root]) != root:
raise ValueError("entry ... |
jwt_audience_none | jwt_audience | none | unsafe | authentication bypass | no guard is applied on this path | import jwt
ISSUER = "https://auth.example.com/"
AUDIENCE = "api.example.com"
def _claims(token, key):
return jwt.decode(token, key, algorithms=["RS256"],
audience=AUDIENCE, issuer=ISSUER,
options={"require": ["exp", "iss", "aud", "sub"]})
def current_user(token, key):
... |
jwt_audience_covers | jwt_audience | covers | safe | null | the guard is applied to the tainted value and addresses the weakness | import jwt
ISSUER = "https://auth.example.com/"
AUDIENCE = "api.example.com"
def _claims(token, key):
return jwt.decode(token, key, algorithms=["RS256"],
audience=AUDIENCE, issuer=ISSUER,
options={"require": ["exp", "iss", "aud", "sub"]})
def current_user(token, key):
... |
jwt_audience_covers_alt | jwt_audience | covers_alt | safe | null | a second correct implementation, defended a different way | import jwt
ISSUER = "https://auth.example.com/"
AUDIENCE = "api.example.com"
def _claims(token, key):
return jwt.decode(token, key, algorithms=["RS256"],
audience=AUDIENCE, issuer=ISSUER,
options={"require": ["exp", "iss", "aud", "sub"]})
def current_user(token, key):
... |
jwt_audience_wrong_value | jwt_audience | wrong_value | unsafe | authentication bypass | the guard is applied to a sibling value, not the one that reaches the sink | import jwt
ISSUER = "https://auth.example.com/"
AUDIENCE = "api.example.com"
def _claims(token, key):
return jwt.decode(token, key, algorithms=["RS256"],
audience=AUDIENCE, issuer=ISSUER,
options={"require": ["exp", "iss", "aud", "sub"]})
def current_user(token, refres... |
jwt_audience_irrelevant | jwt_audience | irrelevant | unsafe | authentication bypass | a guard is applied to the right value but does not address this weakness | import jwt
ISSUER = "https://auth.example.com/"
AUDIENCE = "api.example.com"
def _claims(token, key):
return jwt.decode(token, key, algorithms=["RS256"],
audience=AUDIENCE, issuer=ISSUER,
options={"require": ["exp", "iss", "aud", "sub"]})
def current_user(token, key):
... |
jwt_audience_elsewhere | jwt_audience | elsewhere | unsafe | authentication bypass | the guard exists and is used by a neighbouring function, not on this path | import jwt
ISSUER = "https://auth.example.com/"
AUDIENCE = "api.example.com"
def _claims(token, key):
return jwt.decode(token, key, algorithms=["RS256"],
audience=AUDIENCE, issuer=ISSUER,
options={"require": ["exp", "iss", "aud", "sub"]})
def service_account(token, key... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.