refactor(backend): standardize errors and simplify configuration and test setup
This commit is contained in:
1 parent
1535c19b8c
commit
138666a7bb
92 files changed
+3994
-210
No files matched your search
@@ -0,0 +1,55 @@
|
||||
rules:
|
||||
- id: python-no-dynamic-code
|
||||
languages: [python]
|
||||
message: Avoid eval and exec. Parse structured data instead of executing input.
|
||||
severity: ERROR
|
||||
pattern-either:
|
||||
- pattern: eval(...)
|
||||
- pattern: exec(...)
|
||||
|
||||
- id: python-safe-yaml-loader
|
||||
languages: [python]
|
||||
message: Use yaml.safe_load, yaml.safe_load_all, or an explicit SafeLoader or CSafeLoader.
|
||||
severity: ERROR
|
||||
patterns:
|
||||
- pattern-either:
|
||||
- pattern: yaml.load(...)
|
||||
- pattern: yaml.load_all(...)
|
||||
- pattern-not: yaml.load(..., Loader=yaml.SafeLoader, ...)
|
||||
- pattern-not: yaml.load(..., Loader=yaml.CSafeLoader, ...)
|
||||
- pattern-not: yaml.load_all(..., Loader=yaml.SafeLoader, ...)
|
||||
- pattern-not: yaml.load_all(..., Loader=yaml.CSafeLoader, ...)
|
||||
- pattern-not: yaml.load($DATA, yaml.SafeLoader)
|
||||
- pattern-not: yaml.load($DATA, yaml.CSafeLoader)
|
||||
- pattern-not: yaml.load_all($DATA, yaml.SafeLoader)
|
||||
- pattern-not: yaml.load_all($DATA, yaml.CSafeLoader)
|
||||
|
||||
- id: python-no-subprocess-shell
|
||||
languages: [python]
|
||||
message: Pass an argument list to subprocess without shell=True.
|
||||
severity: ERROR
|
||||
patterns:
|
||||
- pattern: subprocess.$CALL(..., shell=True, ...)
|
||||
- metavariable-regex:
|
||||
metavariable: $CALL
|
||||
regex: ^(run|Popen|call|check_call|check_output)$
|
||||
|
||||
- id: python-no-disabled-tls
|
||||
languages: [python]
|
||||
message: Keep TLS certificate verification enabled in requests and httpx.
|
||||
severity: ERROR
|
||||
patterns:
|
||||
- pattern-either:
|
||||
- pattern: requests.$CALL(..., verify=False, ...)
|
||||
- pattern: httpx.$CALL(..., verify=False, ...)
|
||||
- metavariable-regex:
|
||||
metavariable: $CALL
|
||||
regex: ^(request|get|post|put|patch|delete|head|options|stream|Client|AsyncClient)$
|
||||
|
||||
- id: python-no-pickle-load
|
||||
languages: [python]
|
||||
message: Avoid pickle deserialization for service data. Use a non-executable format such as JSON.
|
||||
severity: ERROR
|
||||
pattern-either:
|
||||
- pattern: pickle.load(...)
|
||||
- pattern: pickle.loads(...)
|
||||
Reference in new issue
Block a user