codejury 0.23.0__tar.gz → 1.0.0__tar.gz

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 (134) hide show
  1. codejury-1.0.0/PKG-INFO +270 -0
  2. codejury-1.0.0/README.md +233 -0
  3. {codejury-0.23.0 → codejury-1.0.0}/codejury/__init__.py +2 -2
  4. codejury-1.0.0/codejury/cli.py +316 -0
  5. {codejury-0.23.0 → codejury-1.0.0}/codejury/detection.py +7 -7
  6. {codejury-0.23.0/codejury/data → codejury-1.0.0/codejury}/detection.yaml +1 -5
  7. {codejury-0.23.0/codejury/domain → codejury-1.0.0/codejury}/finding.py +8 -9
  8. {codejury-0.23.0 → codejury-1.0.0}/codejury/guides.py +12 -14
  9. {codejury-0.23.0 → codejury-1.0.0}/codejury/json_parse.py +22 -2
  10. {codejury-0.23.0/codejury/data → codejury-1.0.0/codejury/knowledge/guides}/frameworks/python/celery.md +7 -4
  11. codejury-1.0.0/codejury/knowledge/guides/languages/python.md +33 -0
  12. {codejury-0.23.0/codejury/data → codejury-1.0.0/codejury/knowledge/guides}/protocols/oauth.md +1 -1
  13. codejury-0.23.0/codejury/data/vulnerabilities/SKILL.md → codejury-1.0.0/codejury/knowledge/index.md +4 -9
  14. {codejury-0.23.0/codejury/data → codejury-1.0.0/codejury/knowledge}/vulnerabilities/cross-site-request-forgery.md +7 -2
  15. {codejury-0.23.0/codejury/data → codejury-1.0.0/codejury/knowledge}/vulnerabilities/improper-authentication.md +1 -1
  16. {codejury-0.23.0/codejury/data → codejury-1.0.0/codejury/knowledge}/vulnerabilities/information-exposure.md +2 -1
  17. {codejury-0.23.0/codejury/data → codejury-1.0.0/codejury/knowledge}/vulnerabilities/insecure-cryptography.md +4 -0
  18. codejury-0.23.0/codejury/data/vulnerabilities/session-fixation.md → codejury-1.0.0/codejury/knowledge/vulnerabilities/insecure-session-management.md +5 -6
  19. {codejury-0.23.0/codejury/data → codejury-1.0.0/codejury/knowledge}/vulnerabilities/insecure-transport.md +4 -0
  20. codejury-1.0.0/codejury/knowledge/vulnerabilities/jwt-validation.md +29 -0
  21. {codejury-0.23.0/codejury/data → codejury-1.0.0/codejury/knowledge}/vulnerabilities/missing-authorization.md +1 -1
  22. {codejury-0.23.0/codejury/data → codejury-1.0.0/codejury/knowledge}/vulnerabilities/path-traversal.md +3 -2
  23. {codejury-0.23.0/codejury/data → codejury-1.0.0/codejury/knowledge}/vulnerabilities/race-condition.md +8 -2
  24. {codejury-0.23.0/codejury/data → codejury-1.0.0/codejury/knowledge}/vulnerabilities/replay-attack.md +4 -0
  25. {codejury-0.23.0/codejury/data → codejury-1.0.0/codejury/knowledge}/vulnerabilities/server-side-request-forgery.md +6 -0
  26. {codejury-0.23.0/codejury/data → codejury-1.0.0/codejury/knowledge}/vulnerabilities/xml-external-entity.md +7 -2
  27. codejury-0.23.0/codejury/mddoc.py → codejury-1.0.0/codejury/markdown_docs.py +17 -6
  28. codejury-1.0.0/codejury/playbook/false-positive-traps.md +78 -0
  29. codejury-1.0.0/codejury/playbook/methodology.md +221 -0
  30. codejury-1.0.0/codejury/playbook/severity-rubric.md +58 -0
  31. codejury-1.0.0/codejury/playbook/slash-command.md +104 -0
  32. codejury-1.0.0/codejury/playbook/unit-review.md +75 -0
  33. {codejury-0.23.0 → codejury-1.0.0}/codejury/providers/anthropic.py +1 -1
  34. {codejury-0.23.0 → codejury-1.0.0}/codejury/providers/factory.py +0 -1
  35. {codejury-0.23.0 → codejury-1.0.0}/codejury/providers/litellm.py +1 -1
  36. {codejury-0.23.0 → codejury-1.0.0}/codejury/providers/mock.py +0 -2
  37. {codejury-0.23.0 → codejury-1.0.0}/codejury/providers/openai.py +1 -1
  38. {codejury-0.23.0 → codejury-1.0.0}/codejury/providers/retry.py +0 -5
  39. {codejury-0.23.0 → codejury-1.0.0}/codejury/report.py +9 -14
  40. codejury-1.0.0/codejury/resources.py +28 -0
  41. codejury-0.23.0/codejury/review/diff/debate.py → codejury-1.0.0/codejury/review/diff/adversarial.py +104 -27
  42. {codejury-0.23.0 → codejury-1.0.0}/codejury/review/diff/engine.py +8 -9
  43. codejury-0.23.0/codejury/review/diff/findings_filter.py → codejury-1.0.0/codejury/review/diff/filter.py +1 -1
  44. {codejury-0.23.0 → codejury-1.0.0}/codejury/review/diff/runner.py +20 -12
  45. {codejury-0.23.0 → codejury-1.0.0}/codejury/review/diff/vulnerabilities.py +2 -2
  46. codejury-1.0.0/codejury/review/repo/agent.py +198 -0
  47. codejury-1.0.0/codejury/review/repo/engine.py +393 -0
  48. codejury-1.0.0/codejury/review/repo/gate.py +96 -0
  49. {codejury-0.23.0 → codejury-1.0.0}/codejury/review/repo/model.py +2 -2
  50. codejury-1.0.0/codejury/review/repo/pass_loop.py +80 -0
  51. codejury-1.0.0/codejury/review/repo/paths.py +37 -0
  52. codejury-1.0.0/codejury/review/repo/reviewer.py +153 -0
  53. codejury-1.0.0/codejury/review/repo/scaffold.py +303 -0
  54. codejury-1.0.0/codejury/review/repo/severity.py +68 -0
  55. codejury-1.0.0/codejury/review/repo/union.py +124 -0
  56. codejury-1.0.0/codejury/review/repo/verifier.py +148 -0
  57. codejury-1.0.0/codejury/severity.py +29 -0
  58. codejury-1.0.0/codejury.egg-info/PKG-INFO +270 -0
  59. codejury-1.0.0/codejury.egg-info/SOURCES.txt +117 -0
  60. {codejury-0.23.0 → codejury-1.0.0}/codejury.egg-info/requires.txt +5 -0
  61. {codejury-0.23.0 → codejury-1.0.0}/pyproject.toml +6 -3
  62. {codejury-0.23.0 → codejury-1.0.0}/tests/test_anthropic_provider.py +1 -1
  63. codejury-0.23.0/tests/test_cli_audit.py → codejury-1.0.0/tests/test_cli.py +78 -14
  64. {codejury-0.23.0 → codejury-1.0.0}/tests/test_detection.py +6 -6
  65. codejury-0.23.0/tests/test_diff_debate.py → codejury-1.0.0/tests/test_diff_adversarial.py +35 -23
  66. {codejury-0.23.0 → codejury-1.0.0}/tests/test_diff_engine.py +15 -24
  67. {codejury-0.23.0 → codejury-1.0.0}/tests/test_guides.py +4 -8
  68. {codejury-0.23.0 → codejury-1.0.0}/tests/test_json_parse.py +0 -2
  69. codejury-0.23.0/tests/test_mddoc.py → codejury-1.0.0/tests/test_markdown_docs.py +4 -4
  70. codejury-1.0.0/tests/test_repo_agent.py +110 -0
  71. codejury-1.0.0/tests/test_repo_engine.py +293 -0
  72. codejury-1.0.0/tests/test_repo_gate.py +98 -0
  73. {codejury-0.23.0 → codejury-1.0.0}/tests/test_repo_model.py +15 -6
  74. codejury-1.0.0/tests/test_repo_pass_loop.py +141 -0
  75. codejury-1.0.0/tests/test_repo_scaffold.py +179 -0
  76. codejury-1.0.0/tests/test_repo_severity.py +37 -0
  77. codejury-1.0.0/tests/test_repo_union.py +104 -0
  78. codejury-1.0.0/tests/test_repo_verifier.py +95 -0
  79. {codejury-0.23.0 → codejury-1.0.0}/tests/test_report.py +5 -5
  80. {codejury-0.23.0 → codejury-1.0.0}/tests/test_retry_provider.py +3 -3
  81. {codejury-0.23.0 → codejury-1.0.0}/tests/test_vulnerabilities.py +32 -20
  82. codejury-0.23.0/PKG-INFO +0 -183
  83. codejury-0.23.0/README.md +0 -152
  84. codejury-0.23.0/codejury/cli.py +0 -190
  85. codejury-0.23.0/codejury/data/commands/codejury-review-repo.md +0 -42
  86. codejury-0.23.0/codejury/data/languages/python.md +0 -24
  87. codejury-0.23.0/codejury/data/methodologies/memory-template.md +0 -30
  88. codejury-0.23.0/codejury/data/methodologies/repo-review.md +0 -275
  89. codejury-0.23.0/codejury/data/vulnerabilities/jwt-validation.md +0 -22
  90. codejury-0.23.0/codejury/domain/__init__.py +0 -5
  91. codejury-0.23.0/codejury/resources.py +0 -17
  92. codejury-0.23.0/codejury/review/diff/debate_prompts.py +0 -116
  93. codejury-0.23.0/codejury/review/repo/scaffold.py +0 -247
  94. codejury-0.23.0/codejury.egg-info/PKG-INFO +0 -183
  95. codejury-0.23.0/codejury.egg-info/SOURCES.txt +0 -100
  96. codejury-0.23.0/tests/test_repo_scaffold.py +0 -175
  97. {codejury-0.23.0 → codejury-1.0.0}/LICENSE +0 -0
  98. {codejury-0.23.0 → codejury-1.0.0}/codejury/__main__.py +0 -0
  99. {codejury-0.23.0/codejury/data → codejury-1.0.0/codejury/knowledge/guides}/frameworks/go/echo.md +0 -0
  100. {codejury-0.23.0/codejury/data → codejury-1.0.0/codejury/knowledge/guides}/frameworks/go/gin.md +0 -0
  101. {codejury-0.23.0/codejury/data → codejury-1.0.0/codejury/knowledge/guides}/frameworks/javascript/express.md +0 -0
  102. {codejury-0.23.0/codejury/data → codejury-1.0.0/codejury/knowledge/guides}/frameworks/javascript/nestjs.md +0 -0
  103. {codejury-0.23.0/codejury/data → codejury-1.0.0/codejury/knowledge/guides}/frameworks/python/django.md +0 -0
  104. {codejury-0.23.0/codejury/data → codejury-1.0.0/codejury/knowledge/guides}/frameworks/python/fastapi.md +0 -0
  105. {codejury-0.23.0/codejury/data → codejury-1.0.0/codejury/knowledge/guides}/frameworks/python/flask.md +0 -0
  106. {codejury-0.23.0/codejury/data → codejury-1.0.0/codejury/knowledge/guides}/languages/go.md +0 -0
  107. {codejury-0.23.0/codejury/data → codejury-1.0.0/codejury/knowledge/guides}/languages/javascript.md +0 -0
  108. {codejury-0.23.0/codejury/data → codejury-1.0.0/codejury/knowledge/guides}/languages/typescript.md +0 -0
  109. {codejury-0.23.0/codejury/data → codejury-1.0.0/codejury/knowledge}/vulnerabilities/business-logic.md +0 -0
  110. {codejury-0.23.0/codejury/data → codejury-1.0.0/codejury/knowledge}/vulnerabilities/code-injection.md +0 -0
  111. {codejury-0.23.0/codejury/data → codejury-1.0.0/codejury/knowledge}/vulnerabilities/command-injection.md +0 -0
  112. {codejury-0.23.0/codejury/data → codejury-1.0.0/codejury/knowledge}/vulnerabilities/cross-site-scripting.md +0 -0
  113. {codejury-0.23.0/codejury/data → codejury-1.0.0/codejury/knowledge}/vulnerabilities/hardcoded-secrets.md +0 -0
  114. {codejury-0.23.0/codejury/data → codejury-1.0.0/codejury/knowledge}/vulnerabilities/http-response-splitting.md +0 -0
  115. {codejury-0.23.0/codejury/data → codejury-1.0.0/codejury/knowledge}/vulnerabilities/insecure-deserialization.md +0 -0
  116. {codejury-0.23.0/codejury/data → codejury-1.0.0/codejury/knowledge}/vulnerabilities/insecure-direct-object-reference.md +0 -0
  117. {codejury-0.23.0/codejury/data → codejury-1.0.0/codejury/knowledge}/vulnerabilities/mass-assignment.md +0 -0
  118. {codejury-0.23.0/codejury/data → codejury-1.0.0/codejury/knowledge}/vulnerabilities/open-redirect.md +0 -0
  119. {codejury-0.23.0/codejury/data → codejury-1.0.0/codejury/knowledge}/vulnerabilities/server-side-template-injection.md +0 -0
  120. {codejury-0.23.0/codejury/data → codejury-1.0.0/codejury/knowledge}/vulnerabilities/sql-injection.md +0 -0
  121. {codejury-0.23.0 → codejury-1.0.0}/codejury/providers/__init__.py +0 -0
  122. {codejury-0.23.0 → codejury-1.0.0}/codejury/providers/base.py +0 -0
  123. {codejury-0.23.0 → codejury-1.0.0}/codejury/providers/openai_format.py +0 -0
  124. {codejury-0.23.0 → codejury-1.0.0}/codejury/review/__init__.py +0 -0
  125. {codejury-0.23.0 → codejury-1.0.0}/codejury/review/diff/__init__.py +0 -0
  126. {codejury-0.23.0 → codejury-1.0.0}/codejury/review/diff/prompts.py +0 -0
  127. {codejury-0.23.0 → codejury-1.0.0}/codejury/review/repo/__init__.py +0 -0
  128. {codejury-0.23.0 → codejury-1.0.0}/codejury.egg-info/dependency_links.txt +0 -0
  129. {codejury-0.23.0 → codejury-1.0.0}/codejury.egg-info/entry_points.txt +0 -0
  130. {codejury-0.23.0 → codejury-1.0.0}/codejury.egg-info/top_level.txt +0 -0
  131. {codejury-0.23.0 → codejury-1.0.0}/setup.cfg +0 -0
  132. {codejury-0.23.0 → codejury-1.0.0}/tests/test_litellm_provider.py +0 -0
  133. {codejury-0.23.0 → codejury-1.0.0}/tests/test_openai_format.py +0 -0
  134. {codejury-0.23.0 → codejury-1.0.0}/tests/test_openai_provider.py +0 -0
