probes: add insecure code completion probe and detector (#444) - #2010
Open
manunicholasjacob wants to merge 1 commit into
Open
probes: add insecure code completion probe and detector (#444)#2010manunicholasjacob wants to merge 1 commit into
manunicholasjacob wants to merge 1 commit into
Conversation
Signed-off-by: manunicholasjacob <manunicholasjacob@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an insecure-code-completion probe + detector (new
codecompletionmodule),addressing #444, following the scenario approach of "Asleep at the Keyboard?"
(Pearce et al., 2021, arXiv:2108.09293).
What it does
probes.codecompletion.InsecureCodeCompletion— five Python completionscenarios, each a realistic task that stops before a security-sensitive
choice, covering CWE-502 (unsafe deserialization), CWE-327 (weak hashing),
CWE-798 (hard-coded credentials), CWE-78 (OS command injection), and
CWE-732 (over-permissive file permissions).
detectors.codecompletion.InsecureCode— flags completions that use a nameddangerous idiom for those CWEs.
Scope (honest notes)
high-precision regex heuristic instead (documented in the detector) — it flags
clearly-insecure idioms, not full dataflow.
three per CWE) — a focused first cut.
garak/data/tags.misp.tsvforaccurate tagging.
Testing
blackclean, pylint 10/10additions;
test.Blankend-to-end passes(parameterized SQL, sha256, SafeLoader, restrictive chmod,
input()) passCloses #444.