Skip to content
qshiftlabsPublic

About

Post-quantum readiness scanner: finds quantum-vulnerable and weak crypto in code, keys, dependencies and live TLS/SSH servers

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

qshift

PQC readiness

Post-quantum readiness scanner by QShift Labs. qshift finds quantum-vulnerable and weak cryptography in your code, shows what to replace it with, and grades it against CNSA 2.0.

Early development. Today it scans Python (cryptography, PyCryptodome, hashlib, PyNaCl, Tink), JavaScript/TypeScript (node:crypto, Web Crypto, crypto-js), Java/Kotlin (JCA, Bouncy Castle, Tink, bitcoinj, web3j, Sparrow drongo), Go (standard library, golang.org/x/crypto, Cloudflare CIRCL, Tink, go-ethereum crypto, btcec, BLS12-381, libp2p keys), C# (System.Security.Cryptography, NBitcoin, Nethereum), C/C++ (OpenSSL, wolfSSL, Mbed TLS, libsodium, Libgcrypt, GLib checksums, Windows CNG, liboqs, mlkem-native, Crypto++, Botan), Rust (RustCrypto, ring, aws-lc-rs, rustls, openssl, native-tls, jsonwebtoken, oqs, pqcrypto, secp256k1), PHP (openssl, phpseclib, sodium, curl and stream TLS, php-jwt, lcobucci/jwt), Ruby (OpenSSL, Digest, RbNaCl, ed25519, jwt) and Swift (CryptoKit, swift-crypto, Security, CommonCrypto, CryptoSwift, Swift-Sodium, URLSession and Network TLS, JWTKit) source code, server config files (nginx, Apache, HAProxy, Caddy, OpenSSH, OpenSSL, Postfix, Dovecot), dependency manifests and lock files, certificate and key files, and live TLS and SSH servers, and writes text, JSON, SARIF 2.1.0, a CycloneDX 1.6/1.7 CBOM and a self-contained HTML report.

Usage

qshift scan [path]                 # scan a folder (default .): source code, server configs, dependencies, certificate and key files
  --format text|json|sarif|cbom|markdown # stdout format
  --json out.json --sarif out.sarif --cbom cbom.json
  --markdown summary.md --link-base URL # short summary for CI, file places linked to URL + path
  --cbom-version 1.6|1.7           # CycloneDX version of the CBOM (default 1.6); 1.7 adds algorithmFamily and ellipticCurve
  --html report.html --title "Name" # one-file report to send to a customer or auditor (prints to PDF)
  --profile cnsa2|nist|eu          # grading profile (default cnsa2)
  --fail-on critical|high|medium   # exit 1 for CI
  --write-baseline FILE            # record today's findings (commit the file)
  --baseline FILE                  # findings in FILE do not count for --fail-on: CI fails only on new ones
  --rules ./my-rules               # extra YAML rules
  --no-gitignore                   # also scan what .gitignore excludes (build output, bundles, caches)
  --staged                         # only the files staged for the next commit (git), for a pre-commit hook
  --tests                          # also scan test and example code (the folders and files below); its findings are shown, marked "test or example code", but not graded
  --no-default-ignores             # also scan test and fixture folders and files (*_test.go, test_*.py, *.spec.ts, folders whose name starts with test or ends in tests, -test or _test, regress, examples, samples, bundled release copies such as curl-8.23.0, ...), vendor, third_party, node_modules
  --no-dependencies                # skip dependency manifests and lock files
  --no-snippets                    # leave the lines of code out of every report and upload
  --config file.yml | --no-config  # default: .qshift.yml or .qshift.yaml in the scanned folder
qshift probe TARGET...             # live servers: host[:port] or tls://host:port (TLS, 443), ssh://host[:port],
                                   # mail through STARTTLS: smtp://, imap://, pop3://host[:port] (also host:25, :587, :143, :110)
  --timeout 8s --sni name          # plus the output, --profile and --fail-on flags of scan
  --nmap scan.xml                  # also every open TLS, mail and SSH port of an nmap scan (nmap -sV -oX scan.xml ...)
