spidercob-sentinel 0.2.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.
- spidercob_sentinel-0.2.0/.env.example +25 -0
- spidercob_sentinel-0.2.0/.gitignore +12 -0
- spidercob_sentinel-0.2.0/Dockerfile +29 -0
- spidercob_sentinel-0.2.0/LICENSE +202 -0
- spidercob_sentinel-0.2.0/PKG-INFO +298 -0
- spidercob_sentinel-0.2.0/README.md +256 -0
- spidercob_sentinel-0.2.0/docker-compose.yml +14 -0
- spidercob_sentinel-0.2.0/pyproject.toml +67 -0
- spidercob_sentinel-0.2.0/scripts/fetch_rules.sh +15 -0
- spidercob_sentinel-0.2.0/src/spidercob_sentinel/__init__.py +46 -0
- spidercob_sentinel-0.2.0/src/spidercob_sentinel/autofix.py +116 -0
- spidercob_sentinel-0.2.0/src/spidercob_sentinel/cli.py +179 -0
- spidercob_sentinel-0.2.0/src/spidercob_sentinel/data/top_packages_npm.json +1 -0
- spidercob_sentinel-0.2.0/src/spidercob_sentinel/data/top_packages_pypi.json +1 -0
- spidercob_sentinel-0.2.0/src/spidercob_sentinel/deps.py +93 -0
- spidercob_sentinel-0.2.0/src/spidercob_sentinel/github_app.py +408 -0
- spidercob_sentinel-0.2.0/src/spidercob_sentinel/models.py +90 -0
- spidercob_sentinel-0.2.0/src/spidercob_sentinel/remediation.py +154 -0
- spidercob_sentinel-0.2.0/src/spidercob_sentinel/scan.py +94 -0
- spidercob_sentinel-0.2.0/src/spidercob_sentinel/scanner.py +264 -0
- spidercob_sentinel-0.2.0/src/spidercob_sentinel/secrets.py +51 -0
- spidercob_sentinel-0.2.0/src/spidercob_sentinel/triage.py +164 -0
- spidercob_sentinel-0.2.0/src/spidercob_sentinel/trust.py +297 -0
- spidercob_sentinel-0.2.0/tests/fixtures/jwt_unsafe.py +5 -0
- spidercob_sentinel-0.2.0/tests/fixtures/requirements.txt +2 -0
- spidercob_sentinel-0.2.0/tests/fixtures/vulnerable_view.py +19 -0
- spidercob_sentinel-0.2.0/tests/test_autofix.py +94 -0
- spidercob_sentinel-0.2.0/tests/test_deps.py +54 -0
- spidercob_sentinel-0.2.0/tests/test_github_app.py +107 -0
- spidercob_sentinel-0.2.0/tests/test_github_app_integration.py +113 -0
- spidercob_sentinel-0.2.0/tests/test_remediation.py +24 -0
- spidercob_sentinel-0.2.0/tests/test_scanner.py +55 -0
- spidercob_sentinel-0.2.0/tests/test_secrets.py +19 -0
- spidercob_sentinel-0.2.0/tests/test_triage.py +52 -0
- spidercob_sentinel-0.2.0/tests/test_trust.py +207 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Copy to .env and fill in. See README.md's "Register your own GitHub App"
|
|
2
|
+
# section for how to get these three values via GitHub's manifest flow.
|
|
3
|
+
GITHUB_APP_ID=
|
|
4
|
+
# Paste the full PEM content on one line with literal \n between lines, or
|
|
5
|
+
# use a multi-line env var in your Docker/systemd config.
|
|
6
|
+
GITHUB_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\n...\n-----END RSA PRIVATE KEY-----"
|
|
7
|
+
GITHUB_WEBHOOK_SECRET=
|
|
8
|
+
|
|
9
|
+
PORT=8000
|
|
10
|
+
|
|
11
|
+
# Minimum severity level that counts as "blocking" for the Check Run
|
|
12
|
+
# conclusion (LOW | MEDIUM | HIGH | CRITICAL). Default: HIGH
|
|
13
|
+
SENTINEL_MIN_SEVERITY=HIGH
|
|
14
|
+
|
|
15
|
+
# Maximum number of PR files to scan per event. Default: 50
|
|
16
|
+
SENTINEL_MAX_PR_FILES=50
|
|
17
|
+
|
|
18
|
+
# ── Optional: LLM triage ────────────────────────────────────────────────
|
|
19
|
+
# Without these, every PR check still runs — findings are just listed by
|
|
20
|
+
# severity with no plain-English explanation. Nothing is sent to any LLM
|
|
21
|
+
# unless you set SENTINEL_LLM_PROVIDER.
|
|
22
|
+
SENTINEL_LLM_PROVIDER=
|
|
23
|
+
SENTINEL_LLM_API_KEY=
|
|
24
|
+
SENTINEL_LLM_MODEL=
|
|
25
|
+
SENTINEL_OLLAMA_URL=
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# ─── Semgrep rules stage ──────────────────────────────────────────────────
|
|
2
|
+
# Sparse, depth-1, blob-filtered clone — same pattern as scripts/fetch_rules.sh,
|
|
3
|
+
# just baked into the image instead of run by hand. Keeps it to the handful
|
|
4
|
+
# of languages this tool supports (~9MB) instead of the full upstream repo,
|
|
5
|
+
# and a separate stage means git never ships in the runtime image.
|
|
6
|
+
FROM alpine/git:latest AS semgrep-rules
|
|
7
|
+
WORKDIR /rules
|
|
8
|
+
RUN git clone --depth 1 --filter=blob:none --sparse https://github.com/semgrep/semgrep-rules.git . && \
|
|
9
|
+
git sparse-checkout set python javascript typescript java php go && \
|
|
10
|
+
rm -rf .git
|
|
11
|
+
|
|
12
|
+
# ─── Runtime ───────────────────────────────────────────────────────────────
|
|
13
|
+
FROM python:3.11-slim
|
|
14
|
+
|
|
15
|
+
WORKDIR /app
|
|
16
|
+
|
|
17
|
+
RUN apt-get update && apt-get install -y --no-install-recommends git \
|
|
18
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
19
|
+
|
|
20
|
+
COPY pyproject.toml README.md LICENSE ./
|
|
21
|
+
COPY src/ src/
|
|
22
|
+
|
|
23
|
+
RUN pip install --no-cache-dir ".[github-app]"
|
|
24
|
+
|
|
25
|
+
COPY --from=semgrep-rules /rules /app/semgrep_rules
|
|
26
|
+
ENV SEMGREP_RULES_DIR=/app/semgrep_rules
|
|
27
|
+
|
|
28
|
+
EXPOSE 8000
|
|
29
|
+
CMD ["sentinel-github-app"]
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: spidercob-sentinel
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Open-source security triage & autofix agent for startups — cuts a pile of scan findings down to the 3 that matter, in plain English
|
|
5
|
+
Project-URL: Homepage, https://github.com/SpiderCob/spidercob-sentinel
|
|
6
|
+
Project-URL: Repository, https://github.com/SpiderCob/spidercob-sentinel
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/SpiderCob/spidercob-sentinel/issues
|
|
8
|
+
License: Apache-2.0
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: ai-agent,autofix,ci-cd,dependency-scanning,devsecops,sast,secrets,security,startups,vulnerability
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Security
|
|
20
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
21
|
+
Requires-Python: >=3.9
|
|
22
|
+
Requires-Dist: dlp-patterns>=0.4.0
|
|
23
|
+
Requires-Dist: osv-scan>=0.2.0
|
|
24
|
+
Provides-Extra: anthropic
|
|
25
|
+
Requires-Dist: anthropic>=0.25.0; extra == 'anthropic'
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: fastapi>=0.110.0; extra == 'dev'
|
|
28
|
+
Requires-Dist: httpx>=0.27; extra == 'dev'
|
|
29
|
+
Requires-Dist: pyjwt[crypto]>=2.8.0; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
|
|
31
|
+
Requires-Dist: pytest>=7; extra == 'dev'
|
|
32
|
+
Requires-Dist: semgrep>=1.75.0; extra == 'dev'
|
|
33
|
+
Provides-Extra: github-app
|
|
34
|
+
Requires-Dist: fastapi>=0.110.0; extra == 'github-app'
|
|
35
|
+
Requires-Dist: pyjwt[crypto]>=2.8.0; extra == 'github-app'
|
|
36
|
+
Requires-Dist: uvicorn>=0.24.0; extra == 'github-app'
|
|
37
|
+
Provides-Extra: openai
|
|
38
|
+
Requires-Dist: openai>=1.0.0; extra == 'openai'
|
|
39
|
+
Provides-Extra: scanner
|
|
40
|
+
Requires-Dist: semgrep>=1.75.0; extra == 'scanner'
|
|
41
|
+
Description-Content-Type: text/markdown
|
|
42
|
+
|
|
43
|
+
# spidercob-sentinel
|
|
44
|
+
|
|
45
|
+
Open-source security triage & autofix agent for startups.
|
|
46
|
+
|
|
47
|
+
Free scanners (Dependabot, Semgrep OSS, free Snyk tiers) already tell you
|
|
48
|
+
*what's wrong*. The actual problem for a team with no dedicated security
|
|
49
|
+
headcount is **noise**: forty findings a week, no idea which three matter,
|
|
50
|
+
and nobody with time to write the fix PR.
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pip install spidercob-sentinel
|
|
54
|
+
sentinel scan .
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
3 finding(s) (12 total, 9 not dead code)
|
|
59
|
+
|
|
60
|
+
[HIGH] SQL Injection — app/views.py:42
|
|
61
|
+
User-controlled data from a request is passed to 'execute()'.
|
|
62
|
+
Fix: Use parameterised queries: cursor.execute('SELECT * FROM users WHERE id = %s', (user_id,)). Never interpolate user input into SQL strings.
|
|
63
|
+
|
|
64
|
+
[CRITICAL] aws_access_key — config/settings.py:8
|
|
65
|
+
AWS Access Key ID
|
|
66
|
+
Fix: Rotate key immediately via AWS IAM console. Store in AWS Secrets Manager or as environment variables — never in source code.
|
|
67
|
+
(autofix available — rerun with --autofix-diff to see the patch)
|
|
68
|
+
|
|
69
|
+
[HIGH] CVE-2024-XXXXX — requirements.txt
|
|
70
|
+
requests 2.25.0: known vulnerability
|
|
71
|
+
Fix: Upgrade requests to 2.31.0.
|
|
72
|
+
(autofix available — rerun with --autofix-diff to see the patch)
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## What it does
|
|
76
|
+
|
|
77
|
+
Three scanners, one unified output:
|
|
78
|
+
|
|
79
|
+
- **Secrets & PII** — via [`dlp-patterns`](https://github.com/SpiderCob/dlp-patterns), zero-dependency regex engine.
|
|
80
|
+
- **Real vulnerabilities** — Semgrep-backed AST/dataflow static analysis
|
|
81
|
+
(SQLi, SSRF, command injection, path traversal, ...), plus a Python-AST
|
|
82
|
+
reachability pass so dead code doesn't get reported at the same severity
|
|
83
|
+
as something actually reachable from a route handler.
|
|
84
|
+
- **Known CVEs in your dependencies** — via [`dep-scanner`](https://github.com/SpiderCob/dep-scanner) (`osv-scan`), the free OSV.dev API.
|
|
85
|
+
|
|
86
|
+
Then the part that's actually new: **triage**. Point it at an LLM key you
|
|
87
|
+
already have (OpenAI, Anthropic, or a local Ollama) and it ranks the pile of
|
|
88
|
+
findings down to the handful that matter, with a plain-English paragraph on
|
|
89
|
+
each — not a textbook CWE definition, an answer to "do I need to care about
|
|
90
|
+
this today." No key configured? It still works, just severity-sorted with
|
|
91
|
+
no prose — nothing here requires an API key or sends your code anywhere.
|
|
92
|
+
|
|
93
|
+
## Check if a package is safe to add — before you install it
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
sentinel check pypi requests
|
|
97
|
+
sentinel check npm left-pad 1.3.0
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
No manifest file, no scan of your whole project — just "should I add this
|
|
101
|
+
one dependency." Combines known CVEs (`osv-scan`) with signals the public
|
|
102
|
+
registry actually exposes: package age, maintainer count, whether it runs
|
|
103
|
+
code on install (`preinstall`/`install`/`postinstall` — the classic
|
|
104
|
+
supply-chain vector: event-stream, ua-parser-js), and a typosquat check
|
|
105
|
+
against the most-downloaded packages in the ecosystem (edit-distance 1–2
|
|
106
|
+
from something like `colorama` or `requests`, while not being it, is a real
|
|
107
|
+
pattern real attacks use). Rule-based, same as autofix — never an LLM
|
|
108
|
+
guessing whether a supply-chain risk is real.
|
|
109
|
+
|
|
110
|
+
PyPI and npm only for now; a `rust`/other-ecosystem name degrades to
|
|
111
|
+
"unsupported" rather than a wrong answer. No network access needed for the
|
|
112
|
+
typosquat check itself (the reference lists ship with the package); the
|
|
113
|
+
registry/CVE lookups do need it and degrade to "unknown" on failure rather
|
|
114
|
+
than crashing — this has to work as a quick answer, not demand a retry.
|
|
115
|
+
|
|
116
|
+
## Autofix — deliberately narrow
|
|
117
|
+
|
|
118
|
+
Two sources only, both deterministic, **never LLM-generated**:
|
|
119
|
+
|
|
120
|
+
1. A Semgrep rule's own vetted `fix:` snippet, if the rule that matched ships one.
|
|
121
|
+
2. A dependency version bump to a known-patched release.
|
|
122
|
+
|
|
123
|
+
A security tool that writes its own security patches via a
|
|
124
|
+
hallucination-prone LLM is a credibility risk the moment it's wrong once.
|
|
125
|
+
The LLM here only ever writes prose (the triage explanation) — never a diff.
|
|
126
|
+
`sentinel scan . --autofix-diff` prints a unified diff for everything it can
|
|
127
|
+
fix; it never edits files in place or opens anything on its own in v1.
|
|
128
|
+
|
|
129
|
+
## What this honestly doesn't do
|
|
130
|
+
|
|
131
|
+
- **No interprocedural/cross-file taint tracking.** A source and sink split
|
|
132
|
+
across two functions or files won't be connected — that's Semgrep Pro,
|
|
133
|
+
a paid product. This tool doesn't pretend otherwise.
|
|
134
|
+
- **No IDOR or race-condition detection.** Both are about a *missing* check,
|
|
135
|
+
not a bad pattern present in the text — outside what static analysis can
|
|
136
|
+
prove at all.
|
|
137
|
+
- **Autofix coverage is real but modest** — only the subset of vendored
|
|
138
|
+
Semgrep rules that ship a `fix:`, plus `requirements.txt`-style dependency
|
|
139
|
+
bumps (other manifest formats are detected and explained, not yet
|
|
140
|
+
auto-patched).
|
|
141
|
+
- **Directory scans are slow today.** Each file gets its own `semgrep`
|
|
142
|
+
subprocess invocation, and loading the vendored rule set costs ~9s *per
|
|
143
|
+
invocation* on its own (measured against the Python rule set alone) —
|
|
144
|
+
scanning N files costs roughly N × 9s, not a one-time fixed cost. Fine for
|
|
145
|
+
`sentinel scan path/to/one_file.py` in a pre-commit hook; a full-repo or
|
|
146
|
+
whole-PR scan with many changed files will visibly add up. Batching all
|
|
147
|
+
files of one language into a single `semgrep` invocation (it natively
|
|
148
|
+
accepts multiple paths) would amortize that cost instead of paying it per
|
|
149
|
+
file — tracked as a roadmap item, not yet done.
|
|
150
|
+
|
|
151
|
+
## Install
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
pip install spidercob-sentinel
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
That's enough for `sentinel check` (package trust) and secrets/dependency
|
|
158
|
+
scanning. `sentinel scan`'s vulnerability pass additionally needs the real
|
|
159
|
+
`semgrep` CLI — it's an optional extra, not pulled in by default, since
|
|
160
|
+
`check`/secrets/dependency-CVE scanning have nothing to do with it and
|
|
161
|
+
semgrep is multi-GB with its own native deps:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
pip install "spidercob-sentinel[scanner]"
|
|
165
|
+
./scripts/fetch_rules.sh # sparse-clones github.com/semgrep/semgrep-rules into ./semgrep_rules
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## CLI
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
sentinel check pypi requests # is this dependency safe to add? no install needed
|
|
172
|
+
sentinel check npm left-pad 1.3.0
|
|
173
|
+
|
|
174
|
+
sentinel scan <path> # file or directory — needs the [scanner] extra above
|
|
175
|
+
sentinel scan . --json
|
|
176
|
+
sentinel scan . --min-severity HIGH
|
|
177
|
+
sentinel scan . --explain # needs SENTINEL_LLM_PROVIDER / SENTINEL_LLM_API_KEY
|
|
178
|
+
sentinel scan . --autofix-diff # print diffs, never writes files
|
|
179
|
+
sentinel scan . --fail-on-findings # exit 1 if anything at/above --min-severity (for CI)
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Environment variables for `--explain` (or pass `--llm-provider`/`--llm-api-key` directly):
|
|
183
|
+
|
|
184
|
+
| Variable | Values |
|
|
185
|
+
|---|---|
|
|
186
|
+
| `SENTINEL_LLM_PROVIDER` | `openai` \| `anthropic` \| `ollama` |
|
|
187
|
+
| `SENTINEL_LLM_API_KEY` | your key (not needed for `ollama`) |
|
|
188
|
+
| `SENTINEL_LLM_MODEL` | optional, defaults to a sensible per-provider model |
|
|
189
|
+
| `SENTINEL_OLLAMA_URL` | optional, defaults to `http://localhost:11434` |
|
|
190
|
+
|
|
191
|
+
## Library
|
|
192
|
+
|
|
193
|
+
```python
|
|
194
|
+
import asyncio
|
|
195
|
+
from spidercob_sentinel import scan_path
|
|
196
|
+
|
|
197
|
+
report = asyncio.run(scan_path("./my-project"))
|
|
198
|
+
print(report.total, "findings,", len(report.blocking), "worth a look")
|
|
199
|
+
for f in report.sorted_by_severity():
|
|
200
|
+
print(f.severity, f.type, f.file, f.line, "-", f.remediation)
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
```python
|
|
204
|
+
from spidercob_sentinel import check_package
|
|
205
|
+
|
|
206
|
+
report = check_package("npm", "left-pad")
|
|
207
|
+
print(report.overall, report.version)
|
|
208
|
+
for s in report.signals:
|
|
209
|
+
print(s.status, s.name, "-", s.detail)
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## GitHub App: runs on every PR
|
|
213
|
+
|
|
214
|
+
The webhook server (`sentinel-github-app`) runs the full scan + triage
|
|
215
|
+
pipeline on every `pull_request` event, posts a Check Run and inline review
|
|
216
|
+
comments, and opens an autofix PR into the PR's own branch for anything with
|
|
217
|
+
a mechanical fix. There's no Spidercob-run instance of this to install from
|
|
218
|
+
a marketplace — you register your own GitHub App, same as any other
|
|
219
|
+
self-hosted integration.
|
|
220
|
+
|
|
221
|
+
### Deploy it somewhere reachable
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
cp .env.example .env # fill in after the next step
|
|
225
|
+
docker compose up --build -d
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
It needs a public URL GitHub can reach for the webhook (your own domain,
|
|
229
|
+
a reverse-proxied box, an ngrok tunnel for testing — anything that resolves
|
|
230
|
+
to `http://localhost:8000` from the outside).
|
|
231
|
+
|
|
232
|
+
### Register your own GitHub App (manifest flow — no form-filling)
|
|
233
|
+
|
|
234
|
+
GitHub's [app manifest flow](https://docs.github.com/en/apps/sharing-github-apps/registering-a-github-app-from-a-manifest)
|
|
235
|
+
lets you create a fully-configured app with one click instead of filling in
|
|
236
|
+
a dozen fields by hand. Save this as `register.html`, replace
|
|
237
|
+
`YOUR_DOMAIN_HERE`, open it in a browser while logged into GitHub, and click
|
|
238
|
+
through:
|
|
239
|
+
|
|
240
|
+
```html
|
|
241
|
+
<!doctype html>
|
|
242
|
+
<form id="f" action="https://github.com/settings/apps/new" method="post">
|
|
243
|
+
<input type="hidden" name="manifest" id="manifest">
|
|
244
|
+
</form>
|
|
245
|
+
<script>
|
|
246
|
+
const manifest = {
|
|
247
|
+
name: "My Spidercob Sentinel",
|
|
248
|
+
url: "https://YOUR_DOMAIN_HERE",
|
|
249
|
+
hook_attributes: { url: "https://YOUR_DOMAIN_HERE/github/webhooks" },
|
|
250
|
+
redirect_url: "https://YOUR_DOMAIN_HERE/",
|
|
251
|
+
public: false,
|
|
252
|
+
default_events: ["pull_request"],
|
|
253
|
+
default_permissions: {
|
|
254
|
+
contents: "read", pull_requests: "write", checks: "write", metadata: "read",
|
|
255
|
+
},
|
|
256
|
+
};
|
|
257
|
+
document.getElementById('manifest').value = JSON.stringify(manifest);
|
|
258
|
+
document.getElementById('f').submit();
|
|
259
|
+
</script>
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
After you click "Create GitHub App" on GitHub's confirmation screen, it
|
|
263
|
+
redirects to `redirect_url` with `?code=...` in the address bar. Exchange
|
|
264
|
+
that code once (it's single-use) for your real credentials:
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
curl -s -X POST https://api.github.com/app-manifests/THE_CODE_FROM_THE_URL/conversions \
|
|
268
|
+
| python3 -c "import json,sys; d=json.load(sys.stdin); print('GITHUB_APP_ID='+str(d['id'])); print('GITHUB_WEBHOOK_SECRET='+d['webhook_secret']); print('GITHUB_PRIVATE_KEY<<<'); print(d['pem'])"
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
Put `id` → `GITHUB_APP_ID`, `webhook_secret` → `GITHUB_WEBHOOK_SECRET`, and
|
|
272
|
+
`pem` → `GITHUB_PRIVATE_KEY` (with `\n` for newlines, or your platform's
|
|
273
|
+
multi-line env var syntax) into `.env`, then restart the container and
|
|
274
|
+
install the app on whichever repos you want it watching (Settings → your
|
|
275
|
+
app → Install App).
|
|
276
|
+
|
|
277
|
+
## Roadmap
|
|
278
|
+
|
|
279
|
+
- [x] Semgrep + reachability + secrets + dependency-CVE scanning, unified
|
|
280
|
+
- [x] CLI with JSON output, CI exit codes
|
|
281
|
+
- [x] LLM triage layer (bring your own key)
|
|
282
|
+
- [x] Deterministic autofix diffs (Semgrep `fix:` + dependency bumps)
|
|
283
|
+
- [x] GitHub App: runs on every PR, posts a Check Run + review comments,
|
|
284
|
+
opens autofix PRs for mechanical fixes
|
|
285
|
+
- [x] Docker image / `docker compose up` self-hosting
|
|
286
|
+
- [x] `sentinel check` — package trust check (CVEs, typosquat, maintainer/age/install-script signals), zero install required for the hosted version at spidercob.com
|
|
287
|
+
- [ ] OpenSSF Scorecard integration for `sentinel check`
|
|
288
|
+
- [ ] `sentinel check` for Go/crates.io/Maven (osv-scan already covers their CVEs; age/maintainer/typosquat signals aren't wired up for them yet)
|
|
289
|
+
- [ ] Slack Q&A ("are we exposed to CVE-XXXX?")
|
|
290
|
+
- [ ] Broader autofix coverage (more manifest formats)
|
|
291
|
+
- [ ] Batch Semgrep invocations per language instead of one process per file
|
|
292
|
+
|
|
293
|
+
Not planned: cloud/infra config scanning, cross-file taint tracking,
|
|
294
|
+
LLM-generated code patches.
|
|
295
|
+
|
|
296
|
+
## License
|
|
297
|
+
|
|
298
|
+
Apache-2.0
|