@hardkeel/quantum-scan 0.2.0 → 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 -202
- package/README.md +162 -151
- package/action.yml +44 -44
- package/dist/badge.js +60 -60
- package/dist/cbom.js +59 -59
- package/dist/cli.js +305 -305
- package/dist/community-rules.js +30 -30
- package/dist/community.js +28 -28
- package/dist/ignore.js +75 -75
- package/dist/infra.js +557 -557
- package/dist/map-activity.js +22 -22
- package/dist/map-areas.js +50 -41
- package/dist/map-cloud-keys.js +108 -0
- package/dist/map-host.js +333 -333
- package/dist/map-network.js +518 -0
- package/dist/map-people.js +77 -0
- package/dist/map-rank.js +48 -48
- package/dist/map-report.js +178 -138
- package/dist/map-run.js +271 -205
- package/dist/map-types.js +16 -16
- package/dist/map-web.js +640 -640
- package/dist/pqc.js +32 -32
- package/dist/report.js +179 -179
- package/dist/rules.js +135 -133
- package/dist/sarif.js +43 -43
- package/dist/scan.js +220 -214
- package/dist/score.js +122 -122
- package/dist/secrets.js +108 -97
- package/dist/share-config.js +111 -111
- package/dist/share.js +114 -112
- package/dist/types.js +2 -2
- package/dist/walk.js +63 -63
- package/package.json +53 -52
package/README.md
CHANGED
|
@@ -1,151 +1,162 @@
|
|
|
1
|
-
# Hard Keel Quantum Scan
|
|
2
|
-
|
|
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
|
-
- **
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
#
|
|
111
|
-
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
1
|
+
# Hard Keel Quantum Scan
|
|
2
|
+
|
|
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
CHANGED
|
@@ -1,44 +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
|
|
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
CHANGED
|
@@ -1,60 +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
|
-
}
|
|
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
|
+
}
|