qshift explain RULE-ID             # what a finding means and how to fix it
qshift diff OLD.json NEW.json      # what is new, what is fixed, better or worse (--fail-on LEVEL for new findings)
qshift rules list [--language python]
qshift serve --listen 127.0.0.1:8080 # plain HTTP service the website's free server check calls; put TLS in front of it
  --ports 443,8443,22 --max 4      # needs QSHIFT_PROBE_TOKEN; GET /v1/probe?target=HOST&profile=cnsa2
  --timeout 6s --allow-private     # per connection; --allow-private also checks private addresses (test servers only)
  --operator URL --contact MAIL    # shown on the info page at /, for owners who see the checker in their logs
                                   # header X-Qshift-Deny: addresses and ranges (comma separated) the request must not reach, refused after DNS
qshift verify FILE|URL [--key file] [--offline] # check a signed statement from qshiftlabs.com (see Signed statements)
qshift verify checksums.txt.sig    # check a release download (see Install)
qshift version

Exit codes: 0 no finding at or above --fail-on, 1 findings at or above it, 2 error.

Upload results to qshiftlabs.com

The dashboard on qshiftlabs.com keeps the grade and findings of every scan over time. To send a result from your own machine or any CI:

  1. Sign in, open Settings in the dashboard and create an upload key (qsk_...). It is shown once; keep it in a secret or an environment variable, here QSHIFT_KEY.
  2. Scan and upload the JSON result:
qshift scan . --format json > qshift.json
curl -fsS -H "Authorization: Bearer $QSHIFT_KEY" -H "Content-Type: application/json" --data-binary @qshift.json "https://qshiftlabs.com/api/v1/scans?repo=OWNER/NAME&commit=$(git rev-parse HEAD)"

Query parameters: repo (required: letters, digits, ., _, - and /, up to 120 characters, for example OWNER/NAME), commit and branch (both optional, shown on the dashboard). The answer is JSON with the grade, the finding counts and a check code. Add --no-snippets to the scan to send no lines of code (see Keeping code off the website). The website grades the result again itself.

action/upload.sh does the same with the key kept off the command line: QSHIFT_UPLOAD_KEY=... QSHIFT_UPLOAD_URL=https://qshiftlabs.com/api/v1/scans QSHIFT_JSON=qshift.json bash action/upload.sh. It takes the repository from QSHIFT_REPO, else GITHUB_REPOSITORY, else the origin remote of the scanned folder (QSHIFT_DIR, default .), the commit from QSHIFT_COMMIT, else GITHUB_SHA, else git rev-parse HEAD, and the branch from QSHIFT_BRANCH, else the GitHub variables, else the checked out branch. Without a repository name it stops instead of uploading.

A result uploaded this way is self-reported: the website only sees the JSON it receives. For a verified result, use the reusable workflow in Verified scans.

Install

Download the archive for your system from the releases page, check it against checksums.txt, and put qshift on your PATH:

curl -fsSLO https://github.com/qshiftlabs/qshift/releases/latest/download/qshift_linux_amd64.tar.gz
curl -fsSLO https://github.com/qshiftlabs/qshift/releases/latest/download/checksums.txt
sha256sum --ignore-missing -c checksums.txt
tar -xzf qshift_linux_amd64.tar.gz qshift

Archives: linux, darwin (macOS) and windows (zip), each amd64 and arm64. With Go 1.27 or newer: go install github.com/qshiftlabs/qshift/cmd/qshift@latest.

checksums.txt only shows that the download is the file the release page lists. checksums.txt.sig is checksums.txt signed with the QShift Labs ML-DSA-87 key (the same key as the signed statements), so it also shows that QShift Labs built the release. A qshift you already have checks a new download with it, archives in the same folder:

curl -fsSLO https://github.com/qshiftlabs/qshift/releases/latest/download/checksums.txt.sig
qshift verify checksums.txt.sig

It prints the release the signature names (from v0.2.0 on, checksums.txt lists qshift_vX.Y.Z.txt) and warns when that release is older than the qshift you run, so an old signed release passed off as the latest stands out. Exit code 0 = signature valid and every download found matches, 1 = signature valid but no download found next to it, 2 = not valid or a download does not match.

GitHub Action

name: qshift
on: [push, pull_request]
permissions:
  contents: read
  security-events: write   # for code scanning
