cleartoship 0.7.0 → 0.9.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 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.
@@ -0,0 +1,4 @@
1
+ GuardVibe
2
+ Copyright 2026 GokLab
3
+
4
+ Licensed under the Apache License, Version 2.0.
package/README.md CHANGED
@@ -79,7 +79,15 @@ reaches a manifest.
79
79
  | **CTS033** | critical | `'use client'` component reaching for a server-only secret |
80
80
  | **GL-\*** | high/critical | 219 further credential providers, vendored from [gitleaks](https://github.com/gitleaks/gitleaks) (MIT), gated on Shannon entropy |
81
81
 
82
- **Community ruleset** — 436 additional rules vendored from
82
+ **Logging, error-handling & deserialization** — the detectable slices of A08/A09/A10
83
+
84
+ | Rule | Severity | What it catches |
85
+ | --- | --- | --- |
86
+ | **CTS070** | high/medium | Secret, token or PII (or a whole request body) written to a log (A09) |
87
+ | **CTS071** | high/medium | A security check that **fails open** — `catch { return true }` — or swallows its error (A10) |
88
+ | **CTS072** | high | Insecure deserialization of untrusted data — `unserialize`, `pickle.loads`, unsafe `yaml.load` (A08) |
89
+
90
+ **Community ruleset** — 435 additional rules vendored from
83
91
  [GuardVibe](https://github.com/goklab/guardvibe) (Apache-2.0)
84
92
 
85
93
  Reported under their upstream `VG###` ids. These cover ground the AST scanners
@@ -89,12 +97,50 @@ Dockerfiles, Terraform, GitHub Actions pinning, prompt injection and MCP tool
89
97
  runtimes, React Native, Go and shell.
90
98
 
91
99
  27 upstream rules are **superseded** where ClearToShip's own AST check is more
92
- precise, and 5 are **withheld** as measurably noisy both lists carry a reason
93
- per rule in `src/scanners/community.ts`. Run `--no-community` to use only
94
- ClearToShip's rules. See [ATTRIBUTION.md](ATTRIBUTION.md).
100
+ precise, 6 are **withheld** as measurably noisy, and 3 name-heuristic rules are
101
+ **manifest-only** they never run over a `package-lock.json`, where they matched
102
+ ordinary transitive packages (`fast-glob`, `core-js`) and named nothing anyone
103
+ could act on. Each list carries a reason per rule in
104
+ `src/scanners/community.ts`. Run `--no-community` to use only ClearToShip's
105
+ rules. See [ATTRIBUTION.md](ATTRIBUTION.md).
95
106
 
96
107
  Findings map to **OWASP Top 10:2025** and CWE.
97
108
 
109
+ ## OWASP Top 10:2025 coverage — honest version
110
+
111
+ ClearToShip is not an even, "100% coverage" scanner and does not claim to be —
112
+ it is strongest exactly where AI-generated code fails. Coverage by category:
113
+
114
+ | Category | Coverage | What we detect |
115
+ | --- | --- | --- |
116
+ | **A01** Broken Access Control | 🟢 Strong | Missing Server Action / route auth, RLS holes, IDOR, definer bypasses |
117
+ | **A03** Supply Chain Failures | 🟢 Strong | Hallucinated / slopsquat / typosquat packages, live CVEs (OSV), install hooks |
118
+ | **A07** Authentication Failures | 🟢 Strong | `getSession` misuse, weak sessions, JWT (mostly vendored) |
119
+ | **A02** Security Misconfiguration | 🟢 Strong | Docker, Terraform, headers, CORS — via the vendored pack |
120
+ | **A05** Injection | 🟢 Strong | SQLi, XSS, command injection |
121
+ | **A04** Cryptographic Failures | 🟡 Moderate | Hardcoded keys (234 credential patterns), weak hashing |
122
+ | **A09** Logging & Alerting Failures | 🟡 Targeted | **Secrets / PII written to logs** (CTS070) — the statically knowable slice |
123
+ | **A10** Mishandling Exceptions | 🟡 Targeted | **Fail-open / swallowed error on a security check** (CTS071) |
124
+ | **A08** Data & Integrity Failures | 🟡 Targeted | Unverified webhooks (CTS042), **insecure deserialization** (CTS072) |
125
+ | **A06** Insecure Design | 🔴 Not statically detectable | Missing threat modeling is an architecture concern — no static scanner covers it, and we don't pretend to |
126
+
127
+ Two honest points a reviewer would raise, answered up front:
128
+
129
+ - **A06 and A09 are hard for _any_ static tool.** A06 (Insecure Design) is about
130
+ missing threat modeling — you cannot grep for "the developer didn't consider an
131
+ abuse case." A09 (Logging failures) is largely a runtime/ops concern. Semgrep,
132
+ Snyk and CodeQL have the same limits. ClearToShip covers the *detectable slices*
133
+ (secrets in logs, fail-open error handling) and is honest that the rest needs a
134
+ human threat model and runtime observability, not a scanner.
135
+ - **Coverage is uneven on purpose.** The thesis is "the gaps LLM-generated code
136
+ leaves," which cluster in A01/A03/A07/A04 — so that is where the rules cluster.
137
+
138
+ Running with `--no-community` (first-party rules only) covers **8 of 10**
139
+ categories directly (A01, A03, A04, A05, A07, A08, A09, A10); the community pack
140
+ adds A02 and broadens A05/A07.
141
+
142
+
143
+
98
144
  ## Usage
99
145
 
100
146
  ```bash
@@ -123,7 +169,33 @@ room to be written out.
123
169
 
124
170
  ## Continuous integration
125
171
 
126
- ### GitHub Action (recommended)
172
+ ### The CLI (works anywhere, today)
173
+
174
+ One line in any workflow, on any CI. It needs nothing from GitHub beyond npm:
175
+
176
+ ```yaml
177
+ - run: npx cleartoship --fail-on=critical
178
+ ```
179
+
180
+ To feed findings into GitHub's Security tab:
181
+
182
+ ```yaml
183
+ - run: npx cleartoship --sarif -o results.sarif --fail-on=none
184
+ - uses: github/codeql-action/upload-sarif@v3
185
+ with: { sarif_file: results.sarif }
186
+ ```
187
+
188
+ A copyable workflow is in [`examples/security-cli.yml`](examples/security-cli.yml).
189
+
190
+ ### GitHub Action
191
+
192
+ > **Not usable from other repositories yet.** The action lives in *this*
193
+ > repository, which is currently private, so `uses: murtazaozdemir/cleartoship@…`
194
+ > resolves for nobody but its owner — GitHub answers `Unable to resolve action`
195
+ > — and it cannot be listed on the Marketplace. Nothing about it is broken; it
196
+ > simply needs the repository to be public, and it works the day that happens.
197
+ > Until then, use the CLI recipe above. The npm package itself is public and
198
+ > unaffected.
127
199
 
128
200
  Posts a summary comment on every pull request, blocks the merge on critical
129
201
  findings, and optionally uploads to the Security tab. Copy
@@ -140,7 +212,7 @@ jobs:
140
212
  runs-on: ubuntu-latest
141
213
  steps:
142
214
  - uses: actions/checkout@v4
143
- - uses: murtazaozdemir/cleartoship@v0.7.0
215
+ - uses: murtazaozdemir/cleartoship@v0.9.0
144
216
  with:
145
217
  fail-on: critical
146
218
  comment: true
@@ -154,29 +226,22 @@ jobs:
154
226
  | `sarif` | `false` | Upload results to GitHub code scanning |
155
227
  | `offline` | `false` | Skip registry and OSV lookups |
156
228
  | `working-directory` | `.` | Directory to scan from |
229
+ | `version` | *(matches the action ref)* | npm version of the scanner to run; `latest` to always track the newest, `local` to build from the checkout |
157
230
 
158
- Outputs `verdict` (`clear`/`conditional`/`hold`), `critical`, `high` and `total`
159
- for use in later steps. The comment is *sticky* re-runs edit the same comment
160
- instead of piling up. Until the npm package is published, the action builds
161
- itself from its own checkout, so `uses: …@ref` works immediately.
162
-
163
- ### Plain CLI
164
-
165
- ```yaml
166
- - run: npx cleartoship --fail-on=critical
167
- ```
231
+ Outputs `verdict` (`clear`/`conditional`/`hold`), the per-severity counts
232
+ `critical`, `high`, `medium`, `low`, plus `total` and `blocking` (findings at or
233
+ above `fail-on`) for use in later steps. The comment is *sticky* re-runs edit
234
+ the same comment instead of piling up.
168
235
 
169
- To feed findings into GitHub's Security tab without the Action:
170
-
171
- ```yaml
172
- - run: npx cleartoship --sarif -o results.sarif --fail-on=none
173
- - uses: github/codeql-action/upload-sarif@v3
174
- with: { sarif_file: results.sarif }
175
- ```
236
+ By default the action runs the scanner version its own ref declares, so
237
+ `@v0.9.0` runs `cleartoship@0.9.0` and pinning the ref pins the behaviour. If
238
+ that version is not on the registry, it builds from its own checkout instead, so
239
+ `uses: …@ref` works against an unpublished commit.
176
240
 
177
- ## How it works## How it works
241
+ ## How it works
178
242
 
179
- Four scanners, all static nothing is uploaded and no database is contacted.
243
+ Six scanners, all static: your source is read and parsed, never executed, never
244
+ uploaded, and no database is connected to.
180
245
 
181
246
  1. **Server Actions & Route Handlers** — parses TS/TSX with Babel, finds every exported
182
247
  function reachable over HTTP (`'use server'` modules, inline directives, `app/**/route.ts`
@@ -211,6 +276,41 @@ Four scanners, all static — nothing is uploaded and no database is contacted.
211
276
  commented-out line are reported at `low`, never as blocking criticals.
212
277
  - **Precision over recall on the noisy rules.** Typosquat matching skips exact matches and
213
278
  names shorter than five characters, where one-edit neighbours are meaningless.
279
+ - **Auth is followed into the helper it lives in.** Almost no real app repeats the
280
+ session check inside every action — it resolves in `lib/auth.ts`, or in a
281
+ framework helper such as Shopify's `handleSessionToken`, and each action calls
282
+ that. ClearToShip resolves first-party imports (relative paths and `@/`-style
283
+ aliases) and credits a call whose helper authenticates, directly or through
284
+ another helper. Third-party packages are never followed, so a call into
285
+ `node_modules` still proves nothing on its own.
286
+ - **A machine endpoint authenticates differently.** Comparing an `Authorization`
287
+ header against a server-side secret is the auth check for a cron or
288
+ webhook route, and a verified provider signature *is* the caller's identity —
289
+ neither is reported as missing authorization.
290
+
291
+ ## Trust
292
+
293
+ A security tool earns its place by being auditable, so the guarantees are stated
294
+ plainly and each one is checkable in a few seconds. `SECURITY.md` has the full
295
+ version, including how to report a vulnerability.
296
+
297
+ - **Read-only on your code.** The only files ClearToShip writes are the report
298
+ you ask for with `--output` and its 24-hour registry cache under
299
+ `~/.cache/cleartoship`. Nothing under the scan root is ever modified.
300
+ - **Your code is never executed.** No `child_process`, no `eval`, no dynamic
301
+ import of a scanned file. Everything is text, an AST and regexes — which is
302
+ also why it is safe to point at a repository you have not read yet.
303
+ - **No source leaves the machine.** Online, three hosts are contacted and they
304
+ receive package **names and versions** only: `registry.npmjs.org` /
305
+ `api.npmjs.org`, `pypi.org`, `api.osv.dev`. No file contents, no paths, no
306
+ project name. `--offline` disables all three and makes a run a pure local
307
+ computation.
308
+ - **No database connection.** The RLS checks read your migration files. There is
309
+ no database driver in the dependency tree.
310
+ - **Five runtime dependencies.** Three Babel packages, `commander`,
311
+ `picocolors`. The GuardVibe and gitleaks rulesets are vendored into
312
+ `src/vendor/`, not installed, so they are visible in every diff and pinned by
313
+ construction.
214
314
 
215
315
  ## Programmatic use
216
316
 
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 and virtualenvs. 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.