@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,35 @@
1
+ ---
2
+ name: sharp-edges-code
3
+ description: 'Security decisions made with APIs that do not guarantee them: assert in Python.'
4
+ version: 1.0.0
5
+ license: MIT
6
+ author: Athena
7
+ appliesTo:
8
+ languages:
9
+ - python
10
+ detect:
11
+ always: true
12
+ categories:
13
+ - api-misuse
14
+ ---
15
+
16
+ ## When this applies
17
+
18
+ Python code.
19
+
20
+ ## How to investigate
21
+
22
+ Python strips assert statements under -O, so asserts must never enforce authorization or validation.
23
+
24
+ ## Verification checklist
25
+
26
+ - Is an assert protecting a security decision?
27
+
28
+ ## Fixes
29
+
30
+ Raise an explicit exception instead.
31
+
32
+ ## References
33
+
34
+ - https://docs.python.org/3/reference/simple_stmts.html#the-assert-statement
35
+
@@ -0,0 +1,3 @@
1
+ def f(user):
2
+ if not user.is_admin:
3
+ raise PermissionError('admin only')
@@ -0,0 +1,2 @@
1
+ def f(user):
2
+ assert user.is_admin # EXPECT sharp-edges-code.assert-for-security
@@ -0,0 +1,23 @@
1
+ {
2
+ "rules": [
3
+ {
4
+ "id": "sharp-edges-code.assert-for-security",
5
+ "title": "assert used for a security decision",
6
+ "severity": "MEDIUM",
7
+ "cwe": [
8
+ 617,
9
+ 617
10
+ ],
11
+ "category": "api-misuse",
12
+ "why": "assert is removed when Python runs with -O, so the check disappears in optimized deployments.",
13
+ "fix": "Raise PermissionError/ValueError explicitly.",
14
+ "match": {
15
+ "kind": "line",
16
+ "line": "^\\s*assert\\s+.*(?:user|admin|auth|permission|is_authenticated|is_staff|role)"
17
+ },
18
+ "families": [
19
+ "python"
20
+ ]
21
+ }
22
+ ]
23
+ }
@@ -0,0 +1,35 @@
1
+ ---
2
+ name: shell-hardening
3
+ description: 'Shell scripts: strict mode.'
4
+ version: 1.0.0
5
+ license: MIT
6
+ author: Athena
7
+ appliesTo:
8
+ languages:
9
+ - shell
10
+ detect:
11
+ always: true
12
+ categories:
13
+ - config
14
+ ---
15
+
16
+ ## When this applies
17
+
18
+ Bash/sh scripts.
19
+
20
+ ## How to investigate
21
+
22
+ Check for set -euo pipefail near the top, quoting of expansions and use of mktemp.
23
+
24
+ ## Verification checklist
25
+
26
+ - Does the script stop on the first error and on unset variables?
27
+
28
+ ## Fixes
29
+
30
+ Add set -euo pipefail after the shebang.
31
+
32
+ ## References
33
+
34
+ - https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
35
+
@@ -0,0 +1,3 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ echo hi
@@ -0,0 +1,2 @@
1
+ #!/bin/bash # EXPECT shell-hardening.missing-strict-mode
2
+ echo hi
@@ -0,0 +1,29 @@
1
+ {
2
+ "rules": [
3
+ {
4
+ "id": "shell-hardening.missing-strict-mode",
5
+ "title": "Script without strict mode",
6
+ "severity": "LOW",
7
+ "cwe": [
8
+ 754
9
+ ],
10
+ "category": "config",
11
+ "why": "Without set -e/-u a failed command is ignored and an unset variable expands to an empty string (rm -rf \"$DIR/\").",
12
+ "fix": "Add set -euo pipefail.",
13
+ "match": {
14
+ "kind": "line",
15
+ "line": "^#!\\s*/(?:usr/)?bin/(?:env\\s+)?(?:ba|z)?sh\\b",
16
+ "where": [
17
+ {
18
+ "op": "fileTextNotMatches",
19
+ "regex": "^\\s*set\\s+-[a-z]*e[a-z]*u|^\\s*set\\s+-euo|^\\s*set\\s+-o\\s+errexit"
20
+ }
21
+ ]
22
+ },
23
+ "families": [
24
+ "shell"
25
+ ],
26
+ "confidence": "low"
27
+ }
28
+ ]
29
+ }
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: spec-vs-code
3
+ description: Compare what names, comments and docs promise with what the code actually does.
4
+ version: 1.0.0
5
+ license: MIT
6
+ author: Athena
7
+ appliesTo:
8
+ detect:
9
+ always: true
10
+ categories:
11
+ - intent
12
+ ---
13
+
14
+ ## When this applies
15
+
16
+ When documentation, comments or function names describe security behavior (sanitizes, authenticates, validates).
17
+
18
+ ## How to investigate
19
+
20
+ For each promise, find the code that fulfils it. A validator that cannot fail, a comment that says "sanitize" next to unsanitized code, or a README that claims encryption the code lacks are findings.
21
+
22
+ ## Verification checklist
23
+
24
+ - Name the line that does what the comment says.
25
+ - If none exists, either implement it or correct the claim.
26
+
27
+ ## Fixes
28
+
29
+ Make the code match the promise, or fix the documentation.
30
+
31
+ ## References
32
+
33
+ - https://cwe.mitre.org/data/definitions/1116.html
34
+
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: spring
3
+ description: 'Spring Security and Boot: CSRF, open authorization, CORS and actuator exposure.'
4
+ version: 1.0.0
5
+ license: MIT
6
+ author: Athena
7
+ appliesTo:
8
+ languages:
9
+ - java
10
+ frameworks:
11
+ - spring
12
+ detect:
13
+ dependencies:
14
+ - spring-boot
15
+ - spring-security
16
+ - spring-web
17
+ imports:
18
+ - org.springframework
19
+ categories:
20
+ - authn
21
+ - config
22
+ - cors
23
+ ---
24
+
25
+ ## When this applies
26
+
27
+ Projects that use Spring.
28
+
29
+ ## How to investigate
30
+
31
+ Review the SecurityFilterChain, @CrossOrigin annotations and management.endpoints settings.
32
+
33
+ ## Verification checklist
34
+
35
+ - Does anyRequest() require authentication?
36
+ - Which actuator endpoints are exposed?
37
+
38
+ ## Fixes
39
+
40
+ Authenticate anyRequest(), keep CSRF on for browser sessions, expose only health and info.
41
+
42
+ ## References
43
+
44
+ - https://docs.spring.io/spring-security/reference/
45
+
@@ -0,0 +1,7 @@
1
+ class Sec {
2
+ void c(HttpSecurity http) throws Exception {
3
+ http.authorizeRequests().anyRequest().authenticated();
4
+ }
5
+ }
6
+ @CrossOrigin(origins = "https://app.example.org")
7
+ class Api {}
@@ -0,0 +1 @@
1
+ management.endpoints.web.exposure.include=health,info
@@ -0,0 +1,8 @@
1
+ class Sec {
2
+ void c(HttpSecurity http) throws Exception {
3
+ http.csrf().disable(); // EXPECT spring.csrf-disabled
4
+ http.authorizeRequests().anyRequest().permitAll(); // EXPECT spring.permit-all-any-request
5
+ }
6
+ }
7
+ @CrossOrigin(origins = "*") // EXPECT spring.cross-origin-wildcard
8
+ class Api {}
@@ -0,0 +1 @@
1
+ management.endpoints.web.exposure.include=* # EXPECT spring.actuator-exposed
@@ -0,0 +1,75 @@
1
+ {
2
+ "rules": [
3
+ {
4
+ "id": "spring.csrf-disabled",
5
+ "title": "CSRF protection disabled",
6
+ "severity": "MEDIUM",
7
+ "cwe": [
8
+ 352
9
+ ],
10
+ "category": "session",
11
+ "why": "Disabling CSRF is safe only for stateless token APIs; for cookie sessions it allows cross-site requests.",
12
+ "fix": "Keep CSRF enabled for session-based apps.",
13
+ "match": {
14
+ "kind": "line",
15
+ "line": "csrf\\(\\)\\.disable\\(\\)|csrf\\(\\s*(?:\\w+\\s*->\\s*\\w+\\.disable\\(\\)|AbstractHttpConfigurer::disable)"
16
+ },
17
+ "families": [
18
+ "java"
19
+ ],
20
+ "confidence": "medium"
21
+ },
22
+ {
23
+ "id": "spring.permit-all-any-request",
24
+ "title": "Every request is permitted without authentication",
25
+ "severity": "HIGH",
26
+ "cwe": [
27
+ 862
28
+ ],
29
+ "category": "authn",
30
+ "why": "anyRequest().permitAll() leaves everything not matched earlier public.",
31
+ "fix": "Use anyRequest().authenticated().",
32
+ "match": {
33
+ "kind": "line",
34
+ "line": "anyRequest\\(\\)\\.permitAll\\(\\)"
35
+ },
36
+ "families": [
37
+ "java"
38
+ ]
39
+ },
40
+ {
41
+ "id": "spring.cross-origin-wildcard",
42
+ "title": "@CrossOrigin allows every origin",
43
+ "severity": "MEDIUM",
44
+ "cwe": [
45
+ 942
46
+ ],
47
+ "category": "cors",
48
+ "why": "A wildcard origin lets any website call the endpoint from a browser.",
49
+ "fix": "List the origins.",
50
+ "match": {
51
+ "kind": "line",
52
+ "line": "@CrossOrigin\\(\\s*(?:origins\\s*=\\s*)?[\"\\']\\*[\"\\']"
53
+ },
54
+ "families": [
55
+ "java"
56
+ ]
57
+ },
58
+ {
59
+ "id": "spring.actuator-exposed",
60
+ "title": "All actuator endpoints exposed",
61
+ "severity": "MEDIUM",
62
+ "cwe": [
63
+ 200
64
+ ],
65
+ "category": "config",
66
+ "why": "Actuator endpoints such as env, heapdump and mappings leak configuration and memory.",
67
+ "fix": "Expose only health and info.",
68
+ "match": {
69
+ "kind": "file",
70
+ "files": "(?:^|/)application[\\w-]*\\.(?:properties|ya?ml)$",
71
+ "line": "management\\.endpoints\\.web\\.exposure\\.include\\s*[=:]\\s*[\\'\"]?\\*"
72
+ }
73
+ }
74
+ ]
75
+ }
@@ -0,0 +1,40 @@
1
+ ---
2
+ name: sqlalchemy
3
+ description: 'SQLAlchemy: text() built from strings.'
4
+ version: 1.0.0
5
+ license: MIT
6
+ author: Athena
7
+ appliesTo:
8
+ languages:
9
+ - python
10
+ frameworks:
11
+ - sqlalchemy
12
+ detect:
13
+ dependencies:
14
+ - sqlalchemy
15
+ imports:
16
+ - sqlalchemy
17
+ categories:
18
+ - injection
19
+ ---
20
+
21
+ ## When this applies
22
+
23
+ Projects that use sqlalchemy.
24
+
25
+ ## How to investigate
26
+
27
+ Find raw-query escape hatches and check every one for bound parameters.
28
+
29
+ ## Verification checklist
30
+
31
+ - Is the query text a literal? Are values bound separately?
32
+
33
+ ## Fixes
34
+
35
+ Use bound parameters or the query builder.
36
+
37
+ ## References
38
+
39
+ - https://owasp.org/www-community/attacks/SQL_Injection
40
+
@@ -0,0 +1,3 @@
1
+ from sqlalchemy import text
2
+ def f():
3
+ return text("SELECT * FROM users WHERE id = :id")
@@ -0,0 +1,3 @@
1
+ from sqlalchemy import text
2
+ def f(table):
3
+ return text(f"SELECT * FROM {table}") # EXPECT sqlalchemy.text-concat
@@ -0,0 +1,28 @@
1
+ {
2
+ "rules": [
3
+ {
4
+ "id": "sqlalchemy.text-concat",
5
+ "title": "SQLAlchemy text() built by string formatting",
6
+ "severity": "HIGH",
7
+ "cwe": [
8
+ 89
9
+ ],
10
+ "category": "injection",
11
+ "why": "text() with a formatted string is raw SQL with values pasted in.",
12
+ "fix": "Use text(\"... :id\") and pass bind parameters.",
13
+ "match": {
14
+ "kind": "call",
15
+ "callee": "^(?:sqlalchemy\\.)?text$",
16
+ "where": [
17
+ {
18
+ "op": "argIsConcat",
19
+ "index": 0
20
+ }
21
+ ]
22
+ },
23
+ "families": [
24
+ "python"
25
+ ]
26
+ }
27
+ ]
28
+ }
@@ -0,0 +1,40 @@
1
+ ---
2
+ name: typeorm
3
+ description: 'TypeORM: query() built from strings.'
4
+ version: 1.0.0
5
+ license: MIT
6
+ author: Athena
7
+ appliesTo:
8
+ languages:
9
+ - js
10
+ frameworks:
11
+ - typeorm
12
+ detect:
13
+ dependencies:
14
+ - typeorm
15
+ imports:
16
+ - typeorm
17
+ categories:
18
+ - injection
19
+ ---
20
+
21
+ ## When this applies
22
+
23
+ Projects that use typeorm.
24
+
25
+ ## How to investigate
26
+
27
+ Find raw-query escape hatches and check every one for bound parameters.
28
+
29
+ ## Verification checklist
30
+
31
+ - Is the query text a literal? Are values bound separately?
32
+
33
+ ## Fixes
34
+
35
+ Use bound parameters or the query builder.
36
+
37
+ ## References
38
+
39
+ - https://owasp.org/www-community/attacks/SQL_Injection
40
+
@@ -0,0 +1,4 @@
1
+ import { DataSource } from 'typeorm';
2
+ async function f(ds: DataSource, id: number) {
3
+ return ds.query('SELECT * FROM users WHERE id = $1', [id]);
4
+ }
@@ -0,0 +1,4 @@
1
+ import { DataSource } from 'typeorm';
2
+ async function f(ds: DataSource, col: string) {
3
+ return ds.query('SELECT ' + col + ' FROM users'); // EXPECT typeorm.query-concat
4
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "rules": [
3
+ {
4
+ "id": "typeorm.query-concat",
5
+ "title": "TypeORM query() built by concatenation",
6
+ "severity": "HIGH",
7
+ "cwe": [
8
+ 89
9
+ ],
10
+ "category": "injection",
11
+ "why": "query() runs raw SQL; concatenated values are injectable.",
12
+ "fix": "Pass parameters: query(\"... WHERE id = $1\", [id]).",
13
+ "match": {
14
+ "kind": "call",
15
+ "callee": "\\.query$",
16
+ "where": [
17
+ {
18
+ "op": "argIsConcat",
19
+ "index": 0
20
+ },
21
+ {
22
+ "op": "fileTextMatches",
23
+ "regex": "typeorm"
24
+ }
25
+ ]
26
+ },
27
+ "families": [
28
+ "js"
29
+ ]
30
+ }
31
+ ]
32
+ }
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: variant-analysis
3
+ description: 'From one confirmed vulnerability, find its siblings: generalize the pattern, sweep the code, validate each match.'
4
+ version: 1.0.0
5
+ license: MIT
6
+ author: Athena
7
+ appliesTo:
8
+ detect:
9
+ always: true
10
+ categories:
11
+ - variants
12
+ ---
13
+
14
+ ## When this applies
15
+
16
+ After a vulnerability is confirmed (by a person, a test or an AI check), to find every other place with the same root cause.
17
+
18
+ ## How to investigate
19
+
20
+ 1. State the root cause in one sentence (for example "request value reaches a SQL string without binding").
21
+ 2. Abstract the exact code shape: callee, which argument, what makes it unsafe.
22
+ 3. Sweep the whole codebase for that shape (`athena variants <finding-id>`).
23
+ 4. Validate each match: reachable? attacker controlled? guarded?
24
+ 5. Record the confirmed cousins and add the rule to the repo so it keeps catching them.
25
+
26
+ ## Verification checklist
27
+
28
+ - Did the sweep include every language and file type the root cause can appear in?
29
+ - Are guarded or unreachable matches excluded with a reason?
30
+
31
+ ## Fixes
32
+
33
+ Fix the root cause once (a shared helper) rather than patching each call site.
34
+
35
+ ## References
36
+
37
+ - https://owasp.org/www-community/Vulnerability_Analysis
38
+
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arsh342/athena",
3
- "version": "0.2.5",
4
- "description": "AI code provenance tracker and terminal scanner for JavaScript and TypeScript repositories.",
3
+ "version": "0.3.0",
4
+ "description": "AI code provenance tracker and terminal scanner for JavaScript/TypeScript, Python, Java, C#, C/C++, Go, Rust, PHP and Shell repositories.",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "athena": "dist/index.cjs"
@@ -50,8 +50,17 @@
50
50
  "eslint-plugin-security": "^3.0.0"