jobs:
  scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
      - uses: qshiftlabs/qshift@v0.2.15
        with:
          fail-on: high          # fail on weak crypto; critical also fails on RSA/ECC

The action installs the release that matches its tag (used by a branch or commit, the release named in action/VERSION of that commit), checks the download against the checksums.txt of the same release, scans the repository, writes the grade and findings to the job summary, sends the SARIF to GitHub code scanning, and keeps the JSON, SARIF, CBOM and HTML report as a workflow artifact. The checksum catches a broken download, not a changed release: the action does not check checksums.txt.sig. To pin the exact files, pin the action by commit SHA and set version to a release you checked with qshift verify. A failing fail-on check fails the job only after all of that is done; a failed upload to qshiftlabs.com also fails the job.

The artifact is named qshift-reports-JOB-HASH and the code scanning category qshift-JOB-HASH (the job id and a short hash of path, servers and the runner), so several runs in one workflow keep their own; set artifact-name and sarif-category to choose them, for example in a matrix that scans the same folder twice.

Input Default
path . folder to scan
servers live servers to check instead of path, separated by spaces or new lines (host[:port], tls://, ssh://, smtp://, imap://, pop3://)
profile cnsa2 (or the config file) or nist
fail-on critical, high or medium
upload-sarif true code scanning; private repositories need GitHub Advanced Security, the step only warns without it
reports true keep the reports as an artifact
summary true job summary
title repository name name on the HTML report
config .qshift.yml in path config file, relative to the workspace
snippets config file, else true false leaves the lines of code out of the reports, code scanning and the upload
args more flags, e.g. --rules .qshift/rules
artifact-name qshift-reports-JOB-HASH name of the reports artifact
sarif-category qshift-JOB-HASH code scanning category
version the action's tag, else action/VERSION a release tag, latest, or source to build the action's commit with Go
upload-key qsk_... key of your qshiftlabs.com workspace, from a secret; sends the JSON result there
upload-url https://qshiftlabs.com/api/v1/scans upload address of the qshift website

Outputs: grade, critical, high, medium, reports-dir.

Keeping code off the website

Uploaded results normally carry the line of code each finding is in, so the dashboard can show it. To send no code at all, scan with --no-snippets (Action input snippets: false, or snippets: false in .qshift.yml): findings keep the rule, file, line and fix, and live server findings keep the server's answer, which is not code. A workspace can also turn code lines off under Settings > Code lines: the website then drops them from every upload and deletes the ones it already holds.

Verified scans

A result uploaded with the Action above, or from any other place, is self-reported: the website only sees the JSON it receives, and the owner could have changed it. For a verified result, call the reusable workflow from your own workflow instead:

jobs:
  qshift:
    permissions:
      contents: read
      id-token: write
    uses: qshiftlabs/qshift/.github/workflows/verified-scan.yml@v0.2.15
    secrets:
      upload-key: ${{ secrets.QSHIFT_KEY }}

GitHub runs it as a job of its own on a GitHub-hosted machine: only its steps run there, it installs the qshift release of the same tag, scans the commit and uploads the result with GitHub's signed token for that job. The website checks the token (issuer, audience, expiry, GitHub's signature), that it names this workflow called by a release tag, a GitHub-hosted machine and a push, manual or scheduled run on a branch, and that it was not used before. Repository, commit and branch then come from the token. Your code never leaves GitHub. The grade is the same either way; the badge, the verify page and the signed statement say verified or self-reported. Inputs: profile, snippets (default false), site.

Signed statements

Every result uploaded to qshiftlabs.com is signed: a JSON statement with the repository, commit, date, profile, grade and finding counts, in a DSSE envelope signed with ML-DSA-87 (FIPS 204). It is valid for 90 days from the scan. Turn the badge on and it links to a public verify page with the grade, the earlier scans and the statement; without the badge, the owner downloads the statement from the repository page and sends it to whoever asks.

Anyone can check one without trusting the website:

qshift verify https://qshiftlabs.com/v/WORKSPACE/OWNER/REPO.json
qshift verify statement.json

