-
Couldn't load subscription status.
- Fork 35
Usage
This page provides detailed examples for scanning each supported target and highlights common options for tailoring scans to your workflow.
Scan the current checkout of a repository:
kingfisher scan /path/to/repoInclude all commits by enabling the Git history scanner:
kingfisher scan --git-history /path/to/repo
Scan a repository without cloning it locally:
kingfisher scan --git-url https://github.com/org/repo.git
Limit the scan to a branch or commit hash:
kingfisher scan --git-url https://github.com/org/repo.git --git-branch main
kingfisher scan --git-url https://github.com/org/repo.git --git-commit 0123abcd
Kingfisher can interact with Git hosting providers over their APIs.
List repositories for a user or organization:
kingfisher github repos list --user my-user
kingfisher github repos list --organization my-org
Scan a private repository by passing a token via the KF_GITHUB_TOKEN
environment variable:
KF_GITHUB_TOKEN=ghp_... kingfisher scan --git-url https://github.com/org/private_repo.git
Use the GitLab token in KF_GITLAB_TOKEN to scan a project:
KF_GITLAB_TOKEN=glpat-... kingfisher scan --git-url https://gitlab.com/group/project.gitList projects within a group:
kingfisher gitlab projects list --group my-group
Provide AWS credentials with the standard AWS_* environment variables or an
--aws-profile value:
# Scan an entire bucket
kingfisher scan --s3-bucket my-bucket
# Scan only a specific prefix within the bucket
kingfisher scan --s3-bucket my-bucket --s3-prefix path/to/folder/
# Use a named profile from ~/.aws/credentials
kingfisher scan --s3-bucket my-bucket --aws-profile prod
# Scan a local image
kingfisher docker image scan alpine:latest
# Scan an image from a remote registry
kingfisher docker image scan ghcr.io/mongodb/kingfisher:latest
# Scan a tar archive exported from Docker
kingfisher docker archive scan ./image.tar
Authenticate with KF_JIRA_TOKEN and specify the site URL:
Scan Jira issues matching a JQL query
KF_JIRA_TOKEN="token" kingfisher scan \
--jira-url https://jira.company.com \
--jql "project = TEST AND status = Open" \
--max-results 500*Scan the last 1,000 Jira issues
KF_JIRA_TOKEN="token" kingfisher scan \
--jira-url https://jira.mongodb.org \
--jql 'ORDER BY created DESC' \
--max-results 1000The --jql flag accepts any Jira Query Language expression, allowing targeted
scans across projects or specific issue sets.
Use a Slack token in KF_SLACK_TOKEN to scan messages:
# Scan a single channel
KF_SLACK_TOKEN=xoxb-... kingfisher slack channel scan C1234567890
# Scan all channels in a workspace
KF_SLACK_TOKEN=xoxb-... kingfisher slack workspace scan
Generate a baseline file to suppress known secrets and keep only new findings:
kingfisher scan /src --manage-baseline --baseline-file baseline.ymlUse the same baseline on future runs to ignore recorded findings:
kingfisher scan /src --baseline-file baseline.yml
kingfisher rules list
Scan using only custom rules:
kingfisher scan \
--load-builtins=false \
--rules-path path/to/my_rules.yaml \
./src/Add your rules alongside the built‑ins:
kingfisher scan \
--rules-path ./custom-rules/ \
--rules-path my_rules.yml \
~/path/to/project-dir/Validate rule definitions before running a scan:
kingfisher rules check --rules-path ./my_rules.yml
Example rule file (my_rules.yml):
- id: custom-api-key
pattern: AKIA[0-9A-Z]{16}
message: "Potential AWS access key"
severity: high
-
--no-dedup: Report every occurrence of a finding (disable default de-duplication) -
--confidence <LEVEL>: (low|medium|high) -
--min-entropy <VAL>: Override default threshold -
--no-binary: Skip binary files -
--no-extract-archives: Do not scan inside archives -
--extraction-depth <N>: Specifies how deep nested archives should be extracted and scanned (default: 2) -
--redact: Replaces discovered secrets with a one-way hash for secure output -
--exclude <PATTERN>: Skip any file or directory whose path matches this glob pattern -
--baseline-file <FILE>: Ignore matches listed in a baseline YAML file -
--manage-baseline: Create or update the baseline file with current findings -
--threads <N>: Limit the number of worker threads -
--output-format <FMT>: Choosehuman,json, orsarif -
--max-filesize <BYTES>: Skip files larger than the provided size
The four-field formula (rule SHA-1, origin label, start & end offsets) hashed with XXH3-64 creates Kingfisher's 64-bit finding fingerprint. See docs/FINGERPRINT.md for details.
Use --rule-stats to collect timing information for every rule. After
scanning, the summary prints a Rule Performance Stats section showing how many
matches each rule produced along with its slowest and average match times.
kingfisher scan --help