@@ -0,0 +1,270 @@
1
+ Metadata-Version: 2.4
2
+ Name: codejury
3
+ Version: 1.0.0
4
+ Summary: AI-assisted security review for code diffs and whole repositories.
5
+ Author: AISecLabs
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/aiseclabs/codejury
8
+ Project-URL: Repository, https://github.com/aiseclabs/codejury
9
+ Project-URL: Issues, https://github.com/aiseclabs/codejury/issues
10
+ Project-URL: Changelog, https://github.com/aiseclabs/codejury/releases
11
+ Keywords: security,appsec,static analysis,llm,owasp,asvs,code review
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Topic :: Security
15
+ Classifier: Topic :: Software Development :: Quality Assurance
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Operating System :: OS Independent
18
+ Requires-Python: >=3.12
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: pyyaml>=6.0
22
+ Requires-Dist: json-repair>=0.30
23
+ Provides-Extra: anthropic
24
+ Requires-Dist: anthropic>=0.40; extra == "anthropic"
25
+ Provides-Extra: openai
26
+ Requires-Dist: openai>=1.0; extra == "openai"
27
+ Provides-Extra: litellm
28
+ Requires-Dist: litellm>=1.0; extra == "litellm"
29
+ Provides-Extra: all
30
+ Requires-Dist: anthropic>=0.40; extra == "all"
31
+ Requires-Dist: openai>=1.0; extra == "all"
32
+ Requires-Dist: litellm>=1.0; extra == "all"
33
+ Provides-Extra: dev
34
+ Requires-Dist: pytest>=8.0; extra == "dev"
35
+ Requires-Dist: jsonschema>=4.0; extra == "dev"
36
+ Dynamic: license-file
37
+
38
+ ```
39
+ ██████╗ ██████╗ ██████╗ ███████╗ ██╗██╗ ██╗██████╗ ██╗ ██╗
40
+ ██╔════╝██╔═══██╗██╔══██╗██╔════╝ ██║██║ ██║██╔══██╗╚██╗ ██╔╝
41
+ ██║ ██║ ██║██║ ██║█████╗ ██║██║ ██║██████╔╝ ╚████╔╝
42
+ ██║ ██║ ██║██║ ██║██╔══╝ ██ ██║██║ ██║██╔══██╗ ╚██╔╝
43
+ ╚██████╗╚██████╔╝██████╔╝███████╗╚█████╔╝╚██████╔╝██║ ██║ ██║
44
+ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝ ╚════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝
45
+ ```
46
+
47
+ AI-assisted security review for code diffs and whole repositories.
48
+
49
+ The tool has two review paths:
50
+
51
+ - **Diff Review** audits a pull request or unified diff in one command.
52
+ - **Repo Review** fans out across a whole repository, reviews focused units, deduplicates
53
+ candidates, verifies findings, and checks coverage with a gate.
54
+
55
+ Security knowledge is data. Vulnerability classes, language guides, framework guides, and
56
+ protocol guides live in markdown under `codejury/knowledge/`, so adding a stack or class is
57
+ usually a data change rather than a Python code change.
58
+
59
+ ## Install
60
+
61
+ Install the core package and one model backend:
62
+
63
+ ```bash
64
+ pip install codejury
65
+ pip install "codejury[anthropic]" # or "codejury[openai]" or "codejury[litellm]"
66
+ ```
67
+
68
+ Install the Repo Review slash command for an agent:
69
+
70
+ ```bash
71
+ codejury install-slash-command # Claude Code
72
+ codejury install-slash-command --agent codex # Codex
73
+ ```
74
+
75
+ `install-slash-command` copies `/codejury-review-repo` into the selected agent's command
76
+ directory. Pass `--dir` to install it somewhere else.
77
+
78
+ ## Configure A Model Backend
79
+
80
+ Set a provider key through flags or environment variables:
81
+
82
+ ```bash
83
+ export CODEJURY_API_KEY=...
84
+ export CODEJURY_MODEL=claude-sonnet-4-6
85
+ export CODEJURY_API_BASE=... # optional gateway or proxy
86
+ ```
87
+
88
+ The tool does not auto-load `.env`.
89
+
90
+ Useful flags:
91
+
92
+ - `--provider anthropic|openai|litellm`
93
+ - `--model <model>`
94
+ - `--api-key <key>`
95
+ - `--api-base <url>`
96
+ - `--retries <n>`
97
+
98
+ ## Data Boundary
99
+
100
+ The tool sends code-derived content to the model provider you configure, so know what
101
+ leaves the machine before reviewing a proprietary repository:
102
+
103
+ - Diff Review sends the unified diff under review.
104
+ - Repo Review with `--reviewer model` sends bounded source snippets, the detected stack
105
+ notes, the vulnerability guidance, and the findings.
106
+ - Verification with `--reviewer model` sends the cited source file and the finding
107
+ details. With `--reviewer claude-cli`, Claude Code receives the finding details and
108
+ reads the code itself through its read-only tools.
109
+ - `--reviewer claude-cli` does not use the configured provider key. It runs Claude Code
110
+ with read-only file tools, and Claude Code may send prompts and the code it reads
111
+ through your Claude Code account, so the code does not stay local.
112
+
113
+ A custom `--api-base` or a LiteLLM proxy becomes part of the trust boundary, so the data
114
+ above also reaches that gateway. Prefer the `CODEJURY_API_KEY` environment variable over
115
+ `--api-key`, since a flag can leak through shell history and process listings. The review
116
+ workspace and the generated reports hold exploit paths, sensitive file locations, and
117
+ PoCs, so treat them as sensitive. The workspace is created private, mode `0700`.
118
+
119
+ ## Diff Review
120
+
121
+ Diff Review is the fast coded path. It audits a unified diff with either a standard
122
+ single model call or an adversarial Finder, Challenger, and Judge pass.
123
+
124
+ ```bash
125
+ # Review a diff file
126
+ codejury review diff --file changes.diff
127
+
128
+ # Review a git range
129
+ codejury review diff --repo /path/to/app --git-range origin/main...HEAD
130
+
131
+ # Review stdin
132
+ git diff HEAD~1 | codejury review diff
133
+
134
+ # Use adversarial mode for extra recall on subtle cross-file logic
135
+ codejury review diff --file changes.diff --mode adversarial
136
+
137
+ # Emit SARIF and fail on HIGH or CRITICAL findings
138
+ codejury review diff --file changes.diff --format sarif --fail-on high
139
+ ```
140
+
141
+ `codejury review diff --dry-run` uses a mock provider and a built-in demo diff, so it needs
142
+ no API key.
143
+
144
+ ## Repo Review
145
+
146
+ Repo Review is the recall-first path for whole repositories. A whole codebase is too large
147
+ for one useful model call, so the tool creates a workspace, builds a unit worklist, and
148
+ reviews focused units instead of doing one shallow pass.
149
+
150
+ Start by scaffolding a workspace:
151
+
152
+ ```bash
153
+ codejury review repo /path/to/repo
154
+ ```
155
+
156
+ The workspace contains:
157
+
158
+ ```text
159
+ inventory/ attack surface, authorization model, candidates, severity rubric
160
+ units/ one review unit per candidate entrypoint
161
+ issues/ issue write-ups
162
+ pocs/ runnable PoCs, when available
163
+ METHODOLOGY.md full review process
164
+ _stack.md detected stack notes
165
+ ```
166
+
167
+ Then run the interactive slash command in Claude Code or Codex:
168
+
169
+ ```text
170
+ /codejury-review-repo /path/to/repo
171
+ ```
172
+
173
+ The agent maps the attack surface, fills the authorization model, runs one focused
174
+ sub-review per unit, records findings, and leaves deterministic post-processing to code.
175
+ PoCs must run only against sandbox or dev environments, never production.
176
+
177
+ After the fan-out review, run the coded finalization and gate:
178
+
179
+ ```bash
180
+ codejury review repo /path/to/repo --finalize
181
+ codejury review repo /path/to/repo --gate
182
+ ```
183
+
184
+ `--finalize` deduplicates issue files, verifies survivors, records refuted candidates in
185
+ `_refuted.md`, and writes ranked `findings.json`. `--gate` fails until the workspace has
186
+ an enumerated surface, reviewed units, and calibrated findings.
187
+
188
+ For a headless run, use:
189
+
190
+ ```bash
191
+ codejury review repo /path/to/repo --run
192
+ ```
193
+
194
+ Use `--reviewer claude-cli` only when you want the Claude Code backend to run unit reviews
195
+ and verification through local Claude CLI access.
196
+
197
+ ## Supported Knowledge
198
+
199
+ Current guide coverage includes:
200
+
201
+ - Python: Django, Flask, FastAPI, Celery
202
+ - Go: Gin, Echo
203
+ - JavaScript and TypeScript: Express, NestJS
204
+ - Protocols: OAuth and OIDC
205
+
206
+ Unguided stacks still work, but the agent relies more on general methodology and model
207
+ knowledge.
208
+
209
+ ## Findings
210
+
211
+ Every reportable finding should have:
212
+
213
+ - file and line
214
+ - severity
215
+ - category
216
+ - exploit scenario
217
+ - recommendation
218
+ - confidence or verification status
219
+
220
+ The tool is intentionally scoped to real exploitable application security issues. It should
221
+ not report dependency CVEs, style notes, generic best practices, speculation, or risks that
222
+ only matter if production configuration leaks.
223
+
224
+ ## Model And Mode Guidance
225
+
226
+ Detection quality is dominated by model quality first, then mode.
227
+
228
+ - Use standard mode with a strong model by default.
229
+ - Use adversarial mode when you want extra recall on subtle cross-file logic.
230
+ - Do not use adversarial mode as a false-positive reducer. False positives are controlled
231
+ by the do-not-report guidance, deterministic filtering, and verification.
232
+
233
+ ## GitHub Actions
234
+
235
+ Use the example workflow:
236
+
237
+ ```bash
238
+ cp examples/codejury-pr-review.yml .github/workflows/codejury-pr-review.yml
239
+ ```
240
+
241
+ Add `CODEJURY_API_KEY` as a repository secret. The workflow reviews the pull request diff,
242
+ uploads SARIF to code scanning, and fails on HIGH or CRITICAL findings.
243
+
244
+ ## Extend The Knowledge
245
+
246
+ Add security knowledge as markdown:
247
+
248
+ - Vulnerability class:
249
+ `codejury/knowledge/vulnerabilities/<id>.md`
250
+ - Language guide:
251
+ `codejury/knowledge/guides/languages/<language>.md`
252
+ - Framework guide:
253
+ `codejury/knowledge/guides/frameworks/<language>/<framework>.md`
254
+ - Protocol guide:
255
+ `codejury/knowledge/guides/protocols/<protocol>.md`
256
+
257
+ Keep frontmatter and detection signals data-driven. Avoid adding language, framework, or
258
+ vulnerability-specific detection logic to Python unless the engine itself needs a generic
259
+ capability.
260
+
261
+ ## Development
262
+
263
+ Run tests in a virtual environment:
264
+
265
+ ```bash
266
+ python -m venv .venv
267
+ . .venv/bin/activate
268
+ pip install -e ".[dev]"
269
+ pytest
270
+ ```
@@ -0,0 +1,233 @@
1
+ ```
2
+ ██████╗ ██████╗ ██████╗ ███████╗ ██╗██╗ ██╗██████╗ ██╗ ██╗
3
+ ██╔════╝██╔═══██╗██╔══██╗██╔════╝ ██║██║ ██║██╔══██╗╚██╗ ██╔╝
4
+ ██║ ██║ ██║██║ ██║█████╗ ██║██║ ██║██████╔╝ ╚████╔╝
5
+ ██║ ██║ ██║██║ ██║██╔══╝ ██ ██║██║ ██║██╔══██╗ ╚██╔╝
6
+ ╚██████╗╚██████╔╝██████╔╝███████╗╚█████╔╝╚██████╔╝██║ ██║ ██║
7
+ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝ ╚════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝
8
+ ```
9
+
10
+ AI-assisted security review for code diffs and whole repositories.
11
+
12
+ The tool has two review paths:
13
+
14
+ - **Diff Review** audits a pull request or unified diff in one command.
15
+ - **Repo Review** fans out across a whole repository, reviews focused units, deduplicates
16
+ candidates, verifies findings, and checks coverage with a gate.
17
+
18
+ Security knowledge is data. Vulnerability classes, language guides, framework guides, and
19
+ protocol guides live in markdown under `codejury/knowledge/`, so adding a stack or class is
20
+ usually a data change rather than a Python code change.
21
+
22
+ ## Install
23
+
24
+ Install the core package and one model backend:
25
+
26
+ ```bash
27
+ pip install codejury
28
+ pip install "codejury[anthropic]" # or "codejury[openai]" or "codejury[litellm]"
29
+ ```
30
+
31
+ Install the Repo Review slash command for an agent:
32
+
33
+ ```bash
34
+ codejury install-slash-command # Claude Code
35
+ codejury install-slash-command --agent codex # Codex
36
+ ```
37
+
38
+ `install-slash-command` copies `/codejury-review-repo` into the selected agent's command
39
+ directory. Pass `--dir` to install it somewhere else.
40
+
41
+ ## Configure A Model Backend
42
+
43
+ Set a provider key through flags or environment variables:
44
+
45
+ ```bash
46
+ export CODEJURY_API_KEY=...
47
+ export CODEJURY_MODEL=claude-sonnet-4-6
48
+ export CODEJURY_API_BASE=... # optional gateway or proxy
49
+ ```
50
+
51
+ The tool does not auto-load `.env`.
52
+
53
+ Useful flags:
54
+
55
+ - `--provider anthropic|openai|litellm`
56
+ - `--model <model>`
57
+ - `--api-key <key>`
58
+ - `--api-base <url>`
59
+ - `--retries <n>`
60
+
61
+ ## Data Boundary
62
+
63
+ The tool sends code-derived content to the model provider you configure, so know what
64
+ leaves the machine before reviewing a proprietary repository:
65
+
66
+ - Diff Review sends the unified diff under review.
67
+ - Repo Review with `--reviewer model` sends bounded source snippets, the detected stack
68
+ notes, the vulnerability guidance, and the findings.
69
+ - Verification with `--reviewer model` sends the cited source file and the finding
70
+ details. With `--reviewer claude-cli`, Claude Code receives the finding details and
71
+ reads the code itself through its read-only tools.
72
+ - `--reviewer claude-cli` does not use the configured provider key. It runs Claude Code
73
+ with read-only file tools, and Claude Code may send prompts and the code it reads
74
+ through your Claude Code account, so the code does not stay local.
75
+
76
+ A custom `--api-base` or a LiteLLM proxy becomes part of the trust boundary, so the data
77
+ above also reaches that gateway. Prefer the `CODEJURY_API_KEY` environment variable over
78
+ `--api-key`, since a flag can leak through shell history and process listings. The review
79
+ workspace and the generated reports hold exploit paths, sensitive file locations, and
80
+ PoCs, so treat them as sensitive. The workspace is created private, mode `0700`.
81
+
82
+ ## Diff Review
83
+
84
+ Diff Review is the fast coded path. It audits a unified diff with either a standard
85
+ single model call or an adversarial Finder, Challenger, and Judge pass.
86
+
87
+ ```bash
88
+ # Review a diff file
89
+ codejury review diff --file changes.diff
90
+
91
+ # Review a git range
92
+ codejury review diff --repo /path/to/app --git-range origin/main...HEAD
93
+
94
+ # Review stdin
95
+ git diff HEAD~1 | codejury review diff
96
+
97
+ # Use adversarial mode for extra recall on subtle cross-file logic
98
+ codejury review diff --file changes.diff --mode adversarial
99
+
100
+ # Emit SARIF and fail on HIGH or CRITICAL findings
101
+ codejury review diff --file changes.diff --format sarif --fail-on high
102
+ ```
103
+
104
+ `codejury review diff --dry-run` uses a mock provider and a built-in demo diff, so it needs
105
+ no API key.
106
+
107
+ ## Repo Review
108
+
109
+ Repo Review is the recall-first path for whole repositories. A whole codebase is too large
110
+ for one useful model call, so the tool creates a workspace, builds a unit worklist, and
111
+ reviews focused units instead of doing one shallow pass.
112
+
113
+ Start by scaffolding a workspace:
114
+
115
+ ```bash
116
+ codejury review repo /path/to/repo
117
+ ```
118
+
119
+ The workspace contains:
120
+
121
+ ```text
122
+ inventory/ attack surface, authorization model, candidates, severity rubric
123
+ units/ one review unit per candidate entrypoint
124
+ issues/ issue write-ups
125
+ pocs/ runnable PoCs, when available
126
+ METHODOLOGY.md full review process
127
+ _stack.md detected stack notes
128
+ ```
129
+
130
+ Then run the interactive slash command in Claude Code or Codex:
131
+
132
+ ```text
133
+ /codejury-review-repo /path/to/repo
134
+ ```
135
+
136
+ The agent maps the attack surface, fills the authorization model, runs one focused
137
+ sub-review per unit, records findings, and leaves deterministic post-processing to code.
138
+ PoCs must run only against sandbox or dev environments, never production.
139
+
140
+ After the fan-out review, run the coded finalization and gate:
141
+
142
+ ```bash
143
+ codejury review repo /path/to/repo --finalize
144
+ codejury review repo /path/to/repo --gate
145
+ ```
146
+
147
+ `--finalize` deduplicates issue files, verifies survivors, records refuted candidates in
148
+ `_refuted.md`, and writes ranked `findings.json`. `--gate` fails until the workspace has
149
+ an enumerated surface, reviewed units, and calibrated findings.
150
+
151
+ For a headless run, use:
152
+
153
+ ```bash
154
+ codejury review repo /path/to/repo --run
155
+ ```
156
+
157
+ Use `--reviewer claude-cli` only when you want the Claude Code backend to run unit reviews
158
+ and verification through local Claude CLI access.
159
+
160
+ ## Supported Knowledge
161
+
162
+ Current guide coverage includes:
163
+
164
+ - Python: Django, Flask, FastAPI, Celery
165
+ - Go: Gin, Echo
166
+ - JavaScript and TypeScript: Express, NestJS
167
+ - Protocols: OAuth and OIDC
168
+
169
+ Unguided stacks still work, but the agent relies more on general methodology and model
170
+ knowledge.
171
+
172
+ ## Findings
173
+
174
+ Every reportable finding should have:
175
+
176
+ - file and line
177
+ - severity
178
+ - category
179
+ - exploit scenario
180
+ - recommendation
181
+ - confidence or verification status
182
+
183
+ The tool is intentionally scoped to real exploitable application security issues. It should
184
+ not report dependency CVEs, style notes, generic best practices, speculation, or risks that
185
+ only matter if production configuration leaks.
186
+
187
+ ## Model And Mode Guidance
188
+
189
+ Detection quality is dominated by model quality first, then mode.
190
+
191
+ - Use standard mode with a strong model by default.
192
+ - Use adversarial mode when you want extra recall on subtle cross-file logic.
193
+ - Do not use adversarial mode as a false-positive reducer. False positives are controlled
194
+ by the do-not-report guidance, deterministic filtering, and verification.
195
+
196
+ ## GitHub Actions
197
+
198
+ Use the example workflow:
199
+
200
+ ```bash
201
+ cp examples/codejury-pr-review.yml .github/workflows/codejury-pr-review.yml
202
+ ```
203
+
204
+ Add `CODEJURY_API_KEY` as a repository secret. The workflow reviews the pull request diff,
205
+ uploads SARIF to code scanning, and fails on HIGH or CRITICAL findings.
206
+
207
+ ## Extend The Knowledge
208
+
209
+ Add security knowledge as markdown:
210
+
211
+ - Vulnerability class:
212
+ `codejury/knowledge/vulnerabilities/<id>.md`
213
+ - Language guide:
214
+ `codejury/knowledge/guides/languages/<language>.md`
215
+ - Framework guide:
216
+ `codejury/knowledge/guides/frameworks/<language>/<framework>.md`
217
+ - Protocol guide:
218
+ `codejury/knowledge/guides/protocols/<protocol>.md`
219
+
220
+ Keep frontmatter and detection signals data-driven. Avoid adding language, framework, or
221
+ vulnerability-specific detection logic to Python unless the engine itself needs a generic
222
+ capability.
223
+
224
+ ## Development
225
+
226
+ Run tests in a virtual environment:
227
+
228
+ ```bash
229
+ python -m venv .venv
230
+ . .venv/bin/activate
231
+ pip install -e ".[dev]"
232
+ pytest
233
+ ```
@@ -3,7 +3,7 @@
3
3
  Two paths matched to their nature: a coded diff-audit engine, a standard single
4
4
  call or an adversarial Finder/Challenger/Judge pass, and a whole-repo review run
5
5
  as a methodology by an interactive agent. Security knowledge lives in rich
6
- markdown vulnerability classes under data/vulnerabilities, injected into the
6
+ markdown vulnerability classes under knowledge/vulnerabilities, injected into the
7
7
  audit prompt, not in a rendered schema.
8
8
  """
9
9
 
@@ -11,5 +11,5 @@ from importlib.metadata import PackageNotFoundError, version
11
11
 
12
12
  try:
13
13
  __version__ = version("codejury")
14
- except PackageNotFoundError: # running from a source tree without an install
14
+ except PackageNotFoundError:
15
15
  __version__ = "0.0.0"