cleartoship 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ATTRIBUTION.md +115 -0
- package/LICENSES/gitleaks-MIT.txt +21 -0
- package/LICENSES/guardvibe-Apache-2.0.txt +191 -0
- package/LICENSES/guardvibe-NOTICE.txt +4 -0
- package/README.md +104 -24
- package/SECURITY.md +70 -0
- package/action.yml +3 -3
- package/dist/cli.js +3 -0
- package/dist/report.js +1 -0
- package/dist/scan.d.ts +4 -0
- package/dist/scan.js +13 -1
- package/dist/scanners/auth-helpers.d.ts +16 -0
- package/dist/scanners/auth-helpers.js +169 -0
- package/dist/scanners/community.js +130 -7
- package/dist/scanners/logic.js +8 -1
- package/dist/scanners/server-actions.js +286 -32
- package/dist/utils/ast.js +4 -1
- package/dist/utils/files.d.ts +8 -1
- package/dist/utils/files.js +27 -5
- package/dist/utils/gitignore.d.ts +21 -0
- package/dist/utils/gitignore.js +140 -0
- package/dist/utils/modules.d.ts +16 -0
- package/dist/utils/modules.js +67 -0
- package/dist/utils/paths.d.ts +21 -0
- package/dist/utils/paths.js +48 -0
- package/examples/security-cli.yml +42 -0
- package/examples/security.yml +8 -2
- package/package.json +6 -6
package/ATTRIBUTION.md
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Attribution
|
|
2
|
+
|
|
3
|
+
ClearToShip vendors and adapts work from other projects. This file records what,
|
|
4
|
+
from where, and under which licence.
|
|
5
|
+
|
|
6
|
+
## Vendored code
|
|
7
|
+
|
|
8
|
+
### GuardVibe — `src/vendor/guardvibe/`
|
|
9
|
+
|
|
10
|
+
- Source: https://github.com/goklab/guardvibe
|
|
11
|
+
- Copyright 2026 GokLab
|
|
12
|
+
- Licence: Apache License 2.0 — full text in `LICENSES/guardvibe-Apache-2.0.txt`,
|
|
13
|
+
upstream NOTICE in `LICENSES/guardvibe-NOTICE.txt`
|
|
14
|
+
|
|
15
|
+
468 security rules are vendored verbatim under `src/vendor/guardvibe/rules/`.
|
|
16
|
+
Each file carries a provenance header. Rule content is **unmodified**; the only
|
|
17
|
+
changes are the added headers and an aggregating `index.ts` written by this
|
|
18
|
+
project.
|
|
19
|
+
|
|
20
|
+
Modifications, as required by Apache-2.0 §4(b), are made at runtime in
|
|
21
|
+
`src/scanners/community.ts` rather than in the vendored files:
|
|
22
|
+
|
|
23
|
+
- **27 rules are superseded** by ClearToShip's own AST and schema checks, which
|
|
24
|
+
reason over a whole function body or a replayed migration rather than a fixed
|
|
25
|
+
character window. Running both would double-report the same defect and import
|
|
26
|
+
the less precise location. Each is listed with the rule that replaces it.
|
|
27
|
+
- **5 rules are withheld** as measurably noisy in this tool's context — for
|
|
28
|
+
example `VG543`, which matches `; DROP|DELETE|INSERT …` anywhere in a `.sql`
|
|
29
|
+
file and therefore fires on the normal shape of every migration. Each is
|
|
30
|
+
listed with its reason.
|
|
31
|
+
- Findings in test, fixture and documentation paths are reported at `low`.
|
|
32
|
+
|
|
33
|
+
Every vendored finding carries `meta.source: "guardvibe"` and its attribution
|
|
34
|
+
string, so provenance survives into JSON and SARIF output.
|
|
35
|
+
|
|
36
|
+
### gitleaks — `src/vendor/gitleaks/rules.ts`
|
|
37
|
+
|
|
38
|
+
- Source: https://github.com/gitleaks/gitleaks (`config/gitleaks.toml`)
|
|
39
|
+
- Copyright (c) 2019 Zachary Rice
|
|
40
|
+
- Licence: MIT — full text in `LICENSES/gitleaks-MIT.txt`
|
|
41
|
+
|
|
42
|
+
221 of 222 credential detection rules are converted from the upstream TOML into
|
|
43
|
+
a generated TypeScript module by `scripts/vendor-gitleaks.mjs`. Rule ids,
|
|
44
|
+
descriptions, entropy thresholds and keyword prefilters are carried over
|
|
45
|
+
unchanged.
|
|
46
|
+
|
|
47
|
+
Modifications:
|
|
48
|
+
|
|
49
|
+
- **Regex dialect.** Upstream patterns are Go RE2. A leading `(?i)` becomes the
|
|
50
|
+
JavaScript `i` flag and `(?P<n>)` becomes `(?<n>)`. 37 rules use *scoped*
|
|
51
|
+
inline flags — `(?i:…)`, `(?-i:…)` — which JavaScript has no equivalent for;
|
|
52
|
+
rather than drop them, the flag is hoisted to the whole pattern. The cost is
|
|
53
|
+
precision, not safety: a prefix upstream matched case-sensitively now matches
|
|
54
|
+
either way, and every match still has to clear the entropy threshold. One rule
|
|
55
|
+
could not be converted and is omitted.
|
|
56
|
+
- **2 rules are withheld** as noisy, each with its reason in
|
|
57
|
+
`src/scanners/secrets.ts`: `generic-api-key` (gitleaks' own catch-all — 97 of 118 hits across the
|
|
58
|
+
reference corpus were false, including ordinary arrays of method names) and
|
|
59
|
+
`sourcegraph-access-token` (matches any 40-character hex string, so every
|
|
60
|
+
SHA-pinned GitHub Action reads as a leaked token).
|
|
61
|
+
- Per-rule allowlists are not carried over; ClearToShip applies its own
|
|
62
|
+
placeholder, entropy, hex-digest and fixture-path filters instead.
|
|
63
|
+
|
|
64
|
+
Findings carry `meta.source: "gitleaks"` and the attribution string.
|
|
65
|
+
|
|
66
|
+
## Services queried
|
|
67
|
+
|
|
68
|
+
### OSV.dev
|
|
69
|
+
|
|
70
|
+
Known-vulnerability data comes from https://osv.dev via its public HTTP API —
|
|
71
|
+
the same database behind Google's `osv-scanner` (Apache-2.0). Nothing is
|
|
72
|
+
vendored and no licence attaches; ClearToShip queries the API at scan time.
|
|
73
|
+
|
|
74
|
+
This is why the vendored CVE-version rules stand down whenever OSV answers: a
|
|
75
|
+
rule that hard-codes "next before 14.1.1" is stale the week after it is written,
|
|
76
|
+
while OSV is current. Offline (`--offline`), the vendored rules are the fallback.
|
|
77
|
+
|
|
78
|
+
## Ideas adopted, code not copied
|
|
79
|
+
|
|
80
|
+
These informed the rule set. No code, regex or rule text was taken.
|
|
81
|
+
|
|
82
|
+
| Project | Licence | What it informed |
|
|
83
|
+
| --- | --- | --- |
|
|
84
|
+
| [supabase/splinter](https://github.com/supabase/splinter) | none stated | The vulnerability classes behind CTS010–019 and CTS050–052. Splinter queries a live database; ClearToShip reimplements these statically against migration files. |
|
|
85
|
+
| [slopcheck](https://github.com/mattschaller/slopcheck) | MIT | Distinguishing HTTP 451 (pulled for malware) from 404 (never existed) from unpublished-with-installs (open to takeover) — CTS026/CTS027 — and reading install commands out of prose and agent instruction files. |
|
|
86
|
+
|
|
87
|
+
## Licence status of every candidate considered
|
|
88
|
+
|
|
89
|
+
Verified against the GitHub API and the repositories' own LICENSE files, because
|
|
90
|
+
second-hand licence claims about these projects are frequently wrong.
|
|
91
|
+
|
|
92
|
+
| Project | Actual licence | Usable in a commercial SaaS? |
|
|
93
|
+
| --- | --- | --- |
|
|
94
|
+
| gitleaks | MIT | **Yes** — vendored above |
|
|
95
|
+
| google/osv-scanner | Apache-2.0 | Yes (we use the OSV API rather than the binary) |
|
|
96
|
+
| aquasecurity/trivy | Apache-2.0 | Yes |
|
|
97
|
+
| dependency-check/DependencyCheck | Apache-2.0 | Yes |
|
|
98
|
+
| projectdiscovery/nuclei + templates | MIT | Yes (DAST — needs a running app, out of scope here) |
|
|
99
|
+
| zaproxy/zaproxy | Apache-2.0 | Yes (DAST) |
|
|
100
|
+
| OWASP/Nettacker | Apache-2.0 | Yes (recon) |
|
|
101
|
+
| goklab/guardvibe | Apache-2.0 | **Yes** — vendored above |
|
|
102
|
+
| octokit, probot, babel, zod, shadcn/ui | MIT / ISC | Yes |
|
|
103
|
+
| semgrep/semgrep | **LGPL-2.1**, not Apache | Only as a subprocess. LGPL is copyleft; invoking the CLI is fine, linking it into the product is not. Its *rules* are separately under the Semgrep Rules License. |
|
|
104
|
+
| trufflesecurity/trufflehog | **AGPL-3.0** | No, unless ClearToShip itself ships under AGPL. gitleaks is the permissive equivalent and is what we used. |
|
|
105
|
+
| elicosilva/RouteWarden | AGPL-3.0 | Same. |
|
|
106
|
+
| wapiti | GPL-2.0 | Subprocess only. |
|
|
107
|
+
| sqlmap, nikto | GPL-2.0 | Subprocess only. |
|
|
108
|
+
| **Bearer/bearer** | **Elastic License 2.0** | **No.** ELv2 specifically prohibits providing the software to third parties as a hosted or managed service — which is precisely what a ClearToShip SaaS would be. It is not an open-source licence. |
|
|
109
|
+
| supabase/splinter | **none** | No licence file means no licence granted. Ideas only. |
|
|
110
|
+
| bscript/supabase-exposure-check | none | Same. |
|
|
111
|
+
|
|
112
|
+
Taking a part rather than the whole does not change any of this: copyright and
|
|
113
|
+
the AGPL both apply to substantial portions, not only to entire programs. What
|
|
114
|
+
is genuinely free to take is the *idea* — the class of vulnerability, the fact
|
|
115
|
+
that a check is worth making. Expression (regexes, queries, rule prose) is not.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Zachary Rice
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,191 @@
|
|
|
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 the 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 the 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 any 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
|
+
Copyright 2026 GokLab
|
|
180
|
+
|
|
181
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
182
|
+
you may not use this file except in compliance with the License.
|
|
183
|
+
You may obtain a copy of the License at
|
|
184
|
+
|
|
185
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
186
|
+
|
|
187
|
+
Unless required by applicable law or agreed to in writing, software
|
|
188
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
189
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
190
|
+
See the License for the specific language governing permissions and
|
|
191
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ npx cleartoship
|
|
|
21
21
|
| Rule | Severity | What it catches |
|
|
22
22
|
| --- | --- | --- |
|
|
23
23
|
| **CTS001** | critical | Server Action / Route Handler mutates the database with no session check |
|
|
24
|
-
| **CTS002** | high |
|
|
24
|
+
| **CTS002** | high | Caller's payload written to the database as an object — every key they sent becomes a column |
|
|
25
25
|
| **CTS003** | critical | `SUPABASE_SERVICE_ROLE_KEY` client built inside a user-reachable action |
|
|
26
26
|
| **CTS004** | medium | Authenticated mutation keyed only on a caller-supplied id (IDOR) |
|
|
27
27
|
| **CTS040** | high | Client component reads a server-side `process.env` variable |
|
|
@@ -87,7 +87,7 @@ reaches a manifest.
|
|
|
87
87
|
| **CTS071** | high/medium | A security check that **fails open** — `catch { return true }` — or swallows its error (A10) |
|
|
88
88
|
| **CTS072** | high | Insecure deserialization of untrusted data — `unserialize`, `pickle.loads`, unsafe `yaml.load` (A08) |
|
|
89
89
|
|
|
90
|
-
**Community ruleset** —
|
|
90
|
+
**Community ruleset** — 435 additional rules vendored from
|
|
91
91
|
[GuardVibe](https://github.com/goklab/guardvibe) (Apache-2.0)
|
|
92
92
|
|
|
93
93
|
Reported under their upstream `VG###` ids. These cover ground the AST scanners
|
|
@@ -97,9 +97,15 @@ Dockerfiles, Terraform, GitHub Actions pinning, prompt injection and MCP tool
|
|
|
97
97
|
runtimes, React Native, Go and shell.
|
|
98
98
|
|
|
99
99
|
27 upstream rules are **superseded** where ClearToShip's own AST check is more
|
|
100
|
-
precise,
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
precise, 6 are **withheld** as measurably noisy, 5 carry a **match guard** for a
|
|
101
|
+
shape their regex cannot exclude (a `"link": true` lockfile entry has no
|
|
102
|
+
integrity hash by design; `querySelectorAll` is not a SQL call; `eval()` inside
|
|
103
|
+
a sentence about eval is prose), and 3 name-heuristic rules are
|
|
104
|
+
**manifest-only** — they never run over a `package-lock.json`, where they matched
|
|
105
|
+
ordinary transitive packages (`fast-glob`, `core-js`) and named nothing anyone
|
|
106
|
+
could act on. Each list carries a reason per rule in
|
|
107
|
+
`src/scanners/community.ts`. Run `--no-community` to use only ClearToShip's
|
|
108
|
+
rules. See [ATTRIBUTION.md](ATTRIBUTION.md).
|
|
103
109
|
|
|
104
110
|
Findings map to **OWASP Top 10:2025** and CWE.
|
|
105
111
|
|
|
@@ -150,6 +156,7 @@ npx cleartoship --sarif -o results.sarif # GitHub code scanning
|
|
|
150
156
|
npx cleartoship --fail-on high # stricter CI gate (default: critical)
|
|
151
157
|
npx cleartoship --ignore CTS004,CTS022 # skip rules
|
|
152
158
|
npx cleartoship --no-community # ClearToShip rules only
|
|
159
|
+
npx cleartoship --no-gitignore # also scan what .gitignore excludes
|
|
153
160
|
npx cleartoship --markdown # markdown report (PR comments / summaries)
|
|
154
161
|
```
|
|
155
162
|
|
|
@@ -166,7 +173,33 @@ room to be written out.
|
|
|
166
173
|
|
|
167
174
|
## Continuous integration
|
|
168
175
|
|
|
169
|
-
###
|
|
176
|
+
### The CLI (works anywhere, today)
|
|
177
|
+
|
|
178
|
+
One line in any workflow, on any CI. It needs nothing from GitHub beyond npm:
|
|
179
|
+
|
|
180
|
+
```yaml
|
|
181
|
+
- run: npx cleartoship --fail-on=critical
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
To feed findings into GitHub's Security tab:
|
|
185
|
+
|
|
186
|
+
```yaml
|
|
187
|
+
- run: npx cleartoship --sarif -o results.sarif --fail-on=none
|
|
188
|
+
- uses: github/codeql-action/upload-sarif@v4
|
|
189
|
+
with: { sarif_file: results.sarif }
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
A copyable workflow is in [`examples/security-cli.yml`](examples/security-cli.yml).
|
|
193
|
+
|
|
194
|
+
### GitHub Action
|
|
195
|
+
|
|
196
|
+
> **Not usable from other repositories yet.** The action lives in *this*
|
|
197
|
+
> repository, which is currently private, so `uses: murtazaozdemir/cleartoship@…`
|
|
198
|
+
> resolves for nobody but its owner — GitHub answers `Unable to resolve action`
|
|
199
|
+
> — and it cannot be listed on the Marketplace. Nothing about it is broken; it
|
|
200
|
+
> simply needs the repository to be public, and it works the day that happens.
|
|
201
|
+
> Until then, use the CLI recipe above. The npm package itself is public and
|
|
202
|
+
> unaffected.
|
|
170
203
|
|
|
171
204
|
Posts a summary comment on every pull request, blocks the merge on critical
|
|
172
205
|
findings, and optionally uploads to the Security tab. Copy
|
|
@@ -182,8 +215,8 @@ jobs:
|
|
|
182
215
|
preflight:
|
|
183
216
|
runs-on: ubuntu-latest
|
|
184
217
|
steps:
|
|
185
|
-
- uses: actions/checkout@
|
|
186
|
-
- uses: murtazaozdemir/cleartoship@v0.
|
|
218
|
+
- uses: actions/checkout@v7
|
|
219
|
+
- uses: murtazaozdemir/cleartoship@v0.10.0
|
|
187
220
|
with:
|
|
188
221
|
fail-on: critical
|
|
189
222
|
comment: true
|
|
@@ -205,27 +238,14 @@ above `fail-on`) for use in later steps. The comment is *sticky* — re-runs edi
|
|
|
205
238
|
the same comment instead of piling up.
|
|
206
239
|
|
|
207
240
|
By default the action runs the scanner version its own ref declares, so
|
|
208
|
-
`@v0.
|
|
241
|
+
`@v0.10.0` runs `cleartoship@0.10.0` and pinning the ref pins the behaviour. If
|
|
209
242
|
that version is not on the registry, it builds from its own checkout instead, so
|
|
210
243
|
`uses: …@ref` works against an unpublished commit.
|
|
211
244
|
|
|
212
|
-
### Plain CLI
|
|
213
|
-
|
|
214
|
-
```yaml
|
|
215
|
-
- run: npx cleartoship --fail-on=critical
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
To feed findings into GitHub's Security tab without the Action:
|
|
219
|
-
|
|
220
|
-
```yaml
|
|
221
|
-
- run: npx cleartoship --sarif -o results.sarif --fail-on=none
|
|
222
|
-
- uses: github/codeql-action/upload-sarif@v3
|
|
223
|
-
with: { sarif_file: results.sarif }
|
|
224
|
-
```
|
|
225
|
-
|
|
226
245
|
## How it works
|
|
227
246
|
|
|
228
|
-
|
|
247
|
+
Six scanners, all static: your source is read and parsed, never executed, never
|
|
248
|
+
uploaded, and no database is connected to.
|
|
229
249
|
|
|
230
250
|
1. **Server Actions & Route Handlers** — parses TS/TSX with Babel, finds every exported
|
|
231
251
|
function reachable over HTTP (`'use server'` modules, inline directives, `app/**/route.ts`
|
|
@@ -258,8 +278,68 @@ Four scanners, all static — nothing is uploaded and no database is contacted.
|
|
|
258
278
|
a network blip must never be reported as a hallucinated dependency.
|
|
259
279
|
- **Test fixtures are not breaches.** Credentials under `tests/`, `fixtures/`, `docs/` or in a
|
|
260
280
|
commented-out line are reported at `low`, never as blocking criticals.
|
|
281
|
+
- **Where a file lives changes what a finding costs.** CTS024 already separated a
|
|
282
|
+
CVE that ships from one that only ever runs on your machine; the same reasoning
|
|
283
|
+
now covers the rules that read code. An interpolated query in `scripts/`, a
|
|
284
|
+
swallowed error in a `*.config.ts` — build and maintenance tooling runs with
|
|
285
|
+
credentials its author already holds and never answers a request from the
|
|
286
|
+
internet, so those drop one severity step, with the reason attached to the
|
|
287
|
+
finding rather than applied silently. `bin/` and `migrations/` are deliberately
|
|
288
|
+
excluded: one is a published CLI's entry point, the other is production schema.
|
|
289
|
+
Across five dogfooded repos this moved 21 findings out of `critical` without
|
|
290
|
+
hiding one of them.
|
|
291
|
+
- **Mass assignment means the payload arrives whole.** CTS002 and CTS043 fire when
|
|
292
|
+
the object the caller sent reaches the columns — `update(body)`,
|
|
293
|
+
`data: { ...input }`, including one level down where Prisma and Drizzle put it.
|
|
294
|
+
Reading named fields into an explicit column list is the safe pattern and is
|
|
295
|
+
never reported, whether or not a schema library was involved: of 102 findings
|
|
296
|
+
the old, broader rule produced on one dogfooded app, all 102 were that shape.
|
|
261
297
|
- **Precision over recall on the noisy rules.** Typosquat matching skips exact matches and
|
|
262
298
|
names shorter than five characters, where one-edit neighbours are meaningless.
|
|
299
|
+
- **Your `.gitignore` decides what counts as your project.** Ignored paths are
|
|
300
|
+
not scanned: they never reach a CI checkout, so a finding there is one nobody
|
|
301
|
+
can act on and nobody's pipeline would reproduce. This is usually the
|
|
302
|
+
difference between a usable report and an unreadable one — a repo with a
|
|
303
|
+
gitignored folder of reference apps went from 1,487 findings to 235, and from
|
|
304
|
+
84 seconds to 2. `.env` files are the deliberate exception, since a secret on
|
|
305
|
+
your disk is a secret either way and CTS032 exists to check that the file *is*
|
|
306
|
+
ignored. `--no-gitignore` scans everything, and the report always says how many
|
|
307
|
+
paths were skipped.
|
|
308
|
+
- **Auth is followed into the helper it lives in.** Almost no real app repeats the
|
|
309
|
+
session check inside every action — it resolves in `lib/auth.ts`, or in a
|
|
310
|
+
framework helper such as Shopify's `handleSessionToken`, and each action calls
|
|
311
|
+
that. ClearToShip resolves first-party imports (relative paths and `@/`-style
|
|
312
|
+
aliases) and credits a call whose helper authenticates, directly or through
|
|
313
|
+
another helper. Third-party packages are never followed, so a call into
|
|
314
|
+
`node_modules` still proves nothing on its own.
|
|
315
|
+
- **A machine endpoint authenticates differently.** Comparing an `Authorization`
|
|
316
|
+
header against a server-side secret is the auth check for a cron or
|
|
317
|
+
webhook route, and a verified provider signature *is* the caller's identity —
|
|
318
|
+
neither is reported as missing authorization.
|
|
319
|
+
|
|
320
|
+
## Trust
|
|
321
|
+
|
|
322
|
+
A security tool earns its place by being auditable, so the guarantees are stated
|
|
323
|
+
plainly and each one is checkable in a few seconds. `SECURITY.md` has the full
|
|
324
|
+
version, including how to report a vulnerability.
|
|
325
|
+
|
|
326
|
+
- **Read-only on your code.** The only files ClearToShip writes are the report
|
|
327
|
+
you ask for with `--output` and its 24-hour registry cache under
|
|
328
|
+
`~/.cache/cleartoship`. Nothing under the scan root is ever modified.
|
|
329
|
+
- **Your code is never executed.** No `child_process`, no `eval`, no dynamic
|
|
330
|
+
import of a scanned file. Everything is text, an AST and regexes — which is
|
|
331
|
+
also why it is safe to point at a repository you have not read yet.
|
|
332
|
+
- **No source leaves the machine.** Online, three hosts are contacted and they
|
|
333
|
+
receive package **names and versions** only: `registry.npmjs.org` /
|
|
334
|
+
`api.npmjs.org`, `pypi.org`, `api.osv.dev`. No file contents, no paths, no
|
|
335
|
+
project name. `--offline` disables all three and makes a run a pure local
|
|
336
|
+
computation.
|
|
337
|
+
- **No database connection.** The RLS checks read your migration files. There is
|
|
338
|
+
no database driver in the dependency tree.
|
|
339
|
+
- **Five runtime dependencies.** Three Babel packages, `commander`,
|
|
340
|
+
`picocolors`. The GuardVibe and gitleaks rulesets are vendored into
|
|
341
|
+
`src/vendor/`, not installed, so they are visible in every diff and pinned by
|
|
342
|
+
construction.
|
|
263
343
|
|
|
264
344
|
## Programmatic use
|
|
265
345
|
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Security
|
|
2
|
+
|
|
3
|
+
ClearToShip is a security tool, so it asks for the same scrutiny it applies. This
|
|
4
|
+
document states exactly what it does on your machine, what leaves it, and how to
|
|
5
|
+
check both for yourself rather than take it on faith.
|
|
6
|
+
|
|
7
|
+
## Reporting a vulnerability
|
|
8
|
+
|
|
9
|
+
Report privately through the repository's **Security → Report a vulnerability**
|
|
10
|
+
tab (GitHub private vulnerability reporting). Please include the version
|
|
11
|
+
(`cleartoship --version`), the smallest input that reproduces the problem, and
|
|
12
|
+
what you expected instead. Non-sensitive bugs — a false positive, a crash on a
|
|
13
|
+
weird file — belong in a normal issue.
|
|
14
|
+
|
|
15
|
+
Fixes ship in a patch release. The `latest` published version is the only
|
|
16
|
+
supported one; older versions are not backported.
|
|
17
|
+
|
|
18
|
+
## What it does to your project
|
|
19
|
+
|
|
20
|
+
| Guarantee | Why it holds |
|
|
21
|
+
| --- | --- |
|
|
22
|
+
| **Never writes to the scanned project** | The only writes in the codebase are the report file you ask for with `--output <path>` and the registry cache. Verify: `grep -rn "writeFileSync\|mkdirSync\|rmSync\|unlink" src/ --exclude-dir=vendor` — five lines, of which two are imports and three are those call sites. Neither path is derived from the scan root. |
|
|
23
|
+
| **Never executes your code** | The scanner has no `child_process`, `exec`, `spawn`, `eval`, `new Function`, or dynamic `import()` of scanned files. Your code is read as text, parsed by Babel into an AST, and matched against regexes. Verify: `grep -rn "child_process\|execSync\|spawn\|eval(\|new Function" src/ --exclude-dir=vendor` — one hit, and it is a *pattern string* in the rule that detects those calls in **your** install hooks. (Drop `--exclude-dir=vendor` and the extra hits are rule text in the vendored ruleset, matched against your code, never run.) |
|
|
24
|
+
| **Never connects to your database** | The Row Level Security scanner replays your `.sql` migration files to model the resulting schema. There is no database driver in the dependency tree and no connection string is ever read. |
|
|
25
|
+
| **Reads only what it scans** | Files are gathered by walking the scan root, skipping `node_modules`, build output, virtualenvs and anything your own `.gitignore` excludes. Ignore rules are read from the scan root downwards only — never from a parent directory — so nothing outside the root is read except the cache directory. |
|
|
26
|
+
|
|
27
|
+
## What leaves your machine
|
|
28
|
+
|
|
29
|
+
Three hosts, and only when a scan runs online:
|
|
30
|
+
|
|
31
|
+
| Host | Sent | Purpose |
|
|
32
|
+
| --- | --- | --- |
|
|
33
|
+
| `registry.npmjs.org`, `api.npmjs.org` | package **name** (in the URL), nothing else | does this package exist, when was it published, how many weekly downloads, is it deprecated |
|
|
34
|
+
| `pypi.org` | package **name** | the same, for `requirements.txt` |
|
|
35
|
+
| `api.osv.dev` | package **name** + resolved **version** | known-vulnerability lookup |
|
|
36
|
+
|
|
37
|
+
No file contents, no paths, no repository name, no identifier of you or your
|
|
38
|
+
project is ever transmitted. Responses are cached for 24 hours under
|
|
39
|
+
`~/.cache/cleartoship` (override with `CLEARTOSHIP_CACHE`).
|
|
40
|
+
|
|
41
|
+
**`--offline` stops even that.** Every network path is behind the same flag: the
|
|
42
|
+
dependency scanner returns early, and the registry client refuses to fetch. An
|
|
43
|
+
offline run is a pure local computation, and it is the right default in CI on a
|
|
44
|
+
private codebase.
|
|
45
|
+
|
|
46
|
+
## Dependency surface
|
|
47
|
+
|
|
48
|
+
Five runtime dependencies, all first-party Babel or long-established
|
|
49
|
+
single-purpose packages:
|
|
50
|
+
|
|
51
|
+
- `@babel/parser`, `@babel/traverse`, `@babel/types` — the TS/TSX parser and AST walker
|
|
52
|
+
- `commander` — argument parsing
|
|
53
|
+
- `picocolors` — terminal colour, zero dependencies
|
|
54
|
+
|
|
55
|
+
Two rulesets are **vendored** into `src/vendor/` rather than installed, so they
|
|
56
|
+
are visible in the diff and cannot change under you between releases:
|
|
57
|
+
[GuardVibe](https://github.com/goklab/guardvibe) (Apache-2.0) and
|
|
58
|
+
[gitleaks](https://github.com/gitleaks/gitleaks) (MIT). See `ATTRIBUTION.md`.
|
|
59
|
+
|
|
60
|
+
## What this tool is not
|
|
61
|
+
|
|
62
|
+
- **Not a proof of security.** It finds specific, well-defined classes of
|
|
63
|
+
mistake. A clean run means those classes are absent, not that the app is safe.
|
|
64
|
+
The OWASP coverage matrix in `README.md` is deliberately honest about the
|
|
65
|
+
categories no static scanner can reach.
|
|
66
|
+
- **Not a sandbox.** It reads whatever you point it at. Pointing it at a
|
|
67
|
+
repository you do not trust is as safe as opening that repository in an
|
|
68
|
+
editor — no more, and no less.
|
|
69
|
+
- **Not a secret scanner of record.** Secrets already committed to git history
|
|
70
|
+
are out of scope; ClearToShip reads the working tree, not past commits.
|
package/action.yml
CHANGED
|
@@ -29,7 +29,7 @@ inputs:
|
|
|
29
29
|
version:
|
|
30
30
|
description: >-
|
|
31
31
|
Version of the cleartoship npm package to run. Defaults to the version this
|
|
32
|
-
action's own ref declares, so `uses: …@v0.
|
|
32
|
+
action's own ref declares, so `uses: …@v0.10.0` runs cleartoship@0.10.0. Set
|
|
33
33
|
`latest` to always track the newest release, or `local` to build from the checkout.
|
|
34
34
|
required: false
|
|
35
35
|
default: ''
|
|
@@ -76,7 +76,7 @@ runs:
|
|
|
76
76
|
run: |
|
|
77
77
|
# With no version pinned, run the exact version this action's checkout
|
|
78
78
|
# declares. That keeps the action ref and the scanner in lockstep:
|
|
79
|
-
# `uses: <owner>/cleartoship@v0.
|
|
79
|
+
# `uses: <owner>/cleartoship@v0.10.0` runs cleartoship@0.10.0 instead of
|
|
80
80
|
# whatever npm happens to tag `latest` at the time.
|
|
81
81
|
ver="$INPUT_VERSION"
|
|
82
82
|
if [ -z "$ver" ]; then
|
|
@@ -180,7 +180,7 @@ runs:
|
|
|
180
180
|
|
|
181
181
|
- name: Upload SARIF
|
|
182
182
|
if: ${{ inputs.sarif == 'true' && always() }}
|
|
183
|
-
uses: github/codeql-action/upload-sarif@
|
|
183
|
+
uses: github/codeql-action/upload-sarif@v4
|
|
184
184
|
with:
|
|
185
185
|
sarif_file: ${{ inputs.working-directory }}/results.sarif
|
|
186
186
|
|
package/dist/cli.js
CHANGED
|
@@ -39,6 +39,7 @@ program
|
|
|
39
39
|
.option('-o, --output <file>', 'write the chosen output to a file instead of stdout')
|
|
40
40
|
.option('--offline', 'skip registry lookups (no network)')
|
|
41
41
|
.option('--no-community', 'run only ClearToShip rules, skipping the vendored community ruleset')
|
|
42
|
+
.option('--no-gitignore', 'also scan files your .gitignore excludes')
|
|
42
43
|
.option('--ignore <ids>', 'comma-separated rule ids to skip, e.g. CTS004,CTS022')
|
|
43
44
|
.option('--only <ids>', 'comma-separated rule ids to report exclusively')
|
|
44
45
|
.option('--no-banner', 'suppress the ASCII header')
|
|
@@ -55,6 +56,8 @@ program
|
|
|
55
56
|
root: opts.cwd,
|
|
56
57
|
paths,
|
|
57
58
|
offline: opts.offline,
|
|
59
|
+
// commander maps --no-gitignore to `gitignore: false`.
|
|
60
|
+
noGitignore: opts.gitignore === false,
|
|
58
61
|
noCommunity: opts.community === false,
|
|
59
62
|
ignore: list(opts.ignore),
|
|
60
63
|
only: list(opts.only),
|
package/dist/report.js
CHANGED
|
@@ -117,6 +117,7 @@ export function renderJson(scan) {
|
|
|
117
117
|
root: scan.root,
|
|
118
118
|
framework: scan.framework,
|
|
119
119
|
fileCount: scan.fileCount,
|
|
120
|
+
gitIgnoredCount: scan.gitIgnoredCount,
|
|
120
121
|
durationMs: scan.durationMs,
|
|
121
122
|
verdict: scan.counts.critical > 0 ? 'hold' : scan.counts.high > 0 ? 'conditional' : 'clear',
|
|
122
123
|
counts: scan.counts,
|