FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

ecolibria/cryptoserve: Cryptography as a service. Post-quantum ready (ML-KEM, ML-DSA), FIPS 140-2/3 compliant, context-driven encryption with zero-config SDKs. "Life is hard but cryptography doesn't have to be." · GitHub

cryptoserve

Cryptographic toolchain for codebases. Scans for weak crypto, generates CBOMs, enforces CI gates, encrypts files, and assesses post-quantum readiness. Works offline. Apache 2.0.

Website · Crypto Census · Docs · SDK · Self-host

Quick start

npx cryptoserve scan .
CRYPTOSERVE > scan

  Directory            /work/payments-api
  Source files         2
  Files examined       3

Crypto Libraries
  Library                Version    Risk       Algorithms
  ---------------------- ---------- ---------- ------------------------------
  jsonwebtoken           9.0.0      high       RS256, HS256, ES256
  bcrypt                 5.1.0      none       bcrypt
  cryptography           builtin    high       rsa
  node:crypto            builtin    critical   md5, 3des, aes-gcm, csprng

Weak Crypto Patterns
  x RSA-1024: 1024-bit key is below the 2048-bit minimum (CWE-326)
    src/keys.py:4
    *  Fix: Generate keys at 3072 bits or move to ML-KEM / ML-DSA
  x MD5: Collision attacks (CWE-328)
    src/tokens.js:4
    *  Fix: Replace with SHA-256
  !  3DES: Deprecated, Sweet32 attack (CWE-327)
    src/tokens.js:8
    *  Fix: Replace with AES-256-GCM

Source Code Crypto
  Algorithm          Category      Language    Risk      Location
  ------------------ ------------- ----------- --------- ------------------------------
  rsa                encryption    python      high      src/keys.py:4
  rsa-1024           encryption    python      critical  src/keys.py:4
  md5                hashing       javascript  critical  src/tokens.js:4
  3des               encryption    javascript  low       src/tokens.js:8
  aes-gcm            encryption    javascript  none      src/tokens.js:12
  csprng             random        javascript  none      src/tokens.js:12

Summary
  Libraries            4
  Source algorithms    6
  Languages            python, javascript
  Manifests            package.json
  Secrets found        + 0
  Weak patterns        !  3
  Cert/key files       0

Scans 6 languages (JavaScript/TypeScript, Go, Python, Java/Kotlin, Rust, C/C++) against a database of 133 algorithms, 22 of them flagged weak with a named replacement. Every finding carries file:line. Zero npm dependencies. Works offline.

Install

npx cryptoserve scan .          # run once, no install
npm install -g cryptoserve      # install globally (Node 18+)
pip install cryptoserve         # Python SDK + CLI alias

From source

git clone https://github.com/ecolibria/cryptoserve.git
cd cryptoserve
node sdk/javascript/bin/cryptoserve.mjs scan .   # JS CLI, no build step

The Python SDK lives under sdk/python/ (editable install via pip install -e sdk/python).

Verifying releases

Every published tag attaches a SHA256SUMS.txt to its GitHub Release, covering every wheel, sdist and npm tarball uploaded with it. Entries use bare filenames, so verification works in whatever directory you download into.

# Python SDK
gh release download v1.4.3 -R ecolibria/cryptoserve
sha256sum -c SHA256SUMS.txt

# CLI (npm)
gh release download js-v0.4.0 -R ecolibria/cryptoserve
sha256sum -c SHA256SUMS.txt

Both publish workflows are triggered by a tag push and refuse to publish when the tag disagrees with the package version in the tree. npm publishes through npm Trusted Publishing and PyPI through PyPI Trusted Publishing, both over OIDC; no registry token exists in either workflow.

Releases from js-v0.4.0 onward also carry SLSA provenance. That an attestation exists and is trusted is not the same as it being ours, so the release fails unless the provenance names this repository, this workflow and the tag being released. To check that yourself:

curl -s "$(npm view cryptoserve@0.6.0 dist.attestations.url)" | node -pe '
JSON.parse(require("fs").readFileSync(0, "utf8")).attestations
  .filter((a) => a.predicateType.startsWith("https://slsa.dev/provenance/"))
  .map((a) => JSON.parse(Buffer.from(a.bundle.dsseEnvelope.payload, "base64"))
    .predicate.buildDefinition.externalParameters.workflow)'
[
  {
    ref: 'refs/tags/js-v0.6.0',
    repository: 'https://github.com/ecolibria/cryptoserve',
    path: '.github/workflows/publish-npm.yml'
  }
]

npm audit signatures, in a project that depends on cryptoserve, verifies the signature chain over that attestation.

Versions at or before 0.3.4 were published under the previous token-based workflow and carry no attestations. Verify those with SHA256SUMS.txt only.

Which command do I want

You want to... Command
See what crypto is in this project cryptoserve scan .
Score post-quantum readiness and get a migration plan cryptoserve pqc
Generate a Cryptographic Bill of Materials cryptoserve cbom --format cyclonedx
Block weak crypto in CI cryptoserve gate . --fail-on-weak
Clear a false positive without silencing a directory // cryptoserve-ignore <rule-id> -- <why>
Encrypt a file or string offline cryptoserve encrypt --file data.csv --password $SECRET
Hash a password (scrypt / pbkdf2 / argon2) cryptoserve hash-password --algorithm argon2
Store secrets in an encrypted local vault cryptoserve vault set API_KEY <value>
See what cryptography the open-source ecosystem uses cryptoserve census

Run cryptoserve help or cryptoserve <command> --help for full flags.

Commands

Assess

Command What it does
cryptoserve scan [path] Find every crypto library, algorithm, weak pattern, and hardcoded secret in the tree. JSON or table output.
cryptoserve pqc Quantum-readiness score with SNDL (Store Now, Decrypt Later) analysis and NIST-aligned migration guidance.
cryptoserve cbom [path] --format <fmt> Export a CBOM in CycloneDX or SPDX.
cryptoserve gate [path] CI/CD quality gate. Non-zero exit on weak algorithms or thresholds failing. SARIF for the GitHub Security tab.
cryptoserve census Global crypto adoption across 11 package ecosystems plus NVD. Renders the published snapshot from census.cryptoserve.dev, which is a dated measurement rather than a live feed, and shows the collection date. Cached for a day; --no-cache re-fetches.

Encrypt

Command What it does
cryptoserve encrypt "text" Context-aware encryption. --context <name> picks an algorithm per the policy model; --password does pure-password mode.
cryptoserve encrypt --file F --output O Encrypt a file in place or to a new path.
cryptoserve decrypt ... Inverse of encrypt. Same flags.
cryptoserve hash-password scrypt by default; --algorithm argon2 if cryptoserve[password] is installed. Non-interactive --password for CI.
cryptoserve context list Available encryption contexts and the algorithm each resolves to.

Vault

Command What it does
cryptoserve vault init Create an encrypted local secret store.
cryptoserve vault set/get/list/delete CRUD against the vault.
cryptoserve vault run -- <cmd> Run a subprocess with vault entries injected as env vars.
cryptoserve vault import .env Import an existing .env file.

Operate

Command What it does
cryptoserve init One-shot setup: master key, default vault, AI-tool integration.
cryptoserve login [--server URL] Authenticate against a self-hosted CryptoServe server.
cryptoserve status Configuration, server reachability, vault state.
cryptoserve version Build version.

Full reference: docs/cli.md.

CI/CD

- name: Crypto gate
  run: npx cryptoserve gate . --max-risk medium --max-severity low --format sarif --output crypto.sarif
- uses: github/codeql-action/upload-sarif@v3
  if: always()
  with:
    sarif_file: crypto.sarif

Each SARIF result carries the file:line that produced it, so findings land on the right line in the GitHub Security tab and in pull request annotations.

The gate's SARIF describes the gate's decision: the violations that failed this run at these thresholds, each naming the threshold it breached. A passing gate uploads no alerts. For every finding in the tree regardless of any threshold, upload cryptoserve scan --format sarif instead.

--max-risk bounds quantum risk; --max-severity bounds the security severity scan reports. They are separate questions: SHA-256 is quantum low and good practice, unauthenticated CBC has no quantum problem and is a medium security finding. See docs/cli.md.

Exit codes: 0 gate passed, 1 violations found, 2 the gate could not run (missing path, unreadable tree, a threshold it cannot enforce). A typo in the scanned path exits 2 rather than scoring a clean pass.

Clearing a false positive

A scanner whose false positives cannot be cleared gets excluded from the tree entirely. When an API-misuse finding is wrong for your code, waive that one finding where it is. scan and gate print the pragma to write, rule id included, so nothing has to be looked up:

Weak Crypto Patterns
  x TLS certificate verification disabled
    src/dev-server.js:4
    *  Fix: Remove the override and trust the system CA store
    Waive: put cryptoserve-ignore misuse/tls-verify-disabled -- <why> on its own line above

Put it in a comment on the finding's line or the one above, in whatever comment syntax the file's language uses:

// cryptoserve-ignore misuse/tls-verify-disabled -- talks only to the local test server's self-signed cert
const agent = new https.Agent({ rejectUnauthorized: false });