The QShift Labs public key is built into qshift (internal/attest/keys/qshiftlabs.pub, key id 6eefe568d586337a) and served at /.well-known/qshift-keys.json. The owner can cancel a statement on the repository page (for example after sending it to the wrong person, or when the scan missed something). The site then lists it in a signed list of cancelled statements at /.well-known/qshift-revoked.json, the verify page says so and the badge turns grey. qshift verify reads that list from the site named in the statement and accepts it only when it was signed in the last 24 hours, so an old copy cannot hide a cancellation; --offline skips this check.

Exit code 0 = valid and current, 1 = valid but expired, 2 = not valid, cancelled, or the list could not be read. --key FILE checks against another key instead, such as the test key in testdata/attest/test-key.pub that the test servers sign with.

Levels

Level Meaning
critical broken by a large quantum computer (RSA, ECDSA, ECDH, EdDSA, DH, DSA)
high weak today (MD5, SHA-1, DES, 3DES, RC4, TLS 1.0/1.1)
medium post-quantum or acceptable, but not a CNSA 2.0 parameter set
info worth knowing, not a problem by itself
ok CNSA 2.0 algorithm

Grade and profiles

Every run ends with a grade and what to fix next:

Grade When
F weak settings on a live server (old TLS, SHA-1 certificate, weak SSH settings)
D weak findings (MD5, SHA-1, DES, old TLS, keys under 2048 bits)
C quantum-vulnerable public-key crypto (RSA, ECC, Diffie-Hellman)
B more than three medium findings
A one to three medium findings
A+ none of the above: everything that can be fixed is at the strength of the profile

Suppressed findings do not count. --profile cnsa2 (default) follows NSA CNSA 2.0: only ML-KEM-1024 and ML-DSA-87 are ok. --profile nist follows NIST IR 8547: every NIST standardized ML-KEM, ML-DSA and SLH-DSA parameter set, and the hybrid groups built on ML-KEM, are ok. --profile eu follows the ECCG Agreed Cryptographic Mechanisms 3.0 (December 2026), the list EU certification uses: ML-KEM-768 or -1024 (the ACM says in a hybrid with a classical key exchange, as X25519MLKEM768 does), ML-DSA-65 or -87, SLH-DSA, LMS, XMSS and FrodoKEM-976 or -1344 are ok; ML-KEM-512 and ML-DSA-44 stay below the profile. The website applies the same rules to uploaded results (web/src/lib/grade.ts); testdata/grade/cases.json is run by the tests of both.

Server config files

qshift scan checks the TLS, SSH and OpenSSL settings in config files, so a server's settings are reviewed before it goes live (qshift probe checks it after). Files read: *.conf, *.cnf, *.cfg, *.vhost, sshd_config, ssh_config, Caddyfile, Postfix main.cf / master.cf, every file in sites-available, sites-enabled, conf.d, sshd_config.d and similar folders, and templates of them (.j2, .tmpl, .erb, ...). Rules are in rules/conf/ and match by directive, so one file type can hold any server's syntax.

Rule Finds
conf-tls-old SSL 3.0, TLS 1.0 or 1.1 allowed: nginx ssl_protocols, Apache SSLProtocol, HAProxy ssl-min-ver / force-tlsv10, Caddy protocols, Postfix, Dovecot
conf-tls-weak-cipher RC4, DES, 3DES, NULL, export or MD5 suites that are not excluded with !
conf-groups-no-pq an explicit TLS group list without ML-KEM (nginx ssl_ecdh_curve, Apache SSLOpenSSLConfCmd Groups, HAProxy and Caddy curves, OpenSSL Groups =): it switches off the hybrid default of OpenSSL 3.5+
conf-groups-pq-below-cnsa2, conf-groups-pq-cnsa2 X25519MLKEM768 (medium) or SecP384r1MLKEM1024 / MLKEM1024 (ok) in the list
conf-ssh-* KexAlgorithms that replaces the defaults without ML-KEM or sntrup761, SHA-1 key exchange, weak ciphers, MD5 or SHA-1 MACs, ssh-rsa / ssh-dss signatures; lists starting with + or ^ add to the defaults and - lists remove, as in OpenSSH
conf-openssl-* MinProtocol below TLS 1.2, @SECLEVEL=0, default_md = sha1, default_bits under 2048

The levels match the live probe, so a config and the server running it get the same verdict. Values filled in by a template engine ({{ ssh_kex }}) are not visible to the scan.

Dependencies

