Security scan
On this page
dokwe security scans a codebase for security problems before they reach production. It runs entirely on your machine: no code, file names or dependency lists are sent anywhere, and it uses no AI.
dokwe securityIt checks four things:
- Vulnerable dependencies: every lockfile is matched against the OSV vulnerability database, kept on your machine.
- Leaked secrets: API keys, tokens and private keys in your files, and with
--historyin your git history. - Insecure code: patterns behind common attacks, such as SQL built from strings, shell commands built from input, and TLS checks turned off.
- Deploy configuration: containers running as root, secrets in Dockerfiles, committed
.envfiles, debug mode left on.
You don't need to be logged in.
First run#
The scanner is a separate download, so the CLI itself stays small. The first time you run dokwe security, it asks first:
The security scanner isn't installed yet. It's a one-time download of 45.2 MB,
and it scans your code on this machine: nothing is uploaded.
Download it now? [Y/n]It then shows a progress bar, checks the file against its published SHA-256 checksum, and runs the scan. The scanner lives in ~/.dokwe/bin. After you update the CLI, the next dokwe security offers the matching scanner the same way.
The first scan of each kind of project also downloads that ecosystem's vulnerability database, once. Sizes vary: about 210 MB for npm, 36 MB for PyPI, and 3 to 12 MB for Go, Packagist, RubyGems, crates.io and Maven. It's kept in ~/.dokwe/osv.
Reading the report#
Leaked secrets (1)
CRITICAL Stripe access token in app/settings.py
app/settings.py:3
This file contains what looks like a Stripe access token (sk_l••••••).
Fix: Remove it from the code, load it from an environment variable, and revoke the key
with whoever issued it: anyone who has seen this file may have it.
Vulnerable dependencies (1)
CRITICAL django 3.2.0 has 38 known vulnerabilities
requirements.txt
CVE-2021-35042 (critical 9.8): SQL Injection in Django. Fixed in 3.2.5
...
Fix: Upgrade django to 5.2.17 or later, which fixes all of them.
15 problems: 2 critical, 9 high, 3 medium, 1 low
Scanned 6 files and 2 packages in 2.1s, on this machine. Vulnerability data from 26 hours ago.Findings are sorted by severity: critical, high, medium, low. Each one has the file and line, what's wrong, and how to fix it.
- Dependencies show one finding per vulnerable package, with its worst advisories and the version that fixes them for the release line you're on.
- Secrets are never printed, only their first few characters. Keys matching a known provider's format (Stripe, AWS, GitHub and hundreds more) are critical, because they work as they stand; generic key-shaped values are medium ("Possible secret"); anything found in a test file is low, because it's usually a fake.
On every deploy#
The same scanner also runs on Dokwe before each deploy builds, on whatever builds it: Dokwe's build servers, or your own server's agent. If it finds critical problems, the deploy waits for an owner or admin to proceed (with a reason, recorded in the audit log) or cancel. Each project chooses the level under Settings → Security: hold on critical, hold on high or critical, scan but never hold, or off. On the deploy page, Export downloads the findings as a spreadsheet (CSV), Markdown for a ticket or pull request, or JSON.
Audit what's running#
New vulnerabilities are published every day, so code that passed its scan when it deployed can have a known problem now. Open a project's Observability → Security and click Run security audit to scan the commit that's live in each environment again. Anyone in the workspace except viewers can run one.
- Where it runs: the same place that environment's deploys are scanned. That's Dokwe's build servers for projects Dokwe builds, or your own server, through its agent, for projects built there. On your server, the code is cloned to a temporary folder, scanned and deleted, and only the findings are sent to Dokwe. Scanning on your server needs agent 0.5.2 or later.
- What it scans: the exact commit that's live, not whatever the branch points at now. Environments running the same commit are scanned once.
- It only reports. An audit never holds, stops or changes anything.
- New since the last audit: findings that weren't in that environment's previous audit (or, the first time, in the deploy's own scan) are tagged New. If the code didn't change, the vulnerability database did.
- Every Monday morning, Dokwe audits each project again on its own. Owners and admins get an email and a push notification only when it finds something new at the project's hold level: critical, or high and critical when the project holds on high. Turn the weekly audit off under Settings → Security.
- History: the last 12 audits of each environment are kept. Export downloads the findings as CSV, Markdown or JSON.
Projects deployed from a ready-made Docker image have no source code on Dokwe, so there's nothing to audit. Run dokwe security where the image is built.
What stays on your machine#
Everything. While it scans, the scanner blocks every network request except downloads of the public OSV database from osv-vulnerabilities.storage.googleapis.com. Those requests fetch whole-ecosystem files (for example npm/all.zip), so they don't reveal anything about your project. If anything else tries to connect, the request is refused and the report says so.
The vulnerability database refreshes at most every 3 days, and the report says how old it is. Use --update-db to refresh it now, or --offline to never download anything.
What it skips#
- Folders that aren't your code:
node_modules,vendor,.git,dist,build,.next,.venv,__pycache__,coverageand similar. - Files over 1 MB, binary files, minified files and lockfiles (lockfiles are covered by the dependency scan).
- Your local
.env: secrets are meant to live there. A.envthat's committed to git is reported. - Tests and fixtures, for the insecure-code checks. Use
--include-teststo include them.
Silencing a finding#
After you've reviewed a line and it's fine, add a comment on it or on the line above:
db.query(`SELECT * FROM ${table}`) // dokwe-ignore: js-sql-templatedokwe-ignore on its own silences every check on that line; dokwe-ignore: <rule-id> silences one rule (the ID is in --json output). For secrets, use dokwe-ignore: secret. Lines already marked #nosec or nolint:gosec for other scanners are skipped too.
To leave out whole paths, use --exclude:
dokwe security --exclude "design/**" --exclude scripts/seed.tsUse it in CI#
The scan exits with status 1 when it finds a problem at --fail-on severity or above (default high), and 2 if it couldn't run. In CI, pass --yes so it downloads the scanner without asking.
This GitHub Actions workflow scans every push and shows the findings on the code in the pull request:
name: Security scan
on: [push, pull_request]
jobs:
scan:
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # full history, for --history
- run: curl -sSL https://dokwe.com/install-cli.sh | bash
- run: dokwe security --yes --history --sarif results.sarif --fail-on critical
- uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: results.sarifChecks#
Insecure-code checks are kept to patterns that are rarely wrong. A pattern can't follow data through your code, so checks that depend on user input only fire when the input is visibly on the same line.
| Language | Checks |
|---|---|
| JavaScript, TypeScript | SQL from template strings or +, Prisma $queryRawUnsafe, exec with interpolated values, eval / new Function on a variable, rejectUnauthorized: false, CORS with any origin and credentials, JWT none algorithm, MD5 or SHA-1 for passwords, Math.random for tokens, httpOnly: false cookies |
| Python | SQL built with f-strings, %, .format() or +, subprocess with shell=True, os.system with formatted strings, yaml.load without a safe loader, pickle.load, verify=False, eval / exec on a variable, Flask debug=True, MD5 or SHA-1 for passwords |
| PHP | SQL, shell commands, include and unserialize with $_GET / $_POST / $_REQUEST / $_COOKIE, eval on a variable |
| Go | InsecureSkipVerify: true, SQL built with fmt.Sprintf, sh -c commands built by joining strings |
| Ruby | SQL built with string interpolation |
| Deploy config | Dockerfile: running as root, unpinned base image, secrets in ENV / ARG, copying .env, ADD from a URL. Compose: privileged: true, database ports published on every interface. Django DEBUG = True and ALLOWED_HOSTS = ['*'], Laravel APP_DEBUG=true in production settings, committed .env files |
Flags#
dokwe security [folder] [flags]| Flag | Type | Default | Description |
|---|---|---|---|
--json | bool | false | Print the result as JSON |
--sarif | string | Also write SARIF 2.1.0 to this file (GitHub code scanning) | |
--fail-on | string | high | Exit with status 1 at this severity or above: critical, high, medium, low |
--history | bool | false | Also scan git history for secrets (slower) |
--update-db | bool | false | Refresh the vulnerability database now |
--offline | bool | false | Never download anything; use the vulnerability data already on this machine |
--include-tests | bool | false | Also check tests and fixtures for insecure code |
--exclude | string array | Paths or globs to leave out (repeatable) | |
--skip | string array | Leave out a check: deps, secrets, code, config | |
-y, --yes | bool | false | Download the scanner without asking (for CI) |