@neralabs/rerail-pack-python 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/NOTICE +7 -0
- package/README.md +36 -0
- package/licenses/bandit/LICENSE +175 -0
- package/licenses/bandit/UPSTREAM.md +100 -0
- package/licenses/ruff/LICENSE +430 -0
- package/licenses/ruff/UPSTREAM.md +338 -0
- package/pack.json +912 -0
- package/package.json +30 -0
- package/rules/bandit-b101-assert-used.json +38 -0
- package/rules/bandit-b102-exec-used.json +125 -0
- package/rules/bandit-b110-try-except-pass.json +109 -0
- package/rules/bandit-b112-try-except-continue.json +109 -0
- package/rules/bandit-b113-request-without-timeout.json +138 -0
- package/rules/bandit-b301-pickle.json +58 -0
- package/rules/bandit-b302-marshal.json +48 -0
- package/rules/bandit-b303-md5.json +79 -0
- package/rules/bandit-b305-cipher-modes.json +47 -0
- package/rules/bandit-b306-mktemp-q.json +54 -0
- package/rules/bandit-b307-eval.json +125 -0
- package/rules/bandit-b308-mark-safe.json +47 -0
- package/rules/bandit-b310-urllib-urlopen.json +54 -0
- package/rules/bandit-b311-random.json +57 -0
- package/rules/bandit-b312-telnetlib.json +47 -0
- package/rules/bandit-b313-xml-bad-celementtree.json +50 -0
- package/rules/bandit-b314-xml-bad-elementtree.json +50 -0
- package/rules/bandit-b315-xml-bad-expatreader.json +47 -0
- package/rules/bandit-b316-xml-bad-expatbuilder.json +48 -0
- package/rules/bandit-b317-xml-bad-sax.json +58 -0
- package/rules/bandit-b318-xml-bad-minidom.json +48 -0
- package/rules/bandit-b319-xml-bad-pulldom.json +48 -0
- package/rules/bandit-b321-ftplib.json +47 -0
- package/rules/bandit-b323-unverified-context.json +47 -0
- package/rules/bandit-b401-import-telnetlib.json +48 -0
- package/rules/bandit-b402-import-ftplib.json +48 -0
- package/rules/bandit-b405-import-xml-etree.json +69 -0
- package/rules/bandit-b406-import-xml-sax.json +73 -0
- package/rules/bandit-b407-import-xml-expat.json +54 -0
- package/rules/bandit-b408-import-xml-minidom.json +54 -0
- package/rules/bandit-b409-import-xml-pulldom.json +54 -0
- package/rules/bandit-b411-import-xmlrpclib.json +48 -0
- package/rules/bandit-b413-import-pycrypto.json +159 -0
- package/rules/bandit-b415-import-pyghmi.json +48 -0
- package/rules/bandit-b502-ssl-with-bad-version.json +90 -0
- package/rules/bandit-b505-weak-cryptographic-key.json +166 -0
- package/rules/bandit-b507-ssh-no-host-key-verification.json +210 -0
- package/rules/bandit-b606-start-process-with-no-shell.json +63 -0
- package/rules/bandit-b610-django-extra-used.json +268 -0
- package/rules/bandit-b615-huggingface-unsafe-download.json +1152 -0
- package/rules/ruff-async100-cancel-scope-no-checkpoint.json +357 -0
- package/rules/ruff-async105-trio-sync-call.json +199 -0
- package/rules/ruff-async115-async-zero-sleep.json +264 -0
- package/rules/ruff-async116-long-sleep-not-forever.json +267 -0
- package/rules/ruff-async210-blocking-http-call-in-async-function.json +161 -0
- package/rules/ruff-async221-run-process-in-async-function.json +342 -0
- package/rules/ruff-async222-wait-for-process-in-async-function.json +144 -0
- package/rules/ruff-async230-blocking-open-call-in-async-function.json +339 -0
- package/rules/ruff-async250-blocking-input-in-async-function.json +143 -0
- package/rules/ruff-async251-blocking-sleep-in-async-function.json +140 -0
- package/rules/ruff-b002-unary-prefix-increment-decrement.json +54 -0
- package/rules/ruff-b003-assignment-to-os-environ.json +54 -0
- package/rules/ruff-b004-unreliable-callable-check.json +171 -0
- package/rules/ruff-b005-strip-with-multi-characters.json +131 -0
- package/rules/ruff-b007-unused-loop-control-variable.json +368 -0
- package/rules/ruff-b009-get-attr-with-constant.json +190 -0
- package/rules/ruff-b010-set-attr-with-constant.json +219 -0
- package/rules/ruff-b011-assert-false.json +62 -0
- package/rules/ruff-b013-redundant-tuple-in-exception-handler.json +94 -0
- package/rules/ruff-b014-duplicate-handler-exception.json +126 -0
- package/rules/ruff-b016-raise-literal.json +47 -0
- package/rules/ruff-b020-loop-variable-overrides-iterator.json +341 -0
- package/rules/ruff-b021-f-string-docstring.json +48 -0
- package/rules/ruff-b022-useless-contextlib-suppress.json +95 -0
- package/rules/ruff-b023-function-uses-loop-variable.json +560 -0
- package/rules/ruff-b025-duplicate-try-block-exception.json +182 -0
- package/rules/ruff-b026-star-arg-unpacking-after-keyword-arg.json +57 -0
- package/rules/ruff-b028-no-explicit-stacklevel.json +177 -0
- package/rules/ruff-b029-except-with-empty-tuple.json +102 -0
- package/rules/ruff-b032-unintentional-type-annotation.json +157 -0
- package/rules/ruff-b033-duplicate-value.json +129 -0
- package/rules/ruff-b034-re-sub-positional-args.json +159 -0
- package/rules/ruff-b039-mutable-contextvar-default.json +281 -0
- package/rules/ruff-b904-raise-without-from-inside-except.json +194 -0
- package/rules/ruff-b905-zip-without-explicit-strict.json +429 -0
- package/rules/ruff-e711-none-comparison.json +199 -0
- package/rules/ruff-e721-type-comparison.json +293 -0
- package/rules/ruff-e722-bare-except.json +57 -0
- package/rules/ruff-e742-ambiguous-class-name.json +47 -0
- package/rules/ruff-e743-ambiguous-function-name.json +47 -0
- package/rules/ruff-f403-undefined-local-with-import-star.json +73 -0
- package/rules/ruff-f405-undefined-local-with-import-star-usage.json +87 -0
- package/rules/ruff-f406-undefined-local-with-nested-import-star-usage.json +39 -0
- package/rules/ruff-f407-future-feature-not-defined.json +56 -0
- package/rules/ruff-f501-percent-format-invalid-format.json +88 -0
- package/rules/ruff-f502-percent-format-expected-mapping.json +127 -0
- package/rules/ruff-f503-percent-format-expected-sequence.json +127 -0
- package/rules/ruff-f504-percent-format-extra-named-arguments.json +46 -0
- package/rules/ruff-f505-percent-format-missing-argument.json +49 -0
- package/rules/ruff-f506-percent-format-mixed-positional-and-named.json +114 -0
- package/rules/ruff-f507-percent-format-positional-count-mismatch.json +78 -0
- package/rules/ruff-f508-percent-format-star-requires-sequence.json +112 -0
- package/rules/ruff-f509-percent-format-unsupported-format-character.json +86 -0
- package/rules/ruff-f521-string-dot-format-invalid-format.json +83 -0
- package/rules/ruff-f522-string-dot-format-extra-named-arguments.json +46 -0
- package/rules/ruff-f523-string-dot-format-extra-positional-arguments.json +48 -0
- package/rules/ruff-f524-string-dot-format-missing-arguments.json +46 -0
- package/rules/ruff-f525-string-dot-format-mixing-automatic.json +99 -0
- package/rules/ruff-f541-f-string-missing-placeholders.json +52 -0
- package/rules/ruff-f601-multi-value-repeated-key-literal.json +215 -0
- package/rules/ruff-f602-multi-value-repeated-key-variable.json +123 -0
- package/rules/ruff-f622-multiple-starred-expressions.json +57 -0
- package/rules/ruff-f632-is-literal.json +232 -0
- package/rules/ruff-f633-invalid-print-syntax.json +299 -0
- package/rules/ruff-f701-break-outside-loop.json +64 -0
- package/rules/ruff-f702-continue-outside-loop.json +64 -0
- package/rules/ruff-f706-return-outside-function.json +61 -0
- package/rules/ruff-f707-default-except-not-last.json +50 -0
- package/rules/ruff-f722-forward-annotation-syntax-error.json +654 -0
- package/rules/ruff-f822-undefined-export.json +55 -0
- package/rules/ruff-f823-undefined-local.json +42 -0
- package/rules/ruff-f842-unused-annotation.json +51 -0
- package/rules/ruff-f901-raise-not-implemented.json +97 -0
- package/rules/ruff-pie794-duplicate-class-field-definition.json +157 -0
- package/rules/ruff-pie796-non-unique-enums.json +460 -0
- package/rules/ruff-pie800-unnecessary-spread.json +62 -0
- package/rules/ruff-pie804-unnecessary-dict-kwargs.json +179 -0
- package/rules/ruff-pie807-reimplemented-container-builtin.json +100 -0
- package/rules/ruff-pie810-multiple-starts-ends-with.json +585 -0
- package/rules/ruff-ret501-unnecessary-return-none.json +256 -0
- package/rules/ruff-ret502-implicit-return-value.json +163 -0
- package/rules/ruff-ret505-superfluous-else-return.json +211 -0
- package/rules/ruff-ret506-superfluous-else-raise.json +211 -0
- package/rules/ruff-ret507-superfluous-else-continue.json +211 -0
- package/rules/ruff-ret508-superfluous-else-break.json +211 -0
- package/rules/ruff-sim101-duplicate-isinstance-call.json +384 -0
- package/rules/ruff-sim107-return-in-try-except-finally.json +82 -0
- package/rules/ruff-sim109-compare-with-tuple.json +205 -0
- package/rules/ruff-sim112-uncapitalized-environment-variables.json +168 -0
- package/rules/ruff-sim113-enumerate-for-loop.json +562 -0
- package/rules/ruff-sim208-double-negation.json +58 -0
- package/rules/ruff-sim210-if-expr-with-true-false.json +90 -0
- package/rules/ruff-sim211-if-expr-with-false-true.json +90 -0
- package/rules/ruff-sim212-if-expr-with-twisted-arms.json +95 -0
- package/rules/ruff-sim300-yoda-conditions.json +487 -0
- package/rules/ruff-sim905-split-static-string.json +579 -0
- package/rules/ruff-sim910-dict-get-with-none-default.json +518 -0
- package/rules/ruff-t100-debugger.json +197 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "rerail.policy/v1",
|
|
3
|
+
"id": "bandit-b409-import-xml-pulldom",
|
|
4
|
+
"revision": 1,
|
|
5
|
+
"mode": "steer",
|
|
6
|
+
"description": "Detect direct imports of xml.dom.pulldom.",
|
|
7
|
+
"scope": {
|
|
8
|
+
"include": [
|
|
9
|
+
"**/*.py"
|
|
10
|
+
],
|
|
11
|
+
"exclude": []
|
|
12
|
+
},
|
|
13
|
+
"clauses": [
|
|
14
|
+
{
|
|
15
|
+
"id": "B409",
|
|
16
|
+
"forbid": {
|
|
17
|
+
"ast": {
|
|
18
|
+
"language": "python",
|
|
19
|
+
"rule": {
|
|
20
|
+
"any": [
|
|
21
|
+
{
|
|
22
|
+
"pattern": "import xml.dom.pulldom"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"pattern": "import xml.dom.pulldom as $ALIAS"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"pattern": "from xml.dom.pulldom import $$$NAMES"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"pattern": "from xml.dom import pulldom"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"pattern": "from xml.dom import pulldom as $ALIAS"
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"violation": {
|
|
41
|
+
"code": "B409",
|
|
42
|
+
"anchor": "witness.span",
|
|
43
|
+
"message": "xml.dom.pulldom parsing may be vulnerable to XML attacks; use defusedxml or defuse the standard library.",
|
|
44
|
+
"suppress": {
|
|
45
|
+
"nosec": {
|
|
46
|
+
"codes": [
|
|
47
|
+
"B409"
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "rerail.policy/v1",
|
|
3
|
+
"id": "bandit-b411-import-xmlrpclib",
|
|
4
|
+
"revision": 1,
|
|
5
|
+
"mode": "steer",
|
|
6
|
+
"description": "Detect direct imports of xmlrpc.",
|
|
7
|
+
"scope": {
|
|
8
|
+
"include": [
|
|
9
|
+
"**/*.py"
|
|
10
|
+
],
|
|
11
|
+
"exclude": []
|
|
12
|
+
},
|
|
13
|
+
"clauses": [
|
|
14
|
+
{
|
|
15
|
+
"id": "B411",
|
|
16
|
+
"forbid": {
|
|
17
|
+
"ast": {
|
|
18
|
+
"language": "python",
|
|
19
|
+
"rule": {
|
|
20
|
+
"any": [
|
|
21
|
+
{
|
|
22
|
+
"pattern": "import xmlrpc"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"pattern": "import xmlrpc as $ALIAS"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"pattern": "from xmlrpc import $$$NAMES"
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"violation": {
|
|
35
|
+
"code": "B411",
|
|
36
|
+
"anchor": "witness.span",
|
|
37
|
+
"message": "xmlrpc parsing may be vulnerable to XML attacks; use defusedxml.xmlrpc.monkey_patch() to mitigate XML vulnerabilities.",
|
|
38
|
+
"suppress": {
|
|
39
|
+
"nosec": {
|
|
40
|
+
"codes": [
|
|
41
|
+
"B411"
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "rerail.policy/v1",
|
|
3
|
+
"id": "bandit-b413-import-pycrypto",
|
|
4
|
+
"revision": 1,
|
|
5
|
+
"mode": "steer",
|
|
6
|
+
"description": "Detect direct imports of deprecated pyCrypto namespaces.",
|
|
7
|
+
"scope": {
|
|
8
|
+
"include": [
|
|
9
|
+
"**/*.py"
|
|
10
|
+
],
|
|
11
|
+
"exclude": []
|
|
12
|
+
},
|
|
13
|
+
"clauses": [
|
|
14
|
+
{
|
|
15
|
+
"id": "B413",
|
|
16
|
+
"forbid": {
|
|
17
|
+
"ast": {
|
|
18
|
+
"language": "python",
|
|
19
|
+
"rule": {
|
|
20
|
+
"any": [
|
|
21
|
+
{
|
|
22
|
+
"pattern": "import Crypto.Cipher"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"pattern": "import Crypto.Cipher as $ALIAS"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"pattern": "from Crypto.Cipher import $$$NAMES"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"pattern": "from Crypto import Cipher"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"pattern": "from Crypto import Cipher as $ALIAS"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"pattern": "import Crypto.Hash"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"pattern": "import Crypto.Hash as $ALIAS"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"pattern": "from Crypto.Hash import $$$NAMES"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"pattern": "from Crypto import Hash"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"pattern": "from Crypto import Hash as $ALIAS"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"pattern": "import Crypto.IO"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"pattern": "import Crypto.IO as $ALIAS"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"pattern": "from Crypto.IO import $$$NAMES"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"pattern": "from Crypto import IO"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"pattern": "from Crypto import IO as $ALIAS"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"pattern": "import Crypto.Protocol"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"pattern": "import Crypto.Protocol as $ALIAS"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"pattern": "from Crypto.Protocol import $$$NAMES"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"pattern": "from Crypto import Protocol"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"pattern": "from Crypto import Protocol as $ALIAS"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"pattern": "import Crypto.PublicKey"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"pattern": "import Crypto.PublicKey as $ALIAS"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"pattern": "from Crypto.PublicKey import $$$NAMES"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"pattern": "from Crypto import PublicKey"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"pattern": "from Crypto import PublicKey as $ALIAS"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"pattern": "import Crypto.Random"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"pattern": "import Crypto.Random as $ALIAS"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"pattern": "from Crypto.Random import $$$NAMES"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"pattern": "from Crypto import Random"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"pattern": "from Crypto import Random as $ALIAS"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"pattern": "import Crypto.Signature"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"pattern": "import Crypto.Signature as $ALIAS"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"pattern": "from Crypto.Signature import $$$NAMES"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"pattern": "from Crypto import Signature"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"pattern": "from Crypto import Signature as $ALIAS"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"pattern": "import Crypto.Util"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"pattern": "import Crypto.Util as $ALIAS"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"pattern": "from Crypto.Util import $$$NAMES"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"pattern": "from Crypto import Util"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"pattern": "from Crypto import Util as $ALIAS"
|
|
140
|
+
}
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
"violation": {
|
|
146
|
+
"code": "B413",
|
|
147
|
+
"anchor": "witness.span",
|
|
148
|
+
"message": "The pyCrypto library is deprecated and unmaintained; consider using pyca/cryptography.",
|
|
149
|
+
"suppress": {
|
|
150
|
+
"nosec": {
|
|
151
|
+
"codes": [
|
|
152
|
+
"B413"
|
|
153
|
+
]
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
]
|
|
159
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "rerail.policy/v1",
|
|
3
|
+
"id": "bandit-b415-import-pyghmi",
|
|
4
|
+
"revision": 1,
|
|
5
|
+
"mode": "steer",
|
|
6
|
+
"description": "Detect direct imports of the insecure pyghmi package.",
|
|
7
|
+
"scope": {
|
|
8
|
+
"include": [
|
|
9
|
+
"**/*.py"
|
|
10
|
+
],
|
|
11
|
+
"exclude": []
|
|
12
|
+
},
|
|
13
|
+
"clauses": [
|
|
14
|
+
{
|
|
15
|
+
"id": "B415",
|
|
16
|
+
"forbid": {
|
|
17
|
+
"ast": {
|
|
18
|
+
"language": "python",
|
|
19
|
+
"rule": {
|
|
20
|
+
"any": [
|
|
21
|
+
{
|
|
22
|
+
"pattern": "import pyghmi"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"pattern": "import pyghmi as $ALIAS"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"pattern": "from pyghmi import $$$NAMES"
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"violation": {
|
|
35
|
+
"code": "B415",
|
|
36
|
+
"anchor": "witness.span",
|
|
37
|
+
"message": "An IPMI-related module is being imported. IPMI is insecure; use an encrypted protocol.",
|
|
38
|
+
"suppress": {
|
|
39
|
+
"nosec": {
|
|
40
|
+
"codes": [
|
|
41
|
+
"B415"
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "rerail.policy/v1",
|
|
3
|
+
"id": "bandit-b502-ssl-with-bad-version",
|
|
4
|
+
"revision": 1,
|
|
5
|
+
"mode": "steer",
|
|
6
|
+
"description": "Detect calls whose method or ssl_version argument selects an insecure SSL/TLS protocol.",
|
|
7
|
+
"scope": {
|
|
8
|
+
"include": [
|
|
9
|
+
"**/*.py"
|
|
10
|
+
],
|
|
11
|
+
"exclude": []
|
|
12
|
+
},
|
|
13
|
+
"clauses": [
|
|
14
|
+
{
|
|
15
|
+
"id": "B502",
|
|
16
|
+
"forbid": {
|
|
17
|
+
"ast": {
|
|
18
|
+
"language": "python",
|
|
19
|
+
"rule": {
|
|
20
|
+
"all": [
|
|
21
|
+
{
|
|
22
|
+
"pattern": "$F($$$ARGS)"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"any": [
|
|
26
|
+
{
|
|
27
|
+
"arguments": {
|
|
28
|
+
"signature": [
|
|
29
|
+
"*",
|
|
30
|
+
"method"
|
|
31
|
+
],
|
|
32
|
+
"bind": {
|
|
33
|
+
"PROTOCOL": "method"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"arguments": {
|
|
39
|
+
"signature": [
|
|
40
|
+
"*",
|
|
41
|
+
"ssl_version"
|
|
42
|
+
],
|
|
43
|
+
"bind": {
|
|
44
|
+
"PROTOCOL": "ssl_version"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
"constraints": {
|
|
53
|
+
"PROTOCOL": {
|
|
54
|
+
"resolves": {
|
|
55
|
+
"import": [
|
|
56
|
+
"ssl.PROTOCOL_SSLv2",
|
|
57
|
+
"ssl.PROTOCOL_SSLv3",
|
|
58
|
+
"ssl.PROTOCOL_TLSv1",
|
|
59
|
+
"ssl.PROTOCOL_TLSv1_1",
|
|
60
|
+
"OpenSSL.SSL.SSLv2_METHOD",
|
|
61
|
+
"OpenSSL.SSL.SSLv23_METHOD",
|
|
62
|
+
"OpenSSL.SSL.SSLv3_METHOD",
|
|
63
|
+
"OpenSSL.SSL.TLSv1_METHOD",
|
|
64
|
+
"OpenSSL.SSL.TLSv1_1_METHOD",
|
|
65
|
+
"pyOpenSSL.SSL.SSLv2_METHOD",
|
|
66
|
+
"pyOpenSSL.SSL.SSLv23_METHOD",
|
|
67
|
+
"pyOpenSSL.SSL.SSLv3_METHOD",
|
|
68
|
+
"pyOpenSSL.SSL.TLSv1_METHOD",
|
|
69
|
+
"pyOpenSSL.SSL.TLSv1_1_METHOD"
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"violation": {
|
|
77
|
+
"code": "B502",
|
|
78
|
+
"anchor": "witness.span",
|
|
79
|
+
"message": "An SSL context is configured with an insecure protocol version.",
|
|
80
|
+
"suppress": {
|
|
81
|
+
"nosec": {
|
|
82
|
+
"codes": [
|
|
83
|
+
"B502"
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "rerail.policy/v1",
|
|
3
|
+
"id": "bandit-b505-weak-cryptographic-key",
|
|
4
|
+
"revision": 1,
|
|
5
|
+
"mode": "steer",
|
|
6
|
+
"description": "Port of Bandit 1.9.4's B505 weak_cryptographic_key: a DSA or RSA key below 2048 bits or an EC curve below 224 bits, by keyword or position (Bandit's medium thresholds). Port of the kernel test b505_weak_key_sizes_by_keyword_or_position. Bandit's `# nosec` is honoured (`suppress.nosec`), as its recordings honour it.",
|
|
7
|
+
"scope": {
|
|
8
|
+
"include": [
|
|
9
|
+
"**/*"
|
|
10
|
+
],
|
|
11
|
+
"exclude": []
|
|
12
|
+
},
|
|
13
|
+
"clauses": [
|
|
14
|
+
{
|
|
15
|
+
"id": "weak-cryptographic-key",
|
|
16
|
+
"forbid": {
|
|
17
|
+
"ast": {
|
|
18
|
+
"language": "python",
|
|
19
|
+
"rule": {
|
|
20
|
+
"kind": "call",
|
|
21
|
+
"any": [
|
|
22
|
+
{
|
|
23
|
+
"has": {
|
|
24
|
+
"any": [
|
|
25
|
+
{
|
|
26
|
+
"kind": "identifier"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"kind": "attribute"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"resolves": {
|
|
33
|
+
"import": [
|
|
34
|
+
"cryptography.hazmat.primitives.asymmetric.dsa.generate_private_key"
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"arguments": {
|
|
39
|
+
"signature": [
|
|
40
|
+
"key_size",
|
|
41
|
+
"backend"
|
|
42
|
+
],
|
|
43
|
+
"bind": {
|
|
44
|
+
"K": "key_size"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"has": {
|
|
50
|
+
"any": [
|
|
51
|
+
{
|
|
52
|
+
"kind": "identifier"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"kind": "attribute"
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
"resolves": {
|
|
59
|
+
"import": [
|
|
60
|
+
"cryptography.hazmat.primitives.asymmetric.rsa.generate_private_key"
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"arguments": {
|
|
65
|
+
"signature": [
|
|
66
|
+
"public_exponent",
|
|
67
|
+
"key_size",
|
|
68
|
+
"backend"
|
|
69
|
+
],
|
|
70
|
+
"bind": {
|
|
71
|
+
"K": "key_size"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"has": {
|
|
77
|
+
"any": [
|
|
78
|
+
{
|
|
79
|
+
"kind": "identifier"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"kind": "attribute"
|
|
83
|
+
}
|
|
84
|
+
],
|
|
85
|
+
"resolves": {
|
|
86
|
+
"import": [
|
|
87
|
+
"cryptography.hazmat.primitives.asymmetric.ec.generate_private_key"
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"arguments": {
|
|
92
|
+
"signature": [
|
|
93
|
+
"curve",
|
|
94
|
+
"backend"
|
|
95
|
+
],
|
|
96
|
+
"bind": {
|
|
97
|
+
"C": "curve"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"has": {
|
|
103
|
+
"any": [
|
|
104
|
+
{
|
|
105
|
+
"kind": "identifier"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"kind": "attribute"
|
|
109
|
+
}
|
|
110
|
+
],
|
|
111
|
+
"resolves": {
|
|
112
|
+
"import": [
|
|
113
|
+
"Crypto.PublicKey.DSA.generate",
|
|
114
|
+
"Crypto.PublicKey.RSA.generate",
|
|
115
|
+
"Cryptodome.PublicKey.DSA.generate",
|
|
116
|
+
"Cryptodome.PublicKey.RSA.generate"
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
"arguments": {
|
|
121
|
+
"signature": [
|
|
122
|
+
"bits"
|
|
123
|
+
],
|
|
124
|
+
"bind": {
|
|
125
|
+
"K": "bits"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
"constraints": {
|
|
132
|
+
"K": {
|
|
133
|
+
"value": {
|
|
134
|
+
"lt": 2048
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
"C": {
|
|
138
|
+
"any": [
|
|
139
|
+
{
|
|
140
|
+
"kind": "attribute",
|
|
141
|
+
"regex": "\\.(SECP192R1|SECT163K1|SECT163R2)$"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"kind": "identifier",
|
|
145
|
+
"regex": "^(SECP192R1|SECT163K1|SECT163R2)$"
|
|
146
|
+
}
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
"violation": {
|
|
153
|
+
"anchor": "witness.span",
|
|
154
|
+
"code": "B505",
|
|
155
|
+
"message": "Bandit B505 (weak-cryptographic-key)",
|
|
156
|
+
"suppress": {
|
|
157
|
+
"nosec": {
|
|
158
|
+
"codes": [
|
|
159
|
+
"B505"
|
|
160
|
+
]
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
]
|
|
166
|
+
}
|