qshift scan reads dependency manifests and lock files and reports crypto libraries in versions without post-quantum support, with the version to move to:

Ecosystem Files
Python requirements*.txt, requirements/*.txt, constraints*.txt, pyproject.toml (PEP 621, Poetry, uv), Pipfile, Pipfile.lock, poetry.lock, uv.lock, pdm.lock
JavaScript package.json, package-lock.json, npm-shrinkwrap.json, yarn.lock (v1 and berry), pnpm-lock.yaml
Java / Kotlin pom.xml (with ${properties}), build.gradle, build.gradle.kts (with version variables and gradle.properties), *.versions.toml
Go go.mod
.NET *.csproj, *.fsproj, *.vbproj, Directory.Packages.props, Directory.Build.props, packages.config
Rust Cargo.toml, Cargo.lock
PHP composer.json, composer.lock
C / C++ conanfile.txt, conanfile.py, vcpkg.json

A lock file wins over the manifests in its folder and below, so the version reported is the one installed. A range such as cryptography>=42 is reported when it still allows a version without post-quantum support (confidence medium); an unpinned name is not, because the newest release is installed. Versions with support are listed as ok, so the inventory and the CBOM show every crypto library.

Levels: medium for a version that cannot do the migration yet (for example cryptography before 48, Bouncy Castle before 1.79, OpenSSL before 3.5, rustls before 0.23.27), high for an abandoned library with known flaws (PyCrypto), info for libraries with only classic algorithms or meant for prototypes (node-forge, ring, libsodium, liboqs). go.mod also gets two checks of its own: a go line before 1.24 keeps the hybrid ML-KEM key exchange of crypto/tls off for the programs built from the module (go-mod-pq-tls-off), and godebug tlsmlkem=0 is reported like the same setting in code. Each library finding also says whether the code imports it (usage in JSON: imported or not-imported, looked up in the source files of that language). A library without post-quantum support that nothing imports came in with another package: it is reported as info and does not count for the grade; weak-today findings keep their level. A pinned OpenSSL or Mbed TLS version from a release branch that no longer gets security fixes is high (dep-end-of-support, for example OpenSSL 1.1.1 or 3.0); qshift probe reports the same for an OpenSSL version a web server names in its Server header (tls-server-end-of-support, medium for a distribution build such as -fips, which may still be patched). The library table is internal/scan/deps/libraries.yaml, the support dates internal/support/support.go.

Config file

qshift scan reads .qshift.yml (or .qshift.yaml) from the scanned folder; --config names another file and --no-config skips it. Flags given on the command line win over the file. Unknown keys are an error, so a typo never quietly weakens a scan.

profile: cnsa2          # or nist, eu
fail-on: high           # exit 1 at this level or worse
tests: false            # true also scans test and example code: shown, not graded
default-ignores: true   # false also scans test, vendor and similar folders
gitignore: true         # false also scans what .gitignore files exclude
snippets: true          # false leaves the lines of code out of every report and upload
rules: .qshift/rules    # extra rule files, relative to this file
baseline: .qshift-baseline.json  # findings recorded with --write-baseline; relative to this file

ignore:                 # not scanned at all
  - docs
  - /examples/legacy    # leading / = from the scanned folder only
  - "**/*.generated.cs"

suppress:               # kept in the report as accepted, with the reason
  - rule: py-hashlib-md5
    path: tools/checksum.py
    reason: checksum of a public download, not a security use

levels:                 # another level for matching findings, with the reason
  - rule: dep-*
    path: legacy
    level: info
    reason: legacy tool, removed in Q3 2027

Patterns work as in .gitignore: a name without / matches at any depth, ** spans folders, and a folder covers everything below it. rule is a rule id or a glob such as dep-*. Every suppress and levels entry needs a reason, and the reports show it (the HTML report under "Accepted by the team", SARIF as an external suppression). An entry that matches no finding prints a warning, so stale entries are noticed.

Pre-commit hook

qshift scan --staged --fail-on high scans only the files staged for the next commit and fails when one of them has something weak today. With pre-commit, add to .pre-commit-config.yaml:

repos:
  - repo: https://github.com/qshiftlabs/qshift
    rev: v0.2.15
    hooks:
      - id: qshift