The gate now exits 0, and says what it stopped failing on:

  !  1 finding waived by a cryptoserve-ignore pragma:
    src/dev-server.js:5 misuse/tls-verify-disabled (talks only to the local test server's self-signed cert)

Nothing is silently dropped. gate --format json counts waived findings in summary.waived and lists each under waived[] with its reason, and SARIF emits them as suppressed results, which code scanning shows as dismissed alerts rather than as absent ones.

A waiver is a security control's off switch, so it is deliberately narrow:

  • A reason is required. It is the only part a reviewer can disagree with.
  • It must be the first thing in the comment, the rule eslint-disable uses, so prose that merely mentions a pragma is not one.
  • It waives one rule on one line, its own or the one below. There is no wildcard.
  • It reaches API misuse only, the misuse/* rules. Weak algorithms, secrets and private keys are not waivable this way. Use skipDirs in .cryptoserve.json for a directory of fixtures, --allow-secrets for credential findings.

A pragma that does not do what it looks like it does is reported rather than trusted:

Waiver Problems
  !  [malformed] a waiver needs a reason: cryptoserve-ignore <rule> -- <why>
    src/stale.js:4
  !  [unknown-rule] no rule is called misuse/tls-verify-disable
    src/stale.js:1
  !  [unused] this waiver covered no finding; delete it or move it onto the line it was written for
    src/stale.js:7

unused is the one to act on: a stale waiver is suppression with nothing under it, and the next real finding on that line would land under it silently.

Recognising a comment by its opener is a heuristic, not a parse. Data a project merely contains can operate this control, in any of the six languages, so a waiver is not a defence against a hostile file. What it guarantees is that this can never happen silently: every waived finding is listed by scan and gate, counted in gate --format json as summary.waived, and emitted to SARIF as suppressed. That is a fair trade only because a waiver is written by whoever can already edit the file, so anyone able to smuggle one through a string could just write the comment instead. The rule ids, the warnings, and the measured shapes are in docs/cli.md.

SDKs

Node.js (offline, zero dependencies)

import { scanProject } from 'cryptoserve/lib/scanner.mjs';
import { analyzeOffline } from 'cryptoserve/lib/pqc-engine.mjs';
import { generateCbom, toCycloneDx } from 'cryptoserve/lib/cbom.mjs';
import { encrypt, decrypt } from 'cryptoserve/lib/local-crypto.mjs';

Full reference: sdk/javascript/README.md.

Python (server-connected, local fallback)

pip install cryptoserve              # core + client
pip install cryptoserve[password]    # adds argon2
from cryptoserve import CryptoServe

crypto = CryptoServe(app_name="my-app", team="platform")
ciphertext = crypto.encrypt(b"data", context="user-pii")
plaintext = crypto.decrypt(ciphertext, context="user-pii")

Local mode works without a server. Full reference: docs/sdk/python.md.

Configuration

State (master key, vault, cached census data) lives in ~/.cryptoserve by default. Two environment variables move it, which is what makes the CLI usable in CI and in containers without writing into the invoking user's home:

Variable Effect
CRYPTOSERVE_HOME Absolute path to the state directory. Wins outright.
XDG_CONFIG_HOME Uses $XDG_CONFIG_HOME/cryptoserve when CRYPTOSERVE_HOME is unset.
CRYPTOSERVE_HOME=/run/cryptoserve cryptoserve vault init --password "$VAULT_PW"

Scanner limits and skip lists come from an optional .cryptoserve.json in the scanned directory. See docs/cli.md.

Self-host (optional)

The CLI and SDKs work fully offline. The self-hosted server adds centralized key management, policy enforcement, audit logging, and a dashboard.

docker run -d -p 8003:8003 -p 3000:3000 -v cryptoserve-data:/data ghcr.io/ecolibria/crypto-serve

API on :8003, dashboard on :3000. For production (Postgres + frontend + backend, generated secrets), see docs/guides/production-deployment.md. Don't pipe curl | sh; download scripts/quickstart.sh, compare shasum against release notes, then execute.

Capabilities: automatic key rotation and versioning, HKDF derivation, Shamir secret sharing, HSM/KMS backends, 5-layer context model, declarative policies, OAuth (GitHub/Google/Azure/Okta), RBAC, FIPS 140-2/3 modes, SIEM forwarding.

Documentation

Resource What's there
Getting started Install and first scan.
CLI reference Every command and flag.
Architecture Context model, policy engine, key management.
Post-quantum ML-KEM, ML-DSA, SLH-DSA, hybrid key exchange.
Python SDK API and examples.
REST API Server endpoints.
Security Threat model, FIPS compliance, transparency.

Security

Report vulnerabilities via GitHub Security Advisories. See SECURITY.md.

Contributing

Apache 2.0. See CONTRIBUTING.md for the dev loop, test conventions, and pre-push review gates.

git clone https://github.com/ecolibria/cryptoserve.git
cd cryptoserve && npm test

License

Apache 2.0. See LICENSE.

About

Cryptography as a service. Post-quantum ready (ML-KEM, ML-DSA), FIPS 140-2/3 compliant, context-driven encryption with zero-config SDKs. "Life is hard but cryptography doesn't have to be."

Topics

Resources

Contributing

Security policy

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages


Back | FazBrowse Home | New Git URL