Thank you for helping. Bug reports, a missing rule, a false positive you can show us, a clearer sentence in the docs: all of it is welcome, and none of it needs to be big.
- Code of conduct
- How to contribute
- Development setup
- Code style
- Testing
- Adding a rule
- Documentation
- Project structure
- Workflow and commits
- Security issues
- Releases
- License
Be respectful and constructive, assume good faith, and keep the discussion about the code. Harassment of any kind is not accepted. A maintainer may edit or remove a comment, or block someone, to keep the project a place people want to work in.
flowchart TD
A([Start]) --> B[Open an issue,<br/>or pick one]
B --> C[Branch from main]
C --> D[Change code, tests and docs]
D --> E{pytest and<br/>ruff pass locally?}
E -- no --> D
E -- yes --> F[Open a pull request<br/>against main]
F --> G[CI: lint, tests, coverage,<br/>self-scan]
G --> H{Review and CI<br/>happy?}
H -- no --> D
H -- yes --> I([Merged])
Check the existing issues first. A good report contains:
- what you ran, exactly (
decascan scan ...), and what you expected; - what happened instead: the output, or the error;
- your environment:
decascan --version, your Python version and your OS; - the smallest file that shows it. For a false positive or a miss, the few lines of source are the most useful thing you can send;
- the log, when it helps:
decascan -vv scan <path>writes what the tool decided, and why, to stderr.
Please remove secrets from anything you paste. DecaScan redacts the credentials it finds, but your own files may hold others.
Say what you are trying to do, not only what you want added, and why the current behaviour does not get you there. A proposal for a new rule should name the risk (the Top 10 category), show code that should be reported, and show similar code that should not.
Look for issues labelled good first issue or help wanted. Fixing a false positive is a good way in:
find the rule, add the shape that was wrongly reported as a quiet test, and make the test pass.
You need Python 3.10 or newer. uv is the quickest way to set up, but plain
venv and pip work.
git clone https://github.com/cvas22/decascan
cd decascan
uv venv --python 3.12
uv pip install -e ".[dev]" # or: python -m venv .venv && .venv/bin/pip install -e ".[dev]"
decascan --version # the command is installed into the virtualenv
pytest # the unit tests
ruff check . # lintIf you cloned a fork, add the original repository as upstream so you can keep up to date:
git remote add upstream https://github.com/cvas22/decascan.
- ruff does the linting, with the rules in
pyproject.toml(line length 110;E,F,I,UP,B). Runruff check .before you push, andruff check . --fixto apply the safe fixes. There is no separate formatter, import sorter or type checker to run. - Match the code around you: the same comment density, naming and idiom. Comments explain why, not what.
- Python 3.10 is the floor, so no
tomllib, nomatchon 3.10-incompatible syntax, nothing newer than the oldest supported version. - The scanner is offline and never runs the code it scans. Do not add network calls, and do not import or execute anything from a scanned directory.
- A change to what the tool reports should keep false positives low. A rule that fires on honest code gets turned off.
Commits, pull requests, code comments and documentation describe the change in plain technical terms. Do not include tool or assistant branding, and do not add automatically generated co-author trailers.
pytest # everything
pytest tests/test_rules.py -q # one file
pytest tests/test_mask.py::test_multiline_docstring_is_masked_but_the_code_after_it_is_not
pytest --cov=decascan # with coverage; CI fails under the floor set in pyproject.toml- Test behaviour, not implementation. Every rule needs a case that fires and a nearby safe case that does not.
- Tests build their inputs in
tmp_pathor use the fixtures undertests/fixtures/. Theclean_*fixtures must produce no findings; if a change makes one light up, that is a false positive. - Some symlink tests are skipped where creating a symlink needs a privilege (Windows without developer mode). They run in CI on Linux and macOS.
- CI also scans the vulnerable and clean fixtures with the real command, and runs DecaScan on its own
source (
self-scan).
- Write the rule with
@rule(id=..., mcp_id=<risk id>, name=..., description=...)in the module for its list:rules/mcp0N_*.pyfor the MCP list,rules/llm_top10.pyorrules/web_top10.pyfor the others. The risk id must exist incore/standards.py. - Add samples: for an LLM or web rule, a firing and a quiet sample in
tests/test_web_llm_rules.py; for an MCP rule, cases intests/test_rules.py(ortests/test_mcp_rules_negative.py). - Refresh what is generated from the rules (below).
- Add a line to the Unreleased section of
CHANGELOG.md.
To add a whole new Top 10 list, define a Standard in core/standards.py, add it to STANDARDS, and write
its rule module. Risk ids must be unique across lists.
The prose in README.md and docs/ is written by hand. Three things are generated and should be refreshed
when the code they come from changes:
python scripts/generate_rule_docs.py # the LLM and web sections of docs/rules.md
decascan standards --export src/decascan/data/top10 # the cached Top 10 catalog, one file per list
python scripts/generate_assets.py # the README's terminal screenshot and coverage chartWrite MCP rule sections in docs/rules.md by hand under ### <RULE-ID>. Keep the README true to what the
tool does: if you change a default, an option or an exit code, change the README in the same pull request.
src/decascan/
cli.py the command line: scan, rules, standards
catalog.py the cached Top 10 catalog
core/ scanning: config, context, scanner, findings, detection, merging, paths, logging
parsers/ Python, TypeScript/JavaScript, manifests and dependency files into shared facts
rules/ one module per MCP risk, plus llm_top10.py and web_top10.py
outputs/ pretty, JSON, SARIF and GitHub annotation output
data/top10/ the cached catalog: one JSON file per Top 10 list
tests/ unit tests, and fixtures/ with small vulnerable and clean example projects
docs/ rules.md, standards.md, ci.md and the README's pictures (assets/)
scripts/ generate_rule_docs.py, generate_assets.py
action.yml the GitHub Action other repositories can use
.github/ workflows, Dependabot, code owners, labeler
A rule is a function from a ScanContext to findings. Parsers turn each language into the shared facts in
parsers/common.py, so rules do not care whether a server is Python or TypeScript.
- Fork the repository (or, if you have write access, branch from
main). - Create a branch:
feat/short-name,fix/short-name,docs/short-name. - Make small, focused commits. Keep unrelated changes in separate pull requests.
- Keep up to date:
git fetch upstream && git rebase upstream/main. - Push, and open a pull request against
main.
If a change depends on another open pull request, say so in the description and merge them in order. Do
not merge a pull request into another pull request's branch: that leaves its changes off main.
CI must pass: lint, the unit tests with the coverage floor, the fixture scans, the self-scan and the wheel
check. Pull requests are labelled automatically from the paths they change, and the code owners in
.github/CODEOWNERS are asked to review.
We use Conventional Commits:
type(scope): short description in the imperative
Optional body: what changed and why, wrapped at about 100 columns.
Types: feat, fix, docs, test, refactor, build, ci, chore.
feat: add a log event for slow rules
fix: do not report a call that appears only inside a docstring
docs: describe the exit codes
test: cover the dependency parser's URL fragments
ci: pin the actions to commit SHAs
If you find a vulnerability in DecaScan itself, for example a crafted file that makes the scanner read outside the directory it was pointed at, or run code, please do not open a public issue. Report it privately using GitHub's Report a vulnerability option on the repository's Security tab, and include a way to reproduce it. Findings about the code DecaScan scans are ordinary issues.
Maintainers only. Update the version in pyproject.toml and move the Unreleased notes in CHANGELOG.md
under it, merge that to main, then publish a GitHub Release tagged vX.Y.Z. The release workflow runs the
full CI suite and, if it passes, builds the package and publishes it to PyPI with Trusted Publishing: there
is no API token to manage.
DecaScan is licensed under Apache-2.0. By contributing you agree that your contribution is licensed under the same terms.
Open an issue with the question label, or ask on the pull request. Contributors appear on the repository's
contributors page, and significant contributions are credited in the release notes.