51
51
  },
52
52
  "devDependencies": {
53
+ "@athena/agents": "file:../agents",
53
54
  "@athena/core": "file:../core",
54
55
  "commander": "^14.0.0",
55
56
  "tsx": "^4.19.0"
57
+ },
58
+ "dependencies": {
59
+ "@anthropic-ai/sdk": "^1.11.0",
60
+ "@google/genai": "^3.6.1",
61
+ "@modelcontextprotocol/sdk": "^1.32.2",
62
+ "@vscode/tree-sitter-wasm": "0.3.1",
63
+ "openai": "^7.62.0",
64
+ "zod": "^4.6.7"
56
65
  }
57
66
  }
@@ -1,2 +0,0 @@
1
- license: Freeware
2
- link: https://www.fontspace.com/null-pointer-font-f2192
@@ -1,68 +0,0 @@
1
- [ Divide By Zero ] Fonts
2
- http://fonts.tom7.com/
3
-
4
- I am employing a very generous license with these fonts (the way I
5
- think most software should be) for a number of reasons. Mainly though,
6
- it is because I would be making fonts regardless of whether I was
7
- distributing them or not, and because I know that people benefit from
8
- the fact that I give them away. I take enough stuff for free and it
9
- makes me feel good to know that I am 'giving back'.
10
-
11
- Here is the license. You are free to download and use these fonts
12
- without my explicit permission for anything you want, except for the
13
- following:
14
-
15
- You may NOT* resell the actual font files (without my written
16
- permission and without having to give me something in
17
- return). This includes but is not limited to selling it on a Font
18
- CD (even when the fee involved is a nominal "distribution" or
19
- "handling" fee, or some similar thing), or distributing it on a
20
- site which charges a fee per font download. (In contrast, a
21
- pay-per-hour service such as America Online is free to distribute
22
- the fonts.) You may not misrepresent the creator of the font
23
- (pretend you made them) You may not adapt them to different fonts
24
- without my permission. You may not modify the font files for
25
- subsequent redistribution.
26
-
27
- However, you have permission to do the following:
28
- Use them to make graphics for your home page, non-profit web page,
29
- or commerical web site.
30
- Give them to your friends for free.
31
- Make them available (for free) on your web page, as long as you make
32
- clear where they came from.
33
- Use them in design work that you get paid for.
34
- Use them in any smalltime publications or fliers or other non
35
- mass-produced literature.
36
- Make commercial products like T-shirts or Mugs or Books using the
37
- fonts and sell them. In this case, since you are indirectly
38
- profiting off of my work, I ask that you send me one of the T-shirts
39
- or Mugs or Books free, where reasonable. Obviously some discretion
40
- on your part is due; but try to be fair. If it is inappropriate for
41
- you to send me one of your product, at least make an attempt to
42
- write me an e-mail at imightbetm@aol.com and let me know where the
43
- font is being used.
44
-
45
- * "Not", as in, "Not without my permission". I regularly give
46
- permission for this sort of thing, so if you want to redistribute
47
- the fonts for a fee, let me know and we can probably work something
48
- out. Generally I simply request a copy of the CD or magazine or
49
- whatever.
50
-
51
- Exception to the above: The fonts (or converted versions of the fonts)
52
- may be included on any recognized distribution of the Linux operating
53
- system, even if the CD is sold. Please include this README file.
54
- In addition, explicit permission is given for simtel.net, cdrom.com
55
- and their partners to distribute this collection on physical medium.
56
-
57
- For your information, here is my permanent address:
58
-
59
- Tom Murphy 7
60
- 339 Still Hill Rd
61
- Hamden CT 06518.1830
62
- USA
63
-
64
- My e-mail address is: imightbetm(a)aol.com
65
-
66
- The full [ Divide By Zero ] collection is always available at:
67
-
68
- http://fonts.tom7.com/