Repository navigation
Add insecure TLS, unsafe XML, archive extraction, mktemp and weak random rules - #90
Merged
Merged
Conversation
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
Syntactic-rules item of #70: five cheap checks in the spirit of
dangerous-eval.test: define five syntactic rules), implementation follows.SymbolCallDetectorgains two abilities the new rules need: a subclass that also requires the call graph sees derived call-chain symbols (tarfile.open(p).extractallistarfile.open.extractall), and anacceptshook keeps only some calls, such as those with a given keyword. Existing detectors are unchanged.insecure-tls:verify=Falseon a Requests or httpx call, orssl._create_unverified_context(); high severity.unsafe-xml: the standard-library and lxml XML parsers, which expand entities;defusedxmlis the replacement.unsafe-archive-extraction:tarfileandzipfileextraction andshutil.unpack_archive; a tarfile call with afilterkeyword is safe.insecure-temp-file:tempfile.mktemp.weak-random: arandomfunction whose result is assigned to a credential-like name (token,session_id,otp...) or produced by a function named like one; medium confidence, sorandom.shuffle(cards)stays silent.make_parser/parseStringon the request body) and its OTP drawn fromrandint, httpie'sverify=Falseon its update check, luigi's Salesforce responses parsed withElementTreeand its tar extractions, yt-fts's XML parsing of a remote feed. Nothing disappears; 35 bundled plugins, documented in the usage guide.Part of #70.