@arsh342/athena 0.2.5 → 0.3.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.
Files changed (169) hide show
  1. package/README.md +133 -36
  2. package/dist/data/popular-crates.json +1 -0
  3. package/dist/data/popular-npm.json +1 -0
  4. package/dist/data/popular-nuget.json +1 -0
  5. package/dist/data/popular-packagist.json +1 -0
  6. package/dist/data/popular-pypi.json +1 -0
  7. package/dist/index.cjs +27692 -8009
  8. package/dist/models/fast/athena-detect-fast-0.1.0.bin +0 -0
  9. package/dist/models/fast/athena-detect-fast-0.1.0.json +259 -0
  10. package/dist/skills/.athena-builtin +1 -0
  11. package/dist/skills/ai-generated-code/SKILL.md +40 -0
  12. package/dist/skills/ai-generated-code/fixtures/safe/a.go +4 -0
  13. package/dist/skills/ai-generated-code/fixtures/safe/a.js +2 -0
  14. package/dist/skills/ai-generated-code/fixtures/safe/a.py +1 -0
  15. package/dist/skills/ai-generated-code/fixtures/vuln/a.go +4 -0
  16. package/dist/skills/ai-generated-code/fixtures/vuln/a.js +2 -0
  17. package/dist/skills/ai-generated-code/fixtures/vuln/a.py +1 -0
  18. package/dist/skills/ai-generated-code/rules.json +54 -0
  19. package/dist/skills/aspnet/SKILL.md +41 -0
  20. package/dist/skills/aspnet/fixtures/safe/Startup.cs +9 -0
  21. package/dist/skills/aspnet/fixtures/vuln/Startup.cs +9 -0
  22. package/dist/skills/aspnet/rules.json +46 -0
  23. package/dist/skills/audit-context/SKILL.md +38 -0
  24. package/dist/skills/auth-sessions/SKILL.md +39 -0
  25. package/dist/skills/auth-sessions/fixtures/safe/a.js +3 -0
  26. package/dist/skills/auth-sessions/fixtures/safe/a.py +2 -0
  27. package/dist/skills/auth-sessions/fixtures/vuln/a.js +3 -0
  28. package/dist/skills/auth-sessions/fixtures/vuln/a.py +2 -0
  29. package/dist/skills/auth-sessions/rules.json +95 -0
  30. package/dist/skills/c-memory-safety/SKILL.md +35 -0
  31. package/dist/skills/c-memory-safety/fixtures/safe/a.c +5 -0
  32. package/dist/skills/c-memory-safety/fixtures/vuln/a.c +6 -0
  33. package/dist/skills/c-memory-safety/rules.json +54 -0
  34. package/dist/skills/differential-review/SKILL.md +37 -0
  35. package/dist/skills/django/SKILL.md +42 -0
  36. package/dist/skills/django/fixtures/safe/settings.py +3 -0
  37. package/dist/skills/django/fixtures/vuln/settings.py +2 -0
  38. package/dist/skills/django/fixtures/vuln/views.py +4 -0
  39. package/dist/skills/django/rules.json +59 -0
  40. package/dist/skills/docker/SKILL.md +36 -0
  41. package/dist/skills/docker/fixtures/safe/Dockerfile +4 -0
  42. package/dist/skills/docker/fixtures/safe/Dockerfile.multi +6 -0
  43. package/dist/skills/docker/fixtures/safe/app.dockerfile +3 -0
  44. package/dist/skills/docker/fixtures/vuln/Dockerfile +3 -0
  45. package/dist/skills/docker/rules.json +82 -0
  46. package/dist/skills/efcore/SKILL.md +40 -0
  47. package/dist/skills/efcore/fixtures/safe/Repo.cs +6 -0
  48. package/dist/skills/efcore/fixtures/vuln/Repo.cs +6 -0
  49. package/dist/skills/efcore/rules.json +28 -0
  50. package/dist/skills/express/SKILL.md +42 -0
  51. package/dist/skills/express/fixtures/safe/app.js +8 -0
  52. package/dist/skills/express/fixtures/vuln/app.js +6 -0
  53. package/dist/skills/express/rules.json +102 -0
  54. package/dist/skills/false-positive-check/SKILL.md +38 -0
  55. package/dist/skills/fastapi/SKILL.md +40 -0
  56. package/dist/skills/fastapi/fixtures/safe/main.py +4 -0
  57. package/dist/skills/fastapi/fixtures/vuln/main.py +4 -0
  58. package/dist/skills/fastapi/rules.json +32 -0
  59. package/dist/skills/file-uploads/SKILL.md +38 -0
  60. package/dist/skills/file-uploads/fixtures/safe/up.js +5 -0
  61. package/dist/skills/file-uploads/fixtures/safe/up.py +6 -0
  62. package/dist/skills/file-uploads/fixtures/vuln/up.js +5 -0
  63. package/dist/skills/file-uploads/fixtures/vuln/up.py +5 -0
  64. package/dist/skills/file-uploads/rules.json +52 -0
  65. package/dist/skills/file-uploads/taint.json +21 -0
  66. package/dist/skills/flask/SKILL.md +41 -0
  67. package/dist/skills/flask/fixtures/safe/app.py +5 -0
  68. package/dist/skills/flask/fixtures/vuln/app.py +5 -0
  69. package/dist/skills/flask/rules.json +46 -0
  70. package/dist/skills/github-actions/SKILL.md +36 -0
  71. package/dist/skills/github-actions/fixtures/safe/.github/workflows/ci.yml +16 -0
  72. package/dist/skills/github-actions/fixtures/vuln/.github/workflows/ci.yml +12 -0
  73. package/dist/skills/github-actions/rules.json +85 -0
  74. package/dist/skills/go-web/SKILL.md +42 -0
  75. package/dist/skills/go-web/fixtures/safe/main.go +13 -0
  76. package/dist/skills/go-web/fixtures/vuln/main.go +8 -0
  77. package/dist/skills/go-web/rules.json +29 -0
  78. package/dist/skills/go-web/taint.json +14 -0
  79. package/dist/skills/gorm/SKILL.md +40 -0
  80. package/dist/skills/gorm/fixtures/safe/q.go +5 -0
  81. package/dist/skills/gorm/fixtures/vuln/q.go +5 -0
  82. package/dist/skills/gorm/rules.json +32 -0
  83. package/dist/skills/hibernate/SKILL.md +43 -0
  84. package/dist/skills/hibernate/fixtures/safe/Dao.java +6 -0
  85. package/dist/skills/hibernate/fixtures/vuln/Dao.java +6 -0
  86. package/dist/skills/hibernate/rules.json +28 -0
  87. package/dist/skills/insecure-defaults/SKILL.md +35 -0
  88. package/dist/skills/insecure-defaults-code/SKILL.md +37 -0
  89. package/dist/skills/insecure-defaults-code/fixtures/safe/a.js +2 -0
  90. package/dist/skills/insecure-defaults-code/fixtures/safe/a.py +2 -0
  91. package/dist/skills/insecure-defaults-code/fixtures/vuln/a.js +1 -0
  92. package/dist/skills/insecure-defaults-code/fixtures/vuln/a.py +2 -0
  93. package/dist/skills/insecure-defaults-code/rules.json +24 -0
  94. package/dist/skills/laravel/SKILL.md +41 -0
  95. package/dist/skills/laravel/fixtures/safe/User.php +5 -0
  96. package/dist/skills/laravel/fixtures/safe/app/Http/Middleware/VerifyCsrfToken.php +4 -0
  97. package/dist/skills/laravel/fixtures/safe/resources/views/a.blade.php +2 -0
  98. package/dist/skills/laravel/fixtures/vuln/User.php +5 -0
  99. package/dist/skills/laravel/fixtures/vuln/app/Http/Middleware/VerifyCsrfToken.php +4 -0
  100. package/dist/skills/laravel/fixtures/vuln/resources/views/a.blade.php +1 -0
  101. package/dist/skills/laravel/rules.json +62 -0
  102. package/dist/skills/lifecycle-and-races/SKILL.md +40 -0
  103. package/dist/skills/llm-app-security/SKILL.md +45 -0
  104. package/dist/skills/llm-app-security/fixtures/safe/a.js +6 -0
  105. package/dist/skills/llm-app-security/fixtures/safe/a.py +3 -0
  106. package/dist/skills/llm-app-security/fixtures/vuln/a.js +6 -0
  107. package/dist/skills/llm-app-security/fixtures/vuln/a.py +3 -0
  108. package/dist/skills/llm-app-security/rules.json +51 -0
  109. package/dist/skills/nestjs/SKILL.md +41 -0
  110. package/dist/skills/nestjs/fixtures/safe/main.ts +7 -0
  111. package/dist/skills/nestjs/fixtures/vuln/main.ts +5 -0
  112. package/dist/skills/nestjs/rules.json +47 -0
  113. package/dist/skills/nextjs/SKILL.md +41 -0
  114. package/dist/skills/nextjs/fixtures/safe/page.js +2 -0
  115. package/dist/skills/nextjs/fixtures/vuln/page.js +2 -0
  116. package/dist/skills/nextjs/rules.json +48 -0
  117. package/dist/skills/payments-webhooks/SKILL.md +35 -0
  118. package/dist/skills/payments-webhooks/fixtures/safe/hook.js +5 -0
  119. package/dist/skills/payments-webhooks/fixtures/vuln/hook.js +4 -0
  120. package/dist/skills/payments-webhooks/rules.json +33 -0
  121. package/dist/skills/php-hardening/SKILL.md +36 -0
  122. package/dist/skills/php-hardening/fixtures/safe/a.php +3 -0
  123. package/dist/skills/php-hardening/fixtures/vuln/a.php +3 -0
  124. package/dist/skills/php-hardening/rules.json +42 -0
  125. package/dist/skills/prisma/SKILL.md +41 -0
  126. package/dist/skills/prisma/fixtures/safe/q.js +2 -0
  127. package/dist/skills/prisma/fixtures/vuln/q.js +2 -0
  128. package/dist/skills/prisma/rules.json +28 -0
  129. package/dist/skills/react/SKILL.md +40 -0
  130. package/dist/skills/react/fixtures/safe/a.jsx +2 -0
  131. package/dist/skills/react/fixtures/vuln/a.jsx +2 -0
  132. package/dist/skills/react/rules.json +47 -0
  133. package/dist/skills/rust-unsafe-ffi/SKILL.md +35 -0
  134. package/dist/skills/rust-unsafe-ffi/fixtures/safe/a.rs +3 -0
  135. package/dist/skills/rust-unsafe-ffi/fixtures/vuln/a.rs +7 -0
  136. package/dist/skills/rust-unsafe-ffi/rules.json +41 -0
  137. package/dist/skills/rust-web/SKILL.md +45 -0
  138. package/dist/skills/rust-web/fixtures/safe/main.rs +4 -0
  139. package/dist/skills/rust-web/fixtures/vuln/main.rs +4 -0
  140. package/dist/skills/rust-web/rules.json +22 -0
  141. package/dist/skills/sharp-edges/SKILL.md +34 -0
  142. package/dist/skills/sharp-edges-code/SKILL.md +35 -0
  143. package/dist/skills/sharp-edges-code/fixtures/safe/a.py +3 -0
  144. package/dist/skills/sharp-edges-code/fixtures/vuln/a.py +2 -0
  145. package/dist/skills/sharp-edges-code/rules.json +23 -0
  146. package/dist/skills/shell-hardening/SKILL.md +35 -0
  147. package/dist/skills/shell-hardening/fixtures/safe/a.sh +3 -0
  148. package/dist/skills/shell-hardening/fixtures/vuln/a.sh +2 -0
  149. package/dist/skills/shell-hardening/rules.json +29 -0
  150. package/dist/skills/spec-vs-code/SKILL.md +34 -0
  151. package/dist/skills/spring/SKILL.md +45 -0
  152. package/dist/skills/spring/fixtures/safe/Sec.java +7 -0
  153. package/dist/skills/spring/fixtures/safe/src/main/resources/application.properties +1 -0
  154. package/dist/skills/spring/fixtures/vuln/Sec.java +8 -0
  155. package/dist/skills/spring/fixtures/vuln/src/main/resources/application.properties +1 -0
  156. package/dist/skills/spring/rules.json +75 -0
  157. package/dist/skills/sqlalchemy/SKILL.md +40 -0
  158. package/dist/skills/sqlalchemy/fixtures/safe/q.py +3 -0
  159. package/dist/skills/sqlalchemy/fixtures/vuln/q.py +3 -0
  160. package/dist/skills/sqlalchemy/rules.json +28 -0
  161. package/dist/skills/typeorm/SKILL.md +40 -0
  162. package/dist/skills/typeorm/fixtures/safe/q.ts +4 -0
  163. package/dist/skills/typeorm/fixtures/vuln/q.ts +4 -0
  164. package/dist/skills/typeorm/rules.json +32 -0
  165. package/dist/skills/variant-analysis/SKILL.md +38 -0
  166. package/package.json +11 -2
  167. package/null-pointer-font/NullPointer-8MpD.ttf +0 -0
  168. package/null-pointer-font/info.txt +0 -2
  169. package/null-pointer-font/misc/README.txt +0 -68
@@ -0,0 +1,259 @@
1
+ {
2
+ "benchmark": {
3
+ "C": 2.0,
4
+ "classes": [
5
+ "human",
6
+ "ai",
7
+ "refined"
8
+ ],
9
+ "collected": "2026-11-19T09:48:47.071644+00:00",
10
+ "newest": {
11
+ "go": {
12
+ "ai_recall": 0.5194805194805194,
13
+ "n": 462
14
+ },
15
+ "java": {
16
+ "ai_recall": 0.0,
17
+ "n": 20
18
+ },
19
+ "javascript": {
20
+ "ai_recall": 0.9,
21
+ "n": 400
22
+ },
23
+ "php": {
24
+ "ai_recall": 0.0,
25
+ "n": 1
26
+ },
27
+ "python": {
28
+ "ai_recall": 0.9347990902198635,
29
+ "n": 1319
30
+ },
31
+ "rust": {
32
+ "ai_recall": 1.0,
33
+ "n": 2
34
+ },
35
+ "shell": {
36
+ "ai_recall": 0.5,
37
+ "n": 2
38
+ },
39
+ "tsx": {
40
+ "ai_recall": 0.8938356164383562,
41
+ "n": 584
42
+ },
43
+ "typescript": {
44
+ "ai_recall": 0.7848347375243033,
45
+ "n": 1543
46
+ }
47
+ },
48
+ "split_sizes": {
49
+ "dev": 5032,
50
+ "newest": 4333,
51
+ "test": 5317,
52
+ "train": 39333
53
+ }
54
+ },
55
+ "classes": [
56
+ "human",
57
+ "ai",
58
+ "refined"
59
+ ],
60
+ "featureSpec": "fs1",
61
+ "languages": {
62
+ "c": {
63
+ "enabled": false,
64
+ "reason": "too little test data (62 human / 0 ai)",
65
+ "test": {
66
+ "ai_repos": 0,
67
+ "ais": 0,
68
+ "f1": 0.0,
69
+ "fpr": 0.0,
70
+ "human_repos": 2,
71
+ "humans": 62,
72
+ "n": 62,
73
+ "precision": 0.0,
74
+ "recall": 0.0
75
+ },
76
+ "threshold": 0.5
77
+ },
78
+ "cpp": {
79
+ "enabled": false,
80
+ "reason": "too little test data (341 human / 0 ai)",
81
+ "test": {
82
+ "ai_repos": 0,
83
+ "ais": 0,
84
+ "f1": 0.0,
85
+ "fpr": 0.01466275659824047,
86
+ "human_repos": 3,
87
+ "humans": 341,
88
+ "n": 341,
89
+ "precision": 0.0,
90
+ "recall": 0.0
91
+ },
92
+ "threshold": 0.5
93
+ },
94
+ "csharp": {
95
+ "enabled": false,
96
+ "reason": "too little test data (398 human / 3 ai)",
97
+ "test": {
98
+ "ai_repos": 1,
99
+ "ais": 3,
100
+ "f1": 0.0,
101
+ "fpr": 0.002512562814070352,
102
+ "human_repos": 2,
103
+ "humans": 398,
104
+ "n": 401,
105
+ "precision": 0.0,
106
+ "recall": 0.0
107
+ },
108
+ "threshold": 0.5
109
+ },
110
+ "go": {
111
+ "enabled": false,
112
+ "reason": "too few distinct repositories in the test split (1 human / 2 ai, need 5 each)",
113
+ "test": {
114
+ "ai_repos": 2,
115
+ "ais": 495,
116
+ "f1": 0.6299862448418156,
117
+ "fpr": 0.01507537688442211,
118
+ "human_repos": 1,
119
+ "humans": 199,
120
+ "n": 694,
121
+ "precision": 0.9870689655172413,
122
+ "recall": 0.4626262626262626
123
+ },
124
+ "threshold": 0.5
125
+ },
126
+ "java": {
127
+ "enabled": false,
128
+ "reason": "too little test data (376 human / 0 ai)",
129
+ "test": {
130
+ "ai_repos": 0,
131
+ "ais": 0,
132
+ "f1": 0.0,
133
+ "fpr": 0.0,
134
+ "human_repos": 4,
135
+ "humans": 376,
136
+ "n": 376,
137
+ "precision": 0.0,
138
+ "recall": 0.0
139
+ },
140
+ "threshold": 0.5
141
+ },
142
+ "javascript": {
143
+ "enabled": false,
144
+ "reason": "too few distinct repositories in the test split (5 human / 4 ai, need 5 each)",
145
+ "test": {
146
+ "ai_repos": 4,
147
+ "ais": 874,
148
+ "f1": 0.9429747207524986,
149
+ "fpr": 0.06613756613756613,
150
+ "human_repos": 5,
151
+ "humans": 378,
152
+ "n": 1252,
153
+ "precision": 0.969770253929867,
154
+ "recall": 0.9176201372997712
155
+ },
156
+ "threshold": 0.5
157
+ },
158
+ "php": {
159
+ "enabled": false,
160
+ "reason": "too little test data (388 human / 0 ai)",
161
+ "test": {
162
+ "ai_repos": 0,
163
+ "ais": 0,
164
+ "f1": 0.0,
165
+ "fpr": 0.0,
166
+ "human_repos": 3,
167
+ "humans": 388,
168
+ "n": 388,
169
+ "precision": 0.0,
170
+ "recall": 0.0
171
+ },
172
+ "threshold": 0.5
173
+ },
174
+ "python": {
175
+ "enabled": false,
176
+ "reason": "too few distinct repositories in the test split (5 human / 2 ai, need 5 each)",
177
+ "test": {
178
+ "ai_repos": 2,
179
+ "ais": 167,
180
+ "f1": 0.6485355648535566,
181
+ "fpr": 0.3,
182
+ "human_repos": 5,
183
+ "humans": 520,
184
+ "n": 687,
185
+ "precision": 0.4983922829581994,
186
+ "recall": 0.9281437125748503
187
+ },
188
+ "threshold": 0.5
189
+ },
190
+ "rust": {
191
+ "enabled": false,
192
+ "reason": "too few distinct repositories in the test split (1 human / 2 ai, need 5 each)",
193
+ "test": {
194
+ "ai_repos": 2,
195
+ "ais": 216,
196
+ "f1": 0.5420560747663552,
197
+ "fpr": 0.09090909090909091,
198
+ "human_repos": 1,
199
+ "humans": 198,
200
+ "n": 414,
201
+ "precision": 0.8285714285714286,
202
+ "recall": 0.4027777777777778
203
+ },
204
+ "threshold": 0.55
205
+ },
206
+ "shell": {
207
+ "enabled": false,
208
+ "reason": "too few distinct repositories in the test split (2 human / 3 ai, need 5 each)",
209
+ "test": {
210
+ "ai_repos": 3,
211
+ "ais": 31,
212
+ "f1": 0.7719298245614036,
213
+ "fpr": 0.03418803418803419,
214
+ "human_repos": 2,
215
+ "humans": 117,
216
+ "n": 148,
217
+ "precision": 0.8461538461538461,
218
+ "recall": 0.7096774193548387
219
+ },
220
+ "threshold": 0.5
221
+ },
222
+ "tsx": {
223
+ "enabled": false,
224
+ "reason": "too little test data (4 human / 59 ai)",
225
+ "test": {
226
+ "ai_repos": 1,
227
+ "ais": 59,
228
+ "f1": 0.9217391304347826,
229
+ "fpr": 0.75,
230
+ "human_repos": 1,
231
+ "humans": 4,
232
+ "n": 63,
233
+ "precision": 0.9464285714285714,
234
+ "recall": 0.8983050847457628
235
+ },
236
+ "threshold": 0.5
237
+ },
238
+ "typescript": {
239
+ "enabled": false,
240
+ "reason": "too few distinct repositories in the test split (1 human / 1 ai, need 5 each)",
241
+ "test": {
242
+ "ai_repos": 1,
243
+ "ais": 222,
244
+ "f1": 0.8935185185185184,
245
+ "fpr": 0.10365853658536585,
246
+ "human_repos": 1,
247
+ "humans": 164,
248
+ "n": 386,
249
+ "precision": 0.919047619047619,
250
+ "recall": 0.8693693693693694
251
+ },
252
+ "threshold": 0.64
253
+ }
254
+ },
255
+ "layout": "f16 weights [class][feature] then f32 biases[class]",
256
+ "nFeatures": 262188,
257
+ "temperature": 1.1711810272326963,
258
+ "version": "0.1.0"
259
+ }
@@ -0,0 +1 @@
1
+ Marker: this directory is Athena's built-in skills folder.
@@ -0,0 +1,40 @@
1
+ ---
2
+ name: ai-generated-code
3
+ description: 'Flaws AI-written code shows most often: open CORS defaults and credentials in logs (and, via the core checks, invented packages and APIs).'
4
+ version: 1.0.0
5
+ license: MIT
6
+ author: Athena
7
+ appliesTo:
8
+ languages:
9
+ - js
10
+ - python
11
+ - go
12
+ detect:
13
+ always: true
14
+ categories:
15
+ - ai-code
16
+ - cors
17
+ - info-leak
18
+ ---
19
+
20
+ ## When this applies
21
+
22
+ Any codebase, most useful where the AI estimate is high.
23
+
24
+ ## How to investigate
25
+
26
+ AI assistants favour permissive defaults (CORS *, debug logging, verify=False) and may log secrets while debugging. Also check for packages and APIs that do not exist.
27
+
28
+ ## Verification checklist
29
+
30
+ - Is CORS open to every origin?
31
+ - Do log statements print passwords, tokens or keys?
32
+
33
+ ## Fixes
34
+
35
+ Restrict CORS, remove debug logging of secrets, verify every dependency exists and is the intended one.
36
+
37
+ ## References
38
+
39
+ - https://www.veracode.com/state-of-software-security-report
40
+
@@ -0,0 +1,4 @@
1
+ package m
2
+ func f() {
3
+ fmt.Println("started")
4
+ }
@@ -0,0 +1,2 @@
1
+ app.use(cors({ origin: ['https://app.example.org'] }));
2
+ console.log('user login', user.id);
@@ -0,0 +1 @@
1
+ print('login ok')
@@ -0,0 +1,4 @@
1
+ package m
2
+ func f() {
3
+ fmt.Println("key", apiKey) // EXPECT ai-generated-code.logs-credentials
4
+ }
@@ -0,0 +1,2 @@
1
+ app.use(cors()); // EXPECT ai-generated-code.cors-allow-all-default
2
+ console.log('user login', user.password); // EXPECT ai-generated-code.logs-credentials
@@ -0,0 +1 @@
1
+ print('token is', token) # EXPECT ai-generated-code.logs-credentials
@@ -0,0 +1,54 @@
1
+ {
2
+ "rules": [
3
+ {
4
+ "id": "ai-generated-code.cors-allow-all-default",
5
+ "title": "CORS left open to every origin",
6
+ "severity": "LOW",
7
+ "cwe": [
8
+ 942
9
+ ],
10
+ "category": "cors",
11
+ "why": "Starter code often calls cors() with no options, which allows every origin.",
12
+ "fix": "List the allowed origins.",
13
+ "match": {
14
+ "kind": "line",
15
+ "line": "\\bapp\\.use\\(\\s*cors\\(\\s*\\)\\s*\\)|allow_origins\\s*=\\s*\\[\\s*[\\'\"]\\*[\\'\"]\\s*\\]|origin\\s*:\\s*[\\'\"]\\*[\\'\"]"
16
+ },
17
+ "families": [
18
+ "js",
19
+ "python"
20
+ ],
21
+ "confidence": "low"
22
+ },
23
+ {
24
+ "id": "ai-generated-code.logs-credentials",
25
+ "title": "Credential printed to the log",
26
+ "severity": "MEDIUM",
27
+ "cwe": [
28
+ 532
29
+ ],
30
+ "category": "info-leak",
31
+ "why": "Debug statements that print passwords, tokens or keys leave them in log files and monitoring systems.",
32
+ "fix": "Remove the log or log only that the value exists.",
33
+ "match": {
34
+ "kind": "line",
35
+ "line": "(?:console\\.(?:log|info|debug)|\\bprint|logger\\.(?:info|debug)|log\\.(?:info|debug|Printf|Println)|fmt\\.Print\\w*)\\(",
36
+ "where": [
37
+ {
38
+ "op": "lineMatches",
39
+ "regex": "(?:[,(]\\s*[\\w.]*(?:password|passwd|secret|token|api_?key)\\w*\\s*(?:[,)]|$)|\\$\\{\\s*[\\w.]*(?:password|passwd|secret|token|api_?key)\\w*\\s*\\}|\\{[\\w.]*(?:password|passwd|secret|token|api_?key)\\w*\\})"
40
+ },
41
+ {
42
+ "op": "lineNotMatches",
43
+ "regex": "redact|mask|\\*{3}"
44
+ }
45
+ ]
46
+ },
47
+ "families": [
48
+ "js",
49
+ "python",
50
+ "go"
51
+ ]
52
+ }
53
+ ]
54
+ }
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: aspnet
3
+ description: 'ASP.NET Core: CORS and cookie settings.'
4
+ version: 1.0.0
5
+ license: MIT
6
+ author: Athena
7
+ appliesTo:
8
+ languages:
9
+ - csharp
10
+ frameworks:
11
+ - aspnetcore
12
+ detect:
13
+ imports:
14
+ - Microsoft.AspNetCore
15
+ dependencies:
16
+ - microsoft.aspnetcore
17
+ categories:
18
+ - cors
19
+ - session
20
+ ---
21
+
22
+ ## When this applies
23
+
24
+ Projects that use ASP.NET Core.
25
+
26
+ ## How to investigate
27
+
28
+ Check CORS policies, cookie options and antiforgery attributes.
29
+
30
+ ## Verification checklist
31
+
32
+ - AllowAnyOrigin together with AllowCredentials?
33
+
34
+ ## Fixes
35
+
36
+ Name explicit origins; set Secure and HttpOnly cookie policies.
37
+
38
+ ## References
39
+
40
+ - https://learn.microsoft.com/aspnet/core/security/
41
+
@@ -0,0 +1,9 @@
1
+ using Microsoft.AspNetCore.Builder;
2
+ class S {
3
+ void C(CorsPolicyBuilder b) {
4
+ b.WithOrigins("https://app.example.org").AllowCredentials();
5
+ }
6
+ void O(CookieBuilder c) {
7
+ c.SecurePolicy = CookieSecurePolicy.Always;
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ using Microsoft.AspNetCore.Builder;
2
+ class S {
3
+ void C(CorsPolicyBuilder b) {
4
+ b.AllowAnyOrigin().AllowCredentials(); // EXPECT aspnet.cors-any-origin-credentials
5
+ }
6
+ void O(CookieBuilder c) {
7
+ c.SecurePolicy = CookieSecurePolicy.None; // EXPECT aspnet.cookie-secure-none
8
+ }
9
+ }
@@ -0,0 +1,46 @@
1
+ {
2
+ "rules": [
3
+ {
4
+ "id": "aspnet.cors-any-origin-credentials",
5
+ "title": "CORS policy allows any origin and credentials",
6
+ "severity": "MEDIUM",
7
+ "cwe": [
8
+ 942
9
+ ],
10
+ "category": "cors",
11
+ "why": "AllowAnyOrigin combined with credentials lets other sites make authenticated calls.",
12
+ "fix": "Use WithOrigins(...).",
13
+ "match": {
14
+ "kind": "line",
15
+ "line": "AllowAnyOrigin\\(\\)",
16
+ "where": [
17
+ {
18
+ "op": "fileTextMatches",
19
+ "regex": "AllowCredentials\\(\\)"
20
+ }
21
+ ]
22
+ },
23
+ "families": [
24
+ "csharp"
25
+ ]
26
+ },
27
+ {
28
+ "id": "aspnet.cookie-secure-none",
29
+ "title": "Cookie policy allows plain HTTP",
30
+ "severity": "MEDIUM",
31
+ "cwe": [
32
+ 614
33
+ ],
34
+ "category": "session",
35
+ "why": "CookieSecurePolicy.None sends the cookie over HTTP.",
36
+ "fix": "Use Always (or SameAsRequest behind TLS-terminating proxies with care).",
37
+ "match": {
38
+ "kind": "line",
39
+ "line": "SecurePolicy\\s*=\\s*CookieSecurePolicy\\.None"
40
+ },
41
+ "families": [
42
+ "csharp"
43
+ ]
44
+ }
45
+ ]
46
+ }
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: audit-context
3
+ description: 'Understand a codebase before hunting for bugs: entry points, trust boundaries, data stores and who can reach what.'
4
+ version: 1.0.0
5
+ license: MIT
6
+ author: Athena
7
+ appliesTo:
8
+ detect:
9
+ always: true
10
+ categories:
11
+ - audit
12
+ ---
13
+
14
+ ## When this applies
15
+
16
+ Start of any security review of an unfamiliar codebase, or when a finding needs context.
17
+
18
+ ## How to investigate
19
+
20
+ 1. List entry points (routes, CLI commands, consumers, uploads, websockets) and mark each public, authenticated or internal.
21
+ 2. Draw trust boundaries: where does data cross from outside to inside, and which stores hold sensitive data?
22
+ 3. Note the guards each entry point goes through (middleware, decorators, annotations).
23
+ 4. Only then read individual functions, one at a time, noting what each assumes about its inputs.
24
+
25
+ ## Verification checklist
26
+
27
+ - Can an unauthenticated caller reach the code?
28
+ - Which data does it touch?
29
+ - What does the caller guarantee about the input?
30
+
31
+ ## Fixes
32
+
33
+ Record the map (entry points, guards, stores) with the findings so reviewers can check reachability quickly.
34
+
35
+ ## References
36
+
37
+ - https://owasp.org/www-project-application-security-verification-standard/
38
+
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: auth-sessions
3
+ description: 'Authentication and sessions: token storage, password hashing cost and token lifetime.'
4
+ version: 1.0.0
5
+ license: MIT
6
+ author: Athena
7
+ appliesTo:
8
+ languages:
9
+ - js
10
+ - python
11
+ detect:
12
+ always: true
13
+ categories:
14
+ - authn
15
+ - session
16
+ ---
17
+
18
+ ## When this applies
19
+
20
+ Code that logs users in, stores tokens or hashes passwords.
21
+
22
+ ## How to investigate
23
+
24
+ Check where tokens are stored, bcrypt cost, token expiry and refresh rotation.
25
+
26
+ ## Verification checklist
27
+
28
+ - Are tokens in localStorage (readable by any script)?
29
+ - Is the password hash cost at least 10?
30
+ - Do tokens expire?
31
+
32
+ ## Fixes
33
+
34
+ Store tokens in httpOnly cookies, use cost >= 10 (or argon2id), set expiresIn, rotate refresh tokens atomically.
35
+
36
+ ## References
37
+
38
+ - https://cheatsheetseries.owasp.org/cheatsheets/Session_Management_Cheat_Sheet.html
39
+
@@ -0,0 +1,3 @@
1
+ document.cookie = 'x=1';
2
+ bcrypt.hashSync(pw, 12);
3
+ const t = jwt.sign({ id }, key, { expiresIn: '15m' });
@@ -0,0 +1,2 @@
1
+ import bcrypt
2
+ salt = bcrypt.gensalt(rounds=12)
@@ -0,0 +1,3 @@
1
+ localStorage.setItem('authToken', t); // EXPECT auth-sessions.jwt-in-localstorage
2
+ bcrypt.hashSync(pw, 8); // EXPECT auth-sessions.bcrypt-low-cost
3
+ const t = jwt.sign({ id }, key); // EXPECT auth-sessions.jwt-without-expiry
@@ -0,0 +1,2 @@
1
+ import bcrypt
2
+ salt = bcrypt.gensalt(rounds=6) # EXPECT auth-sessions.bcrypt-low-rounds-py
@@ -0,0 +1,95 @@
1
+ {
2
+ "rules": [
3
+ {
4
+ "id": "auth-sessions.jwt-in-localstorage",
5
+ "title": "Auth token stored in localStorage",
6
+ "severity": "MEDIUM",
7
+ "cwe": [
8
+ 922
9
+ ],
10
+ "category": "session",
11
+ "why": "Any script on the page (including a compromised dependency) can read localStorage and steal the token.",
12
+ "fix": "Keep tokens in httpOnly, Secure, SameSite cookies.",
13
+ "match": {
14
+ "kind": "line",
15
+ "line": "localStorage\\.setItem\\(\\s*[\\'\"][^\\'\"]*(?:token|jwt)[^\\'\"]*[\\'\"]"
16
+ },
17
+ "families": [
18
+ "js"
19
+ ]
20
+ },
21
+ {
22
+ "id": "auth-sessions.bcrypt-low-cost",
23
+ "title": "bcrypt cost below 10",
24
+ "severity": "MEDIUM",
25
+ "cwe": [
26
+ 916
27
+ ],
28
+ "category": "crypto",
29
+ "why": "Low bcrypt work factors make stolen hashes cheap to crack.",
30
+ "fix": "Use 12 or higher.",
31
+ "match": {
32
+ "kind": "call",
33
+ "callee": "^bcrypt\\.(?:hash|hashSync|genSalt|genSaltSync)$",
34
+ "where": [
35
+ {
36
+ "op": "argMatches",
37
+ "index": 1,
38
+ "regex": "^[1-9]$"
39
+ }
40
+ ]
41
+ },
42
+ "families": [
43
+ "js"
44
+ ]
45
+ },
46
+ {
47
+ "id": "auth-sessions.jwt-without-expiry",
48
+ "title": "JWT signed without an expiry",
49
+ "severity": "MEDIUM",
50
+ "cwe": [
51
+ 613
52
+ ],
53
+ "category": "session",
54
+ "why": "A token that never expires stays valid forever if it leaks.",
55
+ "fix": "Set expiresIn (minutes for access tokens).",
56
+ "match": {
57
+ "kind": "call",
58
+ "callee": "^(?:jwt|jsonwebtoken)\\.sign$",
59
+ "where": [
60
+ {
61
+ "op": "callTextNotMatches",
62
+ "regex": "expiresIn|exp\\s*:"
63
+ }
64
+ ]
65
+ },
66
+ "families": [
67
+ "js"
68
+ ]
69
+ },
70
+ {
71
+ "id": "auth-sessions.bcrypt-low-rounds-py",
72
+ "title": "bcrypt rounds below 10",
73
+ "severity": "MEDIUM",
74
+ "cwe": [
75
+ 916
76
+ ],
77
+ "category": "crypto",
78
+ "why": "Low bcrypt work factors make stolen hashes cheap to crack.",
79
+ "fix": "Use rounds=12 or higher.",
80
+ "match": {
81
+ "kind": "call",
82
+ "callee": "^bcrypt\\.gensalt$",
83
+ "where": [
84
+ {
85
+ "op": "callTextMatches",
86
+ "regex": "rounds\\s*=\\s*[1-9]\\b"
87
+ }
88
+ ]
89
+ },
90
+ "families": [
91
+ "python"
92
+ ]
93
+ }
94
+ ]
95
+ }