Without pre-commit, put qshift scan --staged --fail-on high in .git/hooks/pre-commit.

AI coding tools (MCP)

qshift mcp is a Model Context Protocol server on stdin and stdout, so an AI coding tool can scan the project it works on, explain a finding and check a server. Tools: scan (a folder; profile, test code, staged files), explain (a rule id) and probe (live servers). It writes no files and runs on your computer; nothing goes to us. Add it in the MCP settings of your tool:

{"mcpServers": {"qshift": {"command": "qshift", "args": ["mcp"]}}}

Baseline: fail only on new findings

A project with many findings can still gate pull requests: record what is there today, commit the file, and let CI fail only when something new appears.

qshift scan . --write-baseline .qshift-baseline.json
qshift scan . --baseline .qshift-baseline.json --fail-on critical

A finding is known by its rule, its file and the line of code (spacing ignored), not by its line number, so it stays known when code above it moves; a changed line counts as new. Findings in the baseline still count for the grade and stay in every report, marked "in baseline" (SARIF baselineState). Write the file again when findings are fixed, so they cannot come back unnoticed. In the GitHub Action put baseline: in .qshift.yml, or pass --baseline in args.

Suppressing a finding

Add a comment on the line or the line above:

etag = hashlib.md5(body).hexdigest()  # qshift:ignore py-hashlib-md5 cache key only

Suppressed findings stay in the report with their reason, so a reviewer can see them. For a whole file or folder use suppress in the config file.

Rules

Rules are YAML files in rules/<language>/, embedded in the binary. A rule fires when the file contains one of requires_import and a line matches one of patterns but none of not_patterns. Comment lines are skipped. downgrade lowers the level for a recognizable safe use (for example usedforsecurity=False).

Accuracy

On the weak cipher (CWE-327) and weak hash (CWE-328) test cases of the OWASP Benchmark for Java 1.2, scored with its published answer key:

Category Vulnerable cases Safe cases Found Missed False alarms
Weak cipher 130 116 130 0 0
Weak hash 129 107 129 0 0

That is 100% precision and 100% recall in both categories. The first run found 55% of the weak ciphers and 69% of the weak hashes with no false alarms; the misses were calls split over two lines and algorithm names read from a .properties file, which qshift now follows. The benchmark has no post-quantum cases: it measures how well qshift finds what is weak today, not the quantum-vulnerable findings. Run it yourself with scripts/owasp-benchmark.sh (needs Go, git and Python 3).

For the quantum-vulnerable findings there is no answer key, so we checked them by hand: 20 open-source projects in C, C#, Go, Java, JavaScript, Python and Rust (OpenSSH, SSH.NET, Bouncy Castle for C#, OpenIddict, Bitwarden server, Smallstep certificates, CIRCL, Gitea, Traefik, Vault, Keycloak, Spring Security, forge, jose, certbot, rustls, Vaultwarden and others), up to 8 random findings per project, 123 in all. The algorithm was right in all 123. 115 (93%) are real uses of RSA, ECC or Diffie-Hellman in the project's own code; the other 8 are in test code under folder names qshift does not know (tap, a test harness, a folder of test certificates). The first round found 81%: the misses were test and example folders (regress, testhelpers, test-ca, examples) and the classic half of hybrid schemes, which qshift now skips or reports as a note. This measures precision only: how many quantum-vulnerable uses qshift misses is not measured.

Build

go build ./cmd/qshift
go test ./...

Live TLS/SSH test servers for the probe are in testdata/targets.

Release archives: set action/VERSION to the new tag, commit, git tag v0.2.0, then scripts/release.sh v0.2.0 builds every system into dist/ with qshift_v0.2.0.txt and checksums.txt (SIGN=1 scripts/release.sh v0.2.0 < seed also writes checksums.txt.sig). It refuses a dirty tree, a HEAD that is not the tag, and an action/VERSION that names another release. It builds with the Go release in the toolchain line of go.mod, and archive contents and dates come from the commit, so the same commit gives byte-identical files. Upload everything in dist/ to the release.

License

Apache-2.0, see LICENSE.

About

Post-quantum readiness scanner: finds quantum-vulnerable and weak crypto in code, keys, dependencies and live TLS/SSH servers

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages