pinata-security-cli 0.5.3 → 0.6.0
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/README.md +39 -2
- package/dist/cli/index.js +902 -1546
- package/dist/cli/index.js.map +1 -1
- package/package.json +4 -1
- package/src/categories/definitions/concurrency/idempotency-missing.yml +5 -5
- package/src/categories/definitions/concurrency/race-condition.yml +2 -2
- package/src/categories/definitions/data/data-race.yml +9 -16
- package/src/categories/definitions/data/encoding-mismatch.yml +4 -4
- package/src/categories/definitions/data/null-handling.yml +8 -23
- package/src/categories/definitions/input/boundary-testing.yml +8 -43
- package/src/categories/definitions/input/null-undefined.yml +1 -43
- package/src/categories/definitions/network/connection-failure.yml +1 -1
- package/src/categories/definitions/resource/memory-leak.yml +8 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pinata-security-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "AI-powered test coverage analysis and generation tool. Find security blind spots before attackers do.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -75,6 +75,9 @@
|
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@eslint/js": "^9.39.2",
|
|
78
|
+
"@stryker-mutator/core": "^9.5.1",
|
|
79
|
+
"@stryker-mutator/typescript-checker": "^9.5.1",
|
|
80
|
+
"@stryker-mutator/vitest-runner": "^9.5.1",
|
|
78
81
|
"@types/js-yaml": "^4.0.9",
|
|
79
82
|
"@types/minimatch": "^5.1.2",
|
|
80
83
|
"@types/node": "^20.14.10",
|
|
@@ -35,8 +35,8 @@ detectionPatterns:
|
|
|
35
35
|
type: regex
|
|
36
36
|
language: python
|
|
37
37
|
pattern: "\\+=\\s*1|counter\\s*\\+|increment\\("
|
|
38
|
-
confidence:
|
|
39
|
-
description: Detects counter increments (
|
|
38
|
+
confidence: medium
|
|
39
|
+
description: Detects counter increments (may need idempotency guards in retry contexts)
|
|
40
40
|
|
|
41
41
|
- id: python-payment-no-idem
|
|
42
42
|
type: regex
|
|
@@ -69,9 +69,9 @@ detectionPatterns:
|
|
|
69
69
|
- id: ts-counter-update
|
|
70
70
|
type: regex
|
|
71
71
|
language: typescript
|
|
72
|
-
pattern: "
|
|
73
|
-
confidence:
|
|
74
|
-
description: Detects counter updates
|
|
72
|
+
pattern: "\\$inc|\\$push(?!.*idempotency|.*idempotent)"
|
|
73
|
+
confidence: medium
|
|
74
|
+
description: Detects MongoDB counter/array updates without idempotency
|
|
75
75
|
|
|
76
76
|
- id: ts-webhook-no-dedup
|
|
77
77
|
type: regex
|
|
@@ -65,9 +65,9 @@ detectionPatterns:
|
|
|
65
65
|
- id: ts-check-then-act
|
|
66
66
|
type: regex
|
|
67
67
|
language: typescript
|
|
68
|
-
pattern: "if\\s*\\(.*exists.*\\).*\\{.*create|if\\s*\\(
|
|
68
|
+
pattern: "if\\s*\\(.*exists.*\\).*\\{.*(create|write|mkdir|insert)|if\\s*\\(!.*exists.*\\).*\\{.*(create|write|mkdir|insert)"
|
|
69
69
|
confidence: medium
|
|
70
|
-
description: Detects check-then-act pattern
|
|
70
|
+
description: Detects check-then-act TOCTOU pattern (check existence then create)
|
|
71
71
|
|
|
72
72
|
- id: ts-promise-race-unsafe
|
|
73
73
|
type: regex
|
|
@@ -28,19 +28,12 @@ detectionPatterns:
|
|
|
28
28
|
confidence: medium
|
|
29
29
|
description: Detects mutable global state
|
|
30
30
|
|
|
31
|
-
- id: python-
|
|
31
|
+
- id: python-thread-no-lock
|
|
32
32
|
type: regex
|
|
33
33
|
language: python
|
|
34
|
-
pattern: "\\
|
|
35
|
-
confidence:
|
|
36
|
-
description: Detects
|
|
37
|
-
|
|
38
|
-
- id: python-no-lock
|
|
39
|
-
type: regex
|
|
40
|
-
language: python
|
|
41
|
-
pattern: "threading\\.Thread|multiprocessing\\.Process"
|
|
42
|
-
confidence: low
|
|
43
|
-
description: Detects threading (verify locking)
|
|
34
|
+
pattern: "threading\\.Thread.*(?!Lock\\(|RLock\\(|Semaphore\\()"
|
|
35
|
+
confidence: medium
|
|
36
|
+
description: Detects thread creation without visible locking in same scope
|
|
44
37
|
negativePattern: "Lock\\(|RLock\\(|Semaphore\\("
|
|
45
38
|
|
|
46
39
|
- id: python-check-then-act
|
|
@@ -50,12 +43,12 @@ detectionPatterns:
|
|
|
50
43
|
confidence: medium
|
|
51
44
|
description: Detects check-then-act pattern (TOCTOU)
|
|
52
45
|
|
|
53
|
-
- id: ts-
|
|
46
|
+
- id: ts-var-declaration
|
|
54
47
|
type: regex
|
|
55
48
|
language: typescript
|
|
56
|
-
pattern: "
|
|
57
|
-
confidence:
|
|
58
|
-
description: Detects
|
|
49
|
+
pattern: "\\bvar\\s+\\w+\\s*="
|
|
50
|
+
confidence: medium
|
|
51
|
+
description: Detects var declarations (function-scoped, potential unintended sharing)
|
|
59
52
|
|
|
60
53
|
- id: ts-async-race
|
|
61
54
|
type: regex
|
|
@@ -68,7 +61,7 @@ detectionPatterns:
|
|
|
68
61
|
type: regex
|
|
69
62
|
language: typescript
|
|
70
63
|
pattern: "\\w+\\s*=\\s*\\w+\\s*\\+\\s*1|\\w+\\+\\+"
|
|
71
|
-
confidence:
|
|
64
|
+
confidence: medium
|
|
72
65
|
description: Detects non-atomic increment
|
|
73
66
|
|
|
74
67
|
- id: ts-database-upsert
|
|
@@ -56,7 +56,7 @@ detectionPatterns:
|
|
|
56
56
|
type: regex
|
|
57
57
|
language: typescript
|
|
58
58
|
pattern: "new TextDecoder\\(\\)|TextDecoder\\(\\)"
|
|
59
|
-
confidence:
|
|
59
|
+
confidence: medium
|
|
60
60
|
description: Detects TextDecoder without explicit encoding
|
|
61
61
|
|
|
62
62
|
- id: ts-buffer-tostring-default
|
|
@@ -76,9 +76,9 @@ detectionPatterns:
|
|
|
76
76
|
- id: ts-length-emoji
|
|
77
77
|
type: regex
|
|
78
78
|
language: typescript
|
|
79
|
-
pattern: "\\.length
|
|
80
|
-
confidence:
|
|
81
|
-
description: Detects string length (
|
|
79
|
+
pattern: "\\.length\\s*[<>]=?\\s*\\d+.*\\.charAt|\\.length.*\\.charCodeAt|\\.split\\(.*\\)\\.length"
|
|
80
|
+
confidence: medium
|
|
81
|
+
description: Detects string length used with char operations (may be wrong for emoji)
|
|
82
82
|
negativePattern: "\\[\\.\\.\\.\\w+\\]\\.length|Array\\.from\\("
|
|
83
83
|
|
|
84
84
|
testTemplates:
|
|
@@ -41,12 +41,12 @@ detectionPatterns:
|
|
|
41
41
|
confidence: high
|
|
42
42
|
description: Detects arithmetic with potential None values
|
|
43
43
|
|
|
44
|
-
- id: python-json-
|
|
44
|
+
- id: python-json-no-default
|
|
45
45
|
type: regex
|
|
46
46
|
language: python
|
|
47
|
-
pattern: "json\\.loads|json\\.
|
|
48
|
-
confidence:
|
|
49
|
-
description: Detects JSON
|
|
47
|
+
pattern: "json\\.loads?\\(.*\\)\\[|json\\.loads?\\(.*\\)\\."
|
|
48
|
+
confidence: medium
|
|
49
|
+
description: Detects JSON parse result accessed without null check
|
|
50
50
|
negativePattern: "or\\s+\\{\\}|or\\s+\\[\\]|\\.get\\("
|
|
51
51
|
|
|
52
52
|
- id: ts-null-vs-undefined
|
|
@@ -56,27 +56,12 @@ detectionPatterns:
|
|
|
56
56
|
confidence: medium
|
|
57
57
|
description: Detects checking only null or undefined, not both
|
|
58
58
|
|
|
59
|
-
- id: ts-
|
|
60
|
-
type: regex
|
|
61
|
-
language: typescript
|
|
62
|
-
pattern: "\\w+\\.\\w+\\.\\w+(?!\\.?)"
|
|
63
|
-
confidence: low
|
|
64
|
-
description: Detects deep property access without optional chaining
|
|
65
|
-
negativePattern: "\\?\\."
|
|
66
|
-
|
|
67
|
-
- id: ts-nullable-db-field
|
|
59
|
+
- id: ts-json-parse-no-try
|
|
68
60
|
type: regex
|
|
69
61
|
language: typescript
|
|
70
|
-
pattern: "
|
|
71
|
-
confidence:
|
|
72
|
-
description: Detects
|
|
73
|
-
|
|
74
|
-
- id: ts-json-parse-null
|
|
75
|
-
type: regex
|
|
76
|
-
language: typescript
|
|
77
|
-
pattern: "JSON\\.parse\\s*\\("
|
|
78
|
-
confidence: low
|
|
79
|
-
description: Detects JSON parsing (verify null handling)
|
|
62
|
+
pattern: "JSON\\.parse\\s*\\((?!.*try|.*catch)"
|
|
63
|
+
confidence: medium
|
|
64
|
+
description: Detects JSON.parse without visible error handling
|
|
80
65
|
|
|
81
66
|
testTemplates:
|
|
82
67
|
- id: pytest-null-handling
|
|
@@ -21,54 +21,19 @@ references:
|
|
|
21
21
|
- https://en.wikipedia.org/wiki/Boundary_testing
|
|
22
22
|
|
|
23
23
|
detectionPatterns:
|
|
24
|
-
- id: python-
|
|
24
|
+
- id: python-unchecked-index-user-input
|
|
25
25
|
type: regex
|
|
26
26
|
language: python
|
|
27
|
-
pattern: "\\
|
|
28
|
-
confidence:
|
|
29
|
-
description: Detects array
|
|
27
|
+
pattern: "\\w+\\[\\s*(request\\.|params\\.|args\\.|input)"
|
|
28
|
+
confidence: medium
|
|
29
|
+
description: Detects array indexing with user-controlled input without bounds check
|
|
30
30
|
|
|
31
|
-
- id:
|
|
32
|
-
type: regex
|
|
33
|
-
language: python
|
|
34
|
-
pattern: "if\\s+\\w+\\s*[<>]=?\\s*\\d+|if\\s+\\d+\\s*[<>]=?\\s*\\w+"
|
|
35
|
-
confidence: low
|
|
36
|
-
description: Detects numeric comparisons (verify off-by-one)
|
|
37
|
-
|
|
38
|
-
- id: python-slice-operation
|
|
39
|
-
type: regex
|
|
40
|
-
language: python
|
|
41
|
-
pattern: "\\[:\\d+\\]|\\[\\d+:\\]|\\[-\\d+:\\]"
|
|
42
|
-
confidence: low
|
|
43
|
-
description: Detects slice operations (verify bounds)
|
|
44
|
-
|
|
45
|
-
- id: python-loop-range
|
|
46
|
-
type: regex
|
|
47
|
-
language: python
|
|
48
|
-
pattern: "for\\s+\\w+\\s+in\\s+range\\("
|
|
49
|
-
confidence: low
|
|
50
|
-
description: Detects range loops (verify inclusive/exclusive)
|
|
51
|
-
|
|
52
|
-
- id: ts-array-access
|
|
53
|
-
type: regex
|
|
54
|
-
language: typescript
|
|
55
|
-
pattern: "\\[\\w+\\]|\\[\\.length\\s*-\\s*1\\]"
|
|
56
|
-
confidence: low
|
|
57
|
-
description: Detects array index access
|
|
58
|
-
|
|
59
|
-
- id: ts-comparison-boundary
|
|
60
|
-
type: regex
|
|
61
|
-
language: typescript
|
|
62
|
-
pattern: "if\\s*\\(.*[<>]=?\\s*\\d+|\\w+\\s*[<>]=?\\s*\\w+\\.length"
|
|
63
|
-
confidence: low
|
|
64
|
-
description: Detects numeric/length comparisons
|
|
65
|
-
|
|
66
|
-
- id: ts-substring
|
|
31
|
+
- id: ts-unchecked-index-user-input
|
|
67
32
|
type: regex
|
|
68
33
|
language: typescript
|
|
69
|
-
pattern: "
|
|
70
|
-
confidence:
|
|
71
|
-
description: Detects
|
|
34
|
+
pattern: "\\w+\\[\\s*(req\\.|params\\.|query\\.|body\\.|input)"
|
|
35
|
+
confidence: medium
|
|
36
|
+
description: Detects array indexing with user-controlled input without bounds check
|
|
72
37
|
|
|
73
38
|
testTemplates:
|
|
74
39
|
- id: pytest-boundary-testing
|
|
@@ -20,54 +20,12 @@ references:
|
|
|
20
20
|
- https://cwe.mitre.org/data/definitions/457.html
|
|
21
21
|
|
|
22
22
|
detectionPatterns:
|
|
23
|
-
- id: python-no-none-check
|
|
24
|
-
type: regex
|
|
25
|
-
language: python
|
|
26
|
-
pattern: "\\w+\\.\\w+(?!.*if.*is\\s+not\\s+None)"
|
|
27
|
-
confidence: low
|
|
28
|
-
description: Detects attribute access without None check
|
|
29
|
-
|
|
30
|
-
- id: python-dict-access-no-get
|
|
31
|
-
type: regex
|
|
32
|
-
language: python
|
|
33
|
-
pattern: "\\w+\\[[\"']\\w+[\"']\\](?!.*\\.get\\()"
|
|
34
|
-
confidence: medium
|
|
35
|
-
description: Detects dict access that may raise KeyError
|
|
36
|
-
|
|
37
|
-
- id: python-optional-no-default
|
|
38
|
-
type: regex
|
|
39
|
-
language: python
|
|
40
|
-
pattern: "Optional\\[.*\\](?!.*=\\s*None)"
|
|
41
|
-
confidence: medium
|
|
42
|
-
description: Detects Optional type without default value
|
|
43
|
-
|
|
44
|
-
- id: ts-no-null-check
|
|
45
|
-
type: regex
|
|
46
|
-
language: typescript
|
|
47
|
-
pattern: "\\w+\\.\\w+(?!.*\\?\\.|.*&&|.*\\|\\|)"
|
|
48
|
-
confidence: low
|
|
49
|
-
description: Detects property access without null check
|
|
50
|
-
|
|
51
|
-
- id: ts-undefined-equality
|
|
52
|
-
type: regex
|
|
53
|
-
language: typescript
|
|
54
|
-
pattern: "===\\s*undefined(?!.*null)|!==\\s*undefined(?!.*null)"
|
|
55
|
-
confidence: medium
|
|
56
|
-
description: Detects undefined check without null check
|
|
57
|
-
|
|
58
23
|
- id: ts-non-null-assertion
|
|
59
24
|
type: regex
|
|
60
25
|
language: typescript
|
|
61
26
|
pattern: "\\w+!\\.|\\w+!\\["
|
|
62
27
|
confidence: high
|
|
63
|
-
description: Detects non-null assertion operator
|
|
64
|
-
|
|
65
|
-
- id: ts-optional-chaining-missing
|
|
66
|
-
type: regex
|
|
67
|
-
language: typescript
|
|
68
|
-
pattern: "\\w+\\.\\w+\\.\\w+(?!\\?\\.)"
|
|
69
|
-
confidence: low
|
|
70
|
-
description: Detects deep access without optional chaining
|
|
28
|
+
description: Detects non-null assertion operator (unsafe type narrowing bypass)
|
|
71
29
|
|
|
72
30
|
testTemplates:
|
|
73
31
|
- id: pytest-null-undefined
|
|
@@ -71,7 +71,7 @@ detectionPatterns:
|
|
|
71
71
|
type: regex
|
|
72
72
|
language: typescript
|
|
73
73
|
pattern: "catch\\s*\\([^)]*\\)\\s*\\{(?!.*ECONNREFUSED|.*code)"
|
|
74
|
-
confidence:
|
|
74
|
+
confidence: medium
|
|
75
75
|
description: Detects catch block not checking error codes
|
|
76
76
|
|
|
77
77
|
- id: ts-socket-no-error-event
|
|
@@ -25,19 +25,12 @@ references:
|
|
|
25
25
|
- https://developer.chrome.com/docs/devtools/memory-problems/
|
|
26
26
|
|
|
27
27
|
detectionPatterns:
|
|
28
|
-
- id: python-
|
|
28
|
+
- id: python-global-list-append
|
|
29
29
|
type: regex
|
|
30
30
|
language: python
|
|
31
|
-
pattern: "\\
|
|
32
|
-
confidence:
|
|
33
|
-
description: Detects
|
|
34
|
-
|
|
35
|
-
- id: python-list-append-loop
|
|
36
|
-
type: regex
|
|
37
|
-
language: python
|
|
38
|
-
pattern: "while.*\\.append\\(|for.*\\.append\\("
|
|
39
|
-
confidence: low
|
|
40
|
-
description: Detects list growing in loop (verify bounds)
|
|
31
|
+
pattern: "^\\w+\\s*=\\s*\\[\\].*\\.append\\("
|
|
32
|
+
confidence: medium
|
|
33
|
+
description: Detects module-level list accumulation without bounds
|
|
41
34
|
|
|
42
35
|
- id: python-global-accumulator
|
|
43
36
|
type: regex
|
|
@@ -60,12 +53,12 @@ detectionPatterns:
|
|
|
60
53
|
confidence: medium
|
|
61
54
|
description: Detects potential circular references
|
|
62
55
|
|
|
63
|
-
- id: ts-
|
|
56
|
+
- id: ts-module-level-map
|
|
64
57
|
type: regex
|
|
65
58
|
language: typescript
|
|
66
|
-
pattern: "
|
|
67
|
-
confidence:
|
|
68
|
-
description: Detects
|
|
59
|
+
pattern: "^(?:export\\s+)?const\\s+\\w+\\s*=\\s*new\\s+Map\\(\\)"
|
|
60
|
+
confidence: medium
|
|
61
|
+
description: Detects module-level Map without eviction (potential memory leak in long-running servers)
|
|
69
62
|
|
|
70
63
|
- id: ts-event-listener-no-remove
|
|
71
64
|
type: regex
|