Repository navigation
Labels
priority: mediumMedium prioritytype: securityRelated to securityworkload: hoursLikely takes hours to resolve
Milestone
Description
Problem
The semgrep rule tls-verification-disabled adds requests.$METHOD(..., verify=0) and $SESSION.verify = False/0 to ruff's S501, which flags verify=False only in calls of the requests module. Calls on a requests.Session (e.g., session.get(url, verify=False)) pass both ruff and semgrep, and the gateways (proTES, proWES) talk to their backends through sessions.
Two gaps in the JWT rules came up in the same review (Sourcery on elixir-cloud-aai/prowes#147):
jwt-decode-without-verification:verify_signatureset toNone(falsy, disables verification in PyJWT), inline and in assigned options.jwt-decode-unsafe-algorithms: the header'salgextracted into a variable first (alg = header["alg"], thenalgorithms=[alg]); consider taint mode fromjwt.get_unverified_header(...)toalgorithms=.
What to do
- Add
$X.$METHOD(..., verify=False, ...)andverify=0, with$METHODrestricted to^(get|post|put|patch|delete|head|options|request|send)$, with test cases (ruleid/ok) in.semgrep/foca.py. - Close the two JWT gaps above, with test cases.
- Mirror the rules and their tests in proTES, trs-filer, cloud-registry and proWES (the rule files stay identical apart from
paths). - In the same pass, port the two ast-grep rules that prowes#147 widened (
string-status-code: returned tuples in parentheses;root-logger-call:logging.root,getLogger(name=None), with the keyword pattern ordered first) to trs-filer, proTES and cloud-registry, which have the same gaps.
Done when
-
session.get(url, verify=False)and the two JWT cases are flagged in all five repos, with identical rule files apart frompaths.
Sub-issues
Collapse Sub-issuesSub-issues
Loading 4 sub-issues
Metadata
Metadata
Assignees
Labels
priority: mediumMedium prioritytype: securityRelated to securityworkload: hoursLikely takes hours to resolve
Type
Projects
- StatusShow more project fieldsDone
Activity
fix: catch disabled TLS checks in session calls (#149)