@hardkeel/quantum-scan 0.0.0-stage → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/LICENSE +202 -0
- package/README.md +161 -2
- package/action.yml +44 -0
- package/dist/badge.js +60 -0
- package/dist/cbom.js +59 -0
- package/dist/cli.js +305 -0
- package/dist/community-rules.js +30 -0
- package/dist/community.js +28 -0
- package/dist/ignore.js +75 -0
- package/dist/infra.js +557 -0
- package/dist/map-activity.js +22 -0
- package/dist/map-areas.js +50 -0
- package/dist/map-cloud-keys.js +108 -0
- package/dist/map-host.js +333 -0
- package/dist/map-network.js +518 -0
- package/dist/map-people.js +77 -0
- package/dist/map-rank.js +48 -0
- package/dist/map-report.js +178 -0
- package/dist/map-run.js +271 -0
- package/dist/map-types.js +16 -0
- package/dist/map-web.js +640 -0
- package/dist/pqc.js +32 -0
- package/dist/report.js +179 -0
- package/dist/rules.js +135 -0
- package/dist/sarif.js +43 -0
- package/dist/scan.js +220 -0
- package/dist/score.js +122 -0
- package/dist/secrets.js +108 -0
- package/dist/share-config.js +111 -0
- package/dist/share.js +114 -0
- package/dist/types.js +2 -0
- package/dist/walk.js +63 -0
- package/package.json +51 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
New in `quantum-scan map`:
|
|
6
|
+
|
|
7
|
+
- **Network and connected equipment.** Looks at routers, switches, printers, cameras, storage boxes and smart devices on your own private network: about 30 common ports, the title of any web page they serve, the certificate on secure admin pages, and the router's list of automatic port forwards (UPnP). Flags Telnet and plain FTP, open remote desktop, VNC and remote support tools, devices still on their setup page, admin pages without encryption or with the factory certificate, open print ports, camera and recorder ports, unencrypted MQTT, open databases, the Docker API, and router forwards from the internet. It never logs in, tries a password or changes a setting.
|
|
8
|
+
- **Who can read your cloud data.** Notes cloud storage, databases, disks and backups in Terraform and CloudFormation whose encryption keys the provider holds, and how to keep the keys yourself. Advice only; it doesn't change the score.
|
|
9
|
+
- **People and process.** 18 optional yes/no questions about what no scan can see, from phishing training and call-back checks to backups and a breach plan. Scored on their own, kept on your machine and never shared.
|
|
10
|
+
|
|
11
|
+
Code scan:
|
|
12
|
+
|
|
13
|
+
- Finds Go TLS settings that list curves without the hybrid ML-KEM group, which turns off Go's post-quantum key exchange.
|
|
14
|
+
- Far fewer false leaked-key alarms. Translated "password" labels, editor token names, keys and fake tokens in test code, CI databases on localhost, `.env.example` files, API spec examples, secret-store references and public client keys no longer count, so they no longer pull the grade down. Real token formats and private keys in shipped code still do.
|
|
15
|
+
|
|
16
|
+
## 0.2.0
|
|
17
|
+
|
|
18
|
+
First public release: code and infrastructure config scan, encryption inventory (CycloneDX CBOM), SARIF, migration report, readiness score and badge, and `quantum-scan map` for code, websites and this machine, with one readiness grade across areas, accepted leftovers in `.quantum-scan-ignore`, a public resolver fallback for the ownership record, and an HTML report that reads in light and dark mode and prints cleanly.
|
package/LICENSE
ADDED
|
@@ -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.
|
package/README.md
CHANGED
|
@@ -1,3 +1,162 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Hard Keel Quantum Scan
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Finds encryption that quantum computers will break, weak encryption, exposed infrastructure settings, and leaked keys or passwords in your code and infrastructure config. Writes an encryption inventory and a plan for moving to quantum-safe methods.
|
|
4
|
+
|
|
5
|
+
Free and open source under the Apache 2.0 licence. No account and no dependencies. Your code and results stay on your machine; see [Anonymized sharing](#anonymized-sharing) for the one small summary it sends, and how to turn it off.
|
|
6
|
+
|
|
7
|
+
## Run it
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npx @hardkeel/quantum-scan
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Scans the current folder and prints what to fix now and what to plan for:
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
Hard Keel Quantum Scan · 4 files scanned
|
|
17
|
+
|
|
18
|
+
Quantum readiness: C (75/100, Hard Keel method v1). Weak encryption or exposed settings hold the grade at C or lower until they are fixed.
|
|
19
|
+
|
|
20
|
+
Found 2 uses of weak encryption and 1 use of encryption quantum computers will break.
|
|
21
|
+
|
|
22
|
+
Fix now
|
|
23
|
+
payments.py:6 RSA-1024 key
|
|
24
|
+
Use 3072-bit keys or larger now, then plan the move to post-quantum methods.
|
|
25
|
+
payments.py:10 ECB mode
|
|
26
|
+
Switch to AES-256-GCM.
|
|
27
|
+
|
|
28
|
+
Plan for later
|
|
29
|
+
Safe today, but quantum computers will be able to break these. NIST plans to phase them out between 2030 and 2035.
|
|
30
|
+
auth.ts:6 ECDH key exchange
|
|
31
|
+
Move key exchange to ML-KEM (FIPS 203), or hybrid X25519 + ML-KEM-768 for TLS.
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Options
|
|
35
|
+
|
|
36
|
+
| Option | What it does |
|
|
37
|
+
| --- | --- |
|
|
38
|
+
| `--cbom <file>` | Write the encryption inventory as a CycloneDX 1.6 CBOM |
|
|
39
|
+
| `--report <file>` | Write the migration report, in the order to fix things |
|
|
40
|
+
| `--badge <file>` | Write a quantum readiness badge (SVG) to put on your README |
|
|
41
|
+
| `--format text\|json\|sarif` | What to print. SARIF works with GitHub code scanning |
|
|
42
|
+
| `--output <file>` | Write that output to a file |
|
|
43
|
+
| `--fail-on <list>` | Exit with 1 on `secret`, `weak-now`, `exposed`, `quantum-vulnerable`, or `none`. Default `secret,weak-now,exposed` |
|
|
44
|
+
| `--quiet` | Leave out the closing line about installing on GitHub |
|
|
45
|
+
| `--offline` | Send nothing to Hard Keel |
|
|
46
|
+
|
|
47
|
+
## Quantum readiness score
|
|
48
|
+
|
|
49
|
+
Every scan ends with a grade from A+ to F and a score out of 100. The method is open and versioned: [how the score works](https://hardkeel.com/learn/quantum-readiness-score/).
|
|
50
|
+
|
|
51
|
+
- **A+:** nothing to fix, and post-quantum encryption (ML-KEM, ML-DSA, SLH-DSA) is already in use.
|
|
52
|
+
- **A:** nothing to fix now, or only signatures left to move before 2035.
|
|
53
|
+
- **B:** key exchange that quantum computers will break, due to move by 2030.
|
|
54
|
+
- **C or lower:** weak encryption or exposed settings to fix now. A leaked key or password holds the grade at D or lower.
|
|
55
|
+
|
|
56
|
+
Put the grade on your README with `--badge quantum-readiness.svg`, or install Hard Keel Quantum Scan on GitHub to keep a live badge current for public repositories.
|
|
57
|
+
|
|
58
|
+
## What it looks for
|
|
59
|
+
|
|
60
|
+
- **Encryption quantum computers will break:** RSA, elliptic-curve (ECDSA, ECDH, Ed25519, X25519) and Diffie-Hellman.
|
|
61
|
+
- **Weak encryption:** MD5, SHA-1, DES, 3DES, RC4, ECB mode, DSA, RSA under 2048 bits, TLS 1.0 and 1.1.
|
|
62
|
+
- **Exposed infrastructure settings:** storage or databases open to the public, admin and database ports open to the whole internet, encryption at rest turned off, unencrypted traffic allowed, and certificate checks turned off.
|
|
63
|
+
- **Weak TLS in config:** old TLS versions and weak cipher suites in nginx, Apache, HAProxy, load balancer and CDN settings.
|
|
64
|
+
- **Leaked keys and passwords:** private keys, cloud and API tokens, passwords in connection strings, Terraform, CloudFormation, Dockerfiles and Kubernetes Secrets. They are masked in all output.
|
|
65
|
+
|
|
66
|
+
It reads Python, JavaScript and TypeScript, Go, Java, plus Rust, C#, PHP, Ruby, Swift and C or C++ with OpenSSL through community rules, and Terraform and OpenTofu, CloudFormation, Kubernetes manifests, Dockerfiles, and nginx, Apache and HAProxy configs. A plain scan looks at files only. To check live websites and this machine too, use `quantum-scan map`.
|
|
67
|
+
|
|
68
|
+
## Encryption map
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
npx @hardkeel/quantum-scan map
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Checks more than code, one area at a time, and asks before each one. For every area it says what it will touch, what it reads and what it never does. The answer is no unless you type yes.
|
|
75
|
+
|
|
76
|
+
- **Code and config:** the same checks as a plain scan.
|
|
77
|
+
- **Websites and public services:** the encryption your sites, APIs and SSH servers offer, from about six normal connections each, a quarter second apart. It never logs in or sends attack traffic. It checks only domains you've proved are yours, with one DNS record that covers the domain and everything under it:
|
|
78
|
+
|
|
79
|
+
```sh
|
|
80
|
+
npx @hardkeel/quantum-scan prove example.com
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
- **Network and connected equipment:** routers, switches, printers, cameras, storage boxes and smart devices on your own network. For each address it checks whether about 30 common ports answer, reads the title of any web page they serve and the certificate on secure admin pages, and reads the router's list of automatic port forwards (UPnP) if it publishes one. It flags Telnet and plain FTP, open remote desktop, VNC and remote support tools, devices still on their setup page, admin pages without encryption or with the factory certificate, open print ports, camera and recorder ports, unencrypted MQTT, open databases and Docker, and router forwards from the internet. It never logs in, tries a password, sends commands to equipment or changes a setting. Only private address ranges this computer is on (or other segments of your own network that you confirm), at most 1,024 addresses, one connection at a time per device. List fragile equipment, like older industrial or medical controllers, under `exclude` and it's never touched:
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
"network": { "ranges": ["192.168.1.0/24"], "routed": ["192.168.20.0/24"], "exclude": ["192.168.1.250"] }
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
- **This machine:** SSH server settings and host keys, OpenSSL settings, certificates on disk, and on Windows the TLS settings and machine certificate store. Read only. It changes nothing and never reads private key files.
|
|
90
|
+
|
|
91
|
+
Two more parts of the report aren't scans:
|
|
92
|
+
|
|
93
|
+
- **Who can read your cloud data:** where your Terraform or CloudFormation stores data in cloud storage, databases, disks or backups with keys the provider holds, or with your key in the provider's key service. Those keys protect against a stolen disk, not against the provider, someone working there, or a legal demand made to them. For data no third party should be able to read, it recommends encrypting before upload or keeping the keys in an external key store you hold. Listed as advice, not scored.
|
|
94
|
+
- **People and process:** 18 optional yes/no questions about what no scan can see: phishing and social-engineering training, call-back checks on payment and password requests, multi-factor sign-in, admin accounts, leavers, vendor access, default passwords, firmware, printer job storage, guest and payment network separation, containment, sandboxing, cloud keys, backups, a breach plan and logs. Your answers get their own score next to the technical findings. They're saved in `quantum-scan-map/people.json`, kept out of the scope file, and never sent anywhere.
|
|
95
|
+
|
|
96
|
+
Results get the same readiness grade as a code scan, and are ranked by when to act: broken now, at risk from data recorded now and read later, long-lived signatures, then the rest. The map is written to `quantum-scan-map/` as `map.html`, `map.json`, a CycloneDX CBOM and `activity.log`, which lists every connection and every file read, with the time and the reason. Nothing leaves your machine except the summary below.
|
|
97
|
+
|
|
98
|
+
For pipelines, save your answers to `quantum-scan.scope.json` when asked, then run `quantum-scan map --scope quantum-scan.scope.json`. It checks only what the file lists. Add `--fail-on broken` to fail the build when anything is broken now.
|
|
99
|
+
|
|
100
|
+
## Leaving out findings you've reviewed
|
|
101
|
+
|
|
102
|
+
Add a `.quantum-scan-ignore` file to the scanned folder:
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
# a check everywhere
|
|
106
|
+
rule:py-weak-hash
|
|
107
|
+
# a folder or a file
|
|
108
|
+
legacy/
|
|
109
|
+
tools/migrate.py
|
|
110
|
+
# one check in one file
|
|
111
|
+
src/hash.py:py-weak-hash
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
A leaked key or password can only be left out by naming its file, never by check alone.
|
|
115
|
+
|
|
116
|
+
For `quantum-scan map`, the same file in the folder you run it from can accept a known leftover on a website or this machine, for example a setting your host won't let you change:
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
# one check on one site
|
|
120
|
+
example.com:443:web-tls-static-rsa
|
|
121
|
+
# everything on one site, any port
|
|
122
|
+
legacy.example.com
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Accepted items still appear in the report, in their own section, but don't count toward the score.
|
|
126
|
+
|
|
127
|
+
## Anonymized sharing
|
|
128
|
+
|
|
129
|
+
We collect anonymized, aggregated information about how our checks perform and what kinds of encryption they find. It never includes your code, keys, server names, IP addresses or company name. We use it to improve and build our products and to understand encryption trends across the industry. You can turn this off at any time, or run fully offline.
|
|
130
|
+
|
|
131
|
+
Each run sends one small summary: which checks fired and how often (rounded to bands like 2-5), which encryption types were found, which errors happened, the tool version, operating system and a random ID that is linked to nothing. Industry and company size are optional, and asked once. Details: [hardkeel.com/privacy](https://hardkeel.com/privacy/).
|
|
132
|
+
|
|
133
|
+
| Command | What it does |
|
|
134
|
+
| --- | --- |
|
|
135
|
+
| `quantum-scan config show-shared` | Shows exactly what the last run sent, or would have sent |
|
|
136
|
+
| `quantum-scan config sharing off` | Turns sharing off (or set `QUANTUM_SCAN_SHARING=off`) |
|
|
137
|
+
| `--offline` | Sends nothing at all (or set `QUANTUM_SCAN_OFFLINE=1`, or `quantum-scan config offline on`) |
|
|
138
|
+
|
|
139
|
+
`DO_NOT_TRACK=1` is respected too.
|
|
140
|
+
|
|
141
|
+
## In GitHub Actions
|
|
142
|
+
|
|
143
|
+
```yaml
|
|
144
|
+
- uses: actions/checkout@v4
|
|
145
|
+
- uses: Hard-Keel/quantum-scan-cli@v0
|
|
146
|
+
- uses: github/codeql-action/upload-sarif@v3
|
|
147
|
+
if: always()
|
|
148
|
+
with:
|
|
149
|
+
sarif_file: quantum-scan.sarif
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
The migration report goes to the job summary. Code scanning results need a public repository or GitHub Advanced Security. To send nothing from your pipeline, set `QUANTUM_SCAN_SHARING: off` in the job's `env`.
|
|
153
|
+
|
|
154
|
+
## Contributing rules
|
|
155
|
+
|
|
156
|
+
Detection rules for new languages and libraries are plain JSON files in [`rules/community/`](rules/community), each with examples it must and must not match. See [rules/README.md](rules/README.md) and [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
157
|
+
|
|
158
|
+
## On every pull request
|
|
159
|
+
|
|
160
|
+
[Install Hard Keel Quantum Scan on GitHub](https://github.com/apps/hard-keel-quantum-scan) to run the same checks on every pull request with nothing to set up. It comments on the pull request, posts a check result, and keeps a report link for each repository that stays current.
|
|
161
|
+
|
|
162
|
+
Built by [Hard Keel](https://hardkeel.com). Questions: contact@hardkeel.com. Security reports: security@hardkeel.com.
|
package/action.yml
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
name: Hard Keel Quantum Scan
|
|
2
|
+
description: Find encryption quantum computers will break, weak encryption, exposed infrastructure settings and leaked keys, and write an encryption inventory.
|
|
3
|
+
author: Hard Keel
|
|
4
|
+
branding:
|
|
5
|
+
icon: shield
|
|
6
|
+
color: gray-dark
|
|
7
|
+
inputs:
|
|
8
|
+
path:
|
|
9
|
+
description: Folder to scan
|
|
10
|
+
default: "."
|
|
11
|
+
fail-on:
|
|
12
|
+
description: "Fail the step on these: secret, weak-now, exposed, quantum-vulnerable, or none"
|
|
13
|
+
default: "secret,weak-now,exposed"
|
|
14
|
+
sarif:
|
|
15
|
+
description: Where to write SARIF results, for GitHub code scanning
|
|
16
|
+
default: quantum-scan.sarif
|
|
17
|
+
cbom:
|
|
18
|
+
description: Where to write the encryption inventory (CycloneDX 1.6 CBOM)
|
|
19
|
+
default: quantum-scan.cbom.json
|
|
20
|
+
report:
|
|
21
|
+
description: Where to write the migration report (Markdown)
|
|
22
|
+
default: quantum-scan-report.md
|
|
23
|
+
outputs:
|
|
24
|
+
sarif:
|
|
25
|
+
description: Path of the SARIF file
|
|
26
|
+
value: ${{ inputs.sarif }}
|
|
27
|
+
runs:
|
|
28
|
+
using: composite
|
|
29
|
+
steps:
|
|
30
|
+
- shell: bash
|
|
31
|
+
env:
|
|
32
|
+
QS: ${{ github.action_path }}/dist/cli.js
|
|
33
|
+
IN_PATH: ${{ inputs.path }}
|
|
34
|
+
IN_FAIL: ${{ inputs.fail-on }}
|
|
35
|
+
IN_SARIF: ${{ inputs.sarif }}
|
|
36
|
+
IN_CBOM: ${{ inputs.cbom }}
|
|
37
|
+
IN_REPORT: ${{ inputs.report }}
|
|
38
|
+
REPO: ${{ github.repository }}
|
|
39
|
+
run: |
|
|
40
|
+
node "$QS" "$IN_PATH" --name "$REPO" --format sarif --output "$IN_SARIF" --fail-on none
|
|
41
|
+
status=0
|
|
42
|
+
node "$QS" "$IN_PATH" --name "$REPO" --cbom "$IN_CBOM" --report "$IN_REPORT" --fail-on "$IN_FAIL" || status=$?
|
|
43
|
+
cat "$IN_REPORT" >> "$GITHUB_STEP_SUMMARY"
|
|
44
|
+
exit $status
|
package/dist/badge.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// README badge for the quantum readiness score, in the familiar flat badge style.
|
|
2
|
+
// Self-contained SVG: no fonts, scripts or outside requests.
|
|
3
|
+
export const BADGE_LABEL = "quantum readiness";
|
|
4
|
+
const LABEL_BG = "#0b1726"; // Hard Keel navy
|
|
5
|
+
export const GRADE_COLOR = {
|
|
6
|
+
"A+": "#2e9e6a",
|
|
7
|
+
A: "#44cc11",
|
|
8
|
+
B: "#97ca00",
|
|
9
|
+
C: "#dfb317",
|
|
10
|
+
D: "#fe7d37",
|
|
11
|
+
F: "#e05d44",
|
|
12
|
+
none: "#9f9f9f",
|
|
13
|
+
};
|
|
14
|
+
// Rough Verdana 11px advance widths, enough to size the badge without loading a font.
|
|
15
|
+
function textWidth(s) {
|
|
16
|
+
let w = 0;
|
|
17
|
+
for (const ch of s) {
|
|
18
|
+
if ("iljI.,:;|!'".includes(ch))
|
|
19
|
+
w += 3.5;
|
|
20
|
+
else if ("ftr( )".includes(ch))
|
|
21
|
+
w += ch === " " ? 3.9 : 4.6;
|
|
22
|
+
else if ("mwMW".includes(ch))
|
|
23
|
+
w += 10.5;
|
|
24
|
+
else if (/[A-Z+]/.test(ch))
|
|
25
|
+
w += 7.6;
|
|
26
|
+
else if (/[0-9]/.test(ch))
|
|
27
|
+
w += 7;
|
|
28
|
+
else if (ch === "·")
|
|
29
|
+
w += 4.5;
|
|
30
|
+
else
|
|
31
|
+
w += 6.6;
|
|
32
|
+
}
|
|
33
|
+
return w;
|
|
34
|
+
}
|
|
35
|
+
function esc(s) {
|
|
36
|
+
return s.replace(/[&<>"']/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[c]);
|
|
37
|
+
}
|
|
38
|
+
export function badgeMessage(s) {
|
|
39
|
+
return s ? `${s.grade} · ${s.score}` : "not scanned";
|
|
40
|
+
}
|
|
41
|
+
export function badgeSvg(s, label = BADGE_LABEL) {
|
|
42
|
+
const message = badgeMessage(s);
|
|
43
|
+
const color = s ? GRADE_COLOR[s.grade] : GRADE_COLOR.none;
|
|
44
|
+
const lw = Math.round(textWidth(label) + 12);
|
|
45
|
+
const mw = Math.round(textWidth(message) + 12);
|
|
46
|
+
const w = lw + mw;
|
|
47
|
+
const lx = lw / 2;
|
|
48
|
+
const mx = lw + mw / 2;
|
|
49
|
+
const title = `${label}: ${message}`;
|
|
50
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="${w}" height="20" role="img" aria-label="${esc(title)}"><title>${esc(title)}</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="${w}" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="${lw}" height="20" fill="${LABEL_BG}"/><rect x="${lw}" width="${mw}" height="20" fill="${color}"/><rect width="${w}" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="11"><text x="${lx}" y="15" fill="#010101" fill-opacity=".3">${esc(label)}</text><text x="${lx}" y="14">${esc(label)}</text><text x="${mx}" y="15" fill="#010101" fill-opacity=".3">${esc(message)}</text><text x="${mx}" y="14">${esc(message)}</text></g></svg>`;
|
|
51
|
+
}
|
|
52
|
+
/** The shields.io "endpoint" format, for people who prefer to style the badge themselves. */
|
|
53
|
+
export function shieldsEndpoint(s) {
|
|
54
|
+
return { schemaVersion: 1, label: BADGE_LABEL, message: badgeMessage(s), color: s ? GRADE_COLOR[s.grade].slice(1) : "9f9f9f" };
|
|
55
|
+
}
|
|
56
|
+
export const METHOD_URL = "https://hardkeel.com/learn/quantum-readiness-score/";
|
|
57
|
+
/** Markdown a repository owner pastes into their README. */
|
|
58
|
+
export function badgeMarkdown(badgeUrl) {
|
|
59
|
+
return `[](${METHOD_URL})`;
|
|
60
|
+
}
|
package/dist/cbom.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// CycloneDX 1.6 Cryptographic Bill of Materials (CBOM) from crypto findings.
|
|
2
|
+
const CDX_PRIMITIVE = {
|
|
3
|
+
"key-agreement": "key-agree",
|
|
4
|
+
"public-key-encryption": "pke",
|
|
5
|
+
signature: "signature",
|
|
6
|
+
hash: "hash",
|
|
7
|
+
"block-cipher": "block-cipher",
|
|
8
|
+
"stream-cipher": "stream-cipher",
|
|
9
|
+
protocol: "other",
|
|
10
|
+
credential: "other",
|
|
11
|
+
setting: "other",
|
|
12
|
+
};
|
|
13
|
+
export function buildCbom(findings, opts) {
|
|
14
|
+
const crypto = findings.filter((f) => f.kind === "crypto");
|
|
15
|
+
const byAlg = new Map();
|
|
16
|
+
for (const f of crypto) {
|
|
17
|
+
const key = f.keySize ? `${f.algorithm}-${f.keySize}` : f.algorithm;
|
|
18
|
+
byAlg.set(key, [...(byAlg.get(key) ?? []), f]);
|
|
19
|
+
}
|
|
20
|
+
const components = [...byAlg.entries()].map(([name, fs]) => {
|
|
21
|
+
const first = fs[0];
|
|
22
|
+
const isProtocol = first.primitive === "protocol";
|
|
23
|
+
const cryptoProperties = isProtocol
|
|
24
|
+
? { assetType: "protocol", protocolProperties: { type: "tls", version: "1.0/1.1" } }
|
|
25
|
+
: {
|
|
26
|
+
assetType: "algorithm",
|
|
27
|
+
algorithmProperties: {
|
|
28
|
+
primitive: CDX_PRIMITIVE[first.primitive],
|
|
29
|
+
// 0 = no security against a quantum attacker (NIST category scale).
|
|
30
|
+
nistQuantumSecurityLevel: 0,
|
|
31
|
+
...(first.keySize ? { parameterSetIdentifier: String(first.keySize) } : {}),
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
return {
|
|
35
|
+
type: "cryptographic-asset",
|
|
36
|
+
"bom-ref": `crypto:${name.toLowerCase().replace(/[^a-z0-9]+/g, "-")}`,
|
|
37
|
+
name,
|
|
38
|
+
cryptoProperties,
|
|
39
|
+
properties: [
|
|
40
|
+
{ name: "hardkeel:risk", value: first.risk },
|
|
41
|
+
{ name: "hardkeel:occurrences", value: String(fs.length) },
|
|
42
|
+
],
|
|
43
|
+
evidence: {
|
|
44
|
+
occurrences: fs.map((f) => ({ location: f.file, line: f.line })),
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
return {
|
|
49
|
+
bomFormat: "CycloneDX",
|
|
50
|
+
specVersion: "1.6",
|
|
51
|
+
version: 1,
|
|
52
|
+
metadata: {
|
|
53
|
+
timestamp: opts.timestamp ?? new Date().toISOString(),
|
|
54
|
+
tools: { components: [{ type: "application", name: "Hard Keel Quantum Scan", version: opts.toolVersion }] },
|
|
55
|
+
component: { type: "application", name: opts.repo, ...(opts.ref ? { version: opts.ref } : {}) },
|
|
56
|
+
},
|
|
57
|
+
components,
|
|
58
|
+
};
|
|
59
|
+
}
|