mcp-server-asvs-security-assistant 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. mcp_server_asvs_security_assistant-0.1.0/.dockerignore +10 -0
  2. mcp_server_asvs_security_assistant-0.1.0/.github/ISSUE_TEMPLATE/bug_report.yml +40 -0
  3. mcp_server_asvs_security_assistant-0.1.0/.github/ISSUE_TEMPLATE/feature_request.yml +37 -0
  4. mcp_server_asvs_security_assistant-0.1.0/.github/pull_request_template.md +17 -0
  5. mcp_server_asvs_security_assistant-0.1.0/.github/workflows/ci.yml +31 -0
  6. mcp_server_asvs_security_assistant-0.1.0/.github/workflows/release.yml +150 -0
  7. mcp_server_asvs_security_assistant-0.1.0/.gitignore +9 -0
  8. mcp_server_asvs_security_assistant-0.1.0/CONTRIBUTING.md +133 -0
  9. mcp_server_asvs_security_assistant-0.1.0/Dockerfile +24 -0
  10. mcp_server_asvs_security_assistant-0.1.0/LICENSE +202 -0
  11. mcp_server_asvs_security_assistant-0.1.0/NOTICE +19 -0
  12. mcp_server_asvs_security_assistant-0.1.0/PKG-INFO +384 -0
  13. mcp_server_asvs_security_assistant-0.1.0/README.md +354 -0
  14. mcp_server_asvs_security_assistant-0.1.0/examples/both_servers.json +16 -0
  15. mcp_server_asvs_security_assistant-0.1.0/examples/claude_desktop_config.json +10 -0
  16. mcp_server_asvs_security_assistant-0.1.0/examples/cursor_mcp.json +10 -0
  17. mcp_server_asvs_security_assistant-0.1.0/examples/docker_mcp.json +22 -0
  18. mcp_server_asvs_security_assistant-0.1.0/examples/vscode_mcp.json +11 -0
  19. mcp_server_asvs_security_assistant-0.1.0/pyproject.toml +49 -0
  20. mcp_server_asvs_security_assistant-0.1.0/server.json +30 -0
  21. mcp_server_asvs_security_assistant-0.1.0/src/asvs_mcp/__init__.py +3 -0
  22. mcp_server_asvs_security_assistant-0.1.0/src/asvs_mcp/asvs.py +154 -0
  23. mcp_server_asvs_security_assistant-0.1.0/src/asvs_mcp/data/OWASP_Application_Security_Verification_Standard_5.0.0_en.csv +347 -0
  24. mcp_server_asvs_security_assistant-0.1.0/src/asvs_mcp/data/README.md +13 -0
  25. mcp_server_asvs_security_assistant-0.1.0/src/asvs_mcp/data/pci_dss_mapping.json +98 -0
  26. mcp_server_asvs_security_assistant-0.1.0/src/asvs_mcp/pci_dss.py +68 -0
  27. mcp_server_asvs_security_assistant-0.1.0/src/asvs_mcp/scanners/__init__.py +42 -0
  28. mcp_server_asvs_security_assistant-0.1.0/src/asvs_mcp/scanners/code_scanner.py +390 -0
  29. mcp_server_asvs_security_assistant-0.1.0/src/asvs_mcp/scanners/repo_scanner.py +154 -0
  30. mcp_server_asvs_security_assistant-0.1.0/src/asvs_mcp/scanners/web_scanner.py +237 -0
  31. mcp_server_asvs_security_assistant-0.1.0/src/asvs_mcp/security.py +98 -0
  32. mcp_server_asvs_security_assistant-0.1.0/src/asvs_mcp/server.py +339 -0
  33. mcp_server_asvs_security_assistant-0.1.0/tests/__init__.py +0 -0
  34. mcp_server_asvs_security_assistant-0.1.0/tests/test_code_scanner.py +175 -0
  35. mcp_server_asvs_security_assistant-0.1.0/tests/test_data.py +32 -0
  36. mcp_server_asvs_security_assistant-0.1.0/tests/test_license_headers.py +22 -0
  37. mcp_server_asvs_security_assistant-0.1.0/tests/test_lookup_tools.py +99 -0
  38. mcp_server_asvs_security_assistant-0.1.0/tests/test_mcp_protocol.py +81 -0
  39. mcp_server_asvs_security_assistant-0.1.0/tests/test_pci_mapping.py +99 -0
  40. mcp_server_asvs_security_assistant-0.1.0/tests/test_read_only.py +17 -0
  41. mcp_server_asvs_security_assistant-0.1.0/tests/test_release_metadata.py +40 -0
  42. mcp_server_asvs_security_assistant-0.1.0/tests/test_repo_scanner.py +69 -0
  43. mcp_server_asvs_security_assistant-0.1.0/tests/test_security.py +61 -0
  44. mcp_server_asvs_security_assistant-0.1.0/tests/test_web_scanner.py +101 -0
  45. mcp_server_asvs_security_assistant-0.1.0/uv.lock +1140 -0
@@ -0,0 +1,10 @@
1
+ # Allowlist: only what the image needs enters the build context.
2
+ *
3
+ !pyproject.toml
4
+ !uv.lock
5
+ !README.md
6
+ !LICENSE
7
+ !NOTICE
8
+ !src/
9
+ **/__pycache__
10
+ **/*.pyc
@@ -0,0 +1,40 @@
1
+ name: Bug report
2
+ description: Something does not work, or a tool returns the wrong requirement
3
+ labels: [bug]
4
+ body:
5
+ - type: markdown
6
+ attributes:
7
+ value: |
8
+ Thanks for reporting. This repository is public: **never paste real secrets, credentials, keys, tokens or personal data**. Use made-up values and requirement IDs (e.g. `V6.2.1`) instead.
9
+ - type: textarea
10
+ id: what
11
+ attributes:
12
+ label: What happened?
13
+ description: Include the tool name, its parameters and any error message.
14
+ validations:
15
+ required: true
16
+ - type: textarea
17
+ id: input
18
+ attributes:
19
+ label: Input that reproduces it
20
+ description: A minimal, synthetic sample, or the steps you ran.
21
+ render: text
22
+ - type: textarea
23
+ id: expected
24
+ attributes:
25
+ label: What did you expect?
26
+ validations:
27
+ required: true
28
+ - type: input
29
+ id: environment
30
+ attributes:
31
+ label: Environment
32
+ description: Version (pyproject or release), MCP client, OS, Python version, Docker or uv
33
+ placeholder: v0.1.0, Claude Desktop, Ubuntu 24.04, Python 3.13, uv
34
+ - type: checkboxes
35
+ id: safe
36
+ attributes:
37
+ label: Before submitting
38
+ options:
39
+ - label: This report contains no real secrets, credentials or personal data.
40
+ required: true
@@ -0,0 +1,37 @@
1
+ name: Feature or rule request
2
+ description: Suggest a new check, a better ASVS mapping, or another improvement
3
+ labels: [enhancement]
4
+ body:
5
+ - type: markdown
6
+ attributes:
7
+ value: |
8
+ Refer to requirements by ID (e.g. `V9.1.2`) and describe them in your own words. Do not paste real secrets, credentials or personal data.
9
+ - type: textarea
10
+ id: idea
11
+ attributes:
12
+ label: What should it do?
13
+ description: For a check, what should it detect, and in which file type?
14
+ validations:
15
+ required: true
16
+ - type: input
17
+ id: requirement
18
+ attributes:
19
+ label: Related ASVS requirement IDs
20
+ placeholder: e.g. V1.2.4, V12.3.2
21
+ - type: textarea
22
+ id: example
23
+ attributes:
24
+ label: Example
25
+ description: A synthetic sample that should (and one that should not) trigger it.
26
+ render: text
27
+ - type: textarea
28
+ id: why
29
+ attributes:
30
+ label: Why is it useful?
31
+ - type: checkboxes
32
+ id: safe
33
+ attributes:
34
+ label: Before submitting
35
+ options:
36
+ - label: This request contains no real secrets, credentials or personal data.
37
+ required: true
@@ -0,0 +1,17 @@
1
+ ## What does this change?
2
+
3
+ <!-- One or two sentences. -->
4
+
5
+ Closes #<!-- issue number -->
6
+
7
+ ## Checklist
8
+
9
+ See [CONTRIBUTING.md](../CONTRIBUTING.md) for details.
10
+
11
+ - [ ] The approach was agreed in the linked issue, and this pull request targets `develop` (only maintainer releases and hotfixes target `main`)
12
+ - [ ] The bundled ASVS CSV is unchanged, and no ASVS or PCI SSC text was copied into code, tests or docs
13
+ - [ ] No real secrets, credentials, card numbers or personal data anywhere in this pull request
14
+ - [ ] New scanner rules use fixed `issue_description` / `remediation_step` text; values from the input go only in `evidence` or `location`
15
+ - [ ] Tests cover both a case that triggers the change and one that must not
16
+ - [ ] `uv run ruff check .` and `uv run pytest` pass
17
+ - [ ] README or CONTRIBUTING updated if behavior or setup changed
@@ -0,0 +1,31 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ test:
12
+ runs-on: ubuntu-latest
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ python-version: ["3.11", "3.13"]
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - uses: astral-sh/setup-uv@v6
21
+ with:
22
+ python-version: ${{ matrix.python-version }}
23
+
24
+ - name: Install
25
+ run: uv sync --locked --all-extras
26
+
27
+ - name: Lint
28
+ run: uv run ruff check .
29
+
30
+ - name: Test
31
+ run: uv run pytest -q
@@ -0,0 +1,150 @@
1
+ name: Release
2
+
3
+ # Publishing a GitHub release (tag vX.Y.Z) builds and tests the package, then publishes it to PyPI, the Docker image
4
+ # to ghcr.io and the server to the MCP Registry. Running the workflow by hand is a dry run that publishes to
5
+ # TestPyPI only. One-time setup is described in CONTRIBUTING.md under "Releases and hotfixes".
6
+
7
+ on:
8
+ release:
9
+ types: [published]
10
+ workflow_dispatch:
11
+
12
+ permissions:
13
+ contents: read
14
+
15
+ jobs:
16
+ build:
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+
21
+ - uses: astral-sh/setup-uv@v6
22
+ with:
23
+ python-version: "3.13"
24
+
25
+ - name: Check the release tag matches the package version
26
+ if: github.event_name == 'release'
27
+ run: |
28
+ version=$(uv run --no-project python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
29
+ test "$GITHUB_REF_NAME" = "v$version" || { echo "Tag $GITHUB_REF_NAME does not match version $version"; exit 1; }
30
+
31
+ - name: Install
32
+ run: uv sync --locked --all-extras
33
+
34
+ - name: Lint and test
35
+ run: |
36
+ uv run ruff check .
37
+ uv run pytest -q
38
+
39
+ - name: Build
40
+ run: uv build
41
+
42
+ - name: Smoke-test the built wheel in a clean environment
43
+ run: |
44
+ wheel=$(ls dist/*.whl)
45
+ uv run --isolated --no-project --with "./$wheel" python -c "
46
+ import asyncio
47
+ from asvs_mcp import server
48
+ from asvs_mcp.asvs import get_asvs
49
+ assert len(get_asvs().records) == 345 and len(asyncio.run(server.mcp.list_tools())) == 7
50
+ print('wheel OK')"
51
+
52
+ - uses: actions/upload-artifact@v4
53
+ with:
54
+ name: dist
55
+ path: dist/
56
+
57
+ testpypi:
58
+ if: github.event_name == 'workflow_dispatch'
59
+ needs: build
60
+ runs-on: ubuntu-latest
61
+ environment: testpypi
62
+ permissions:
63
+ id-token: write # PyPI Trusted Publishing: no API token is stored anywhere
64
+ steps:
65
+ - uses: actions/download-artifact@v4
66
+ with:
67
+ name: dist
68
+ path: dist/
69
+ - uses: pypa/gh-action-pypi-publish@release/v1
70
+ with:
71
+ repository-url: https://test.pypi.org/legacy/
72
+
73
+ pypi:
74
+ if: github.event_name == 'release'
75
+ needs: build
76
+ runs-on: ubuntu-latest
77
+ environment: pypi
78
+ permissions:
79
+ id-token: write # PyPI Trusted Publishing: no API token is stored anywhere
80
+ steps:
81
+ - uses: actions/download-artifact@v4
82
+ with:
83
+ name: dist
84
+ path: dist/
85
+ - uses: pypa/gh-action-pypi-publish@release/v1
86
+
87
+ image:
88
+ if: github.event_name == 'release'
89
+ needs: build
90
+ runs-on: ubuntu-latest
91
+ permissions:
92
+ contents: read
93
+ packages: write
94
+ steps:
95
+ - uses: actions/checkout@v4
96
+ - uses: docker/setup-qemu-action@v3
97
+ - uses: docker/setup-buildx-action@v3
98
+ - uses: docker/login-action@v3
99
+ with:
100
+ registry: ghcr.io
101
+ username: ${{ github.actor }}
102
+ password: ${{ secrets.GITHUB_TOKEN }}
103
+ - id: meta
104
+ uses: docker/metadata-action@v5
105
+ with:
106
+ images: ghcr.io/${{ github.repository }}
107
+ tags: |
108
+ type=semver,pattern={{version}}
109
+ type=semver,pattern={{major}}.{{minor}}
110
+ - uses: docker/build-push-action@v6
111
+ with:
112
+ context: .
113
+ platforms: linux/amd64,linux/arm64
114
+ push: true
115
+ tags: ${{ steps.meta.outputs.tags }}
116
+ labels: ${{ steps.meta.outputs.labels }}
117
+
118
+ mcp-registry:
119
+ if: github.event_name == 'release'
120
+ needs: pypi # the registry checks the PyPI package's README for the mcp-name line
121
+ runs-on: ubuntu-latest
122
+ permissions:
123
+ id-token: write # GitHub OIDC login for the io.github.<owner>/ namespace
124
+ contents: read
125
+ env:
126
+ MCP_PUBLISHER_VERSION: v1.8.1 # upgrade deliberately; never use the mutable "latest" release URL
127
+ steps:
128
+ - uses: actions/checkout@v4
129
+
130
+ - uses: sigstore/cosign-installer@6f9f17788090df1f26f669e9d70d6ae9567deba6 # v4.1.2
131
+
132
+ - name: Download and verify mcp-publisher
133
+ run: |
134
+ set -euo pipefail
135
+ archive="mcp-publisher_linux_amd64.tar.gz"
136
+ base_url="https://github.com/modelcontextprotocol/registry/releases/download/${MCP_PUBLISHER_VERSION}"
137
+ curl --fail --location --silent --show-error --output "$archive" "$base_url/$archive"
138
+ curl --fail --location --silent --show-error --output "$archive.sigstore.json" "$base_url/$archive.sigstore.json"
139
+ cosign verify-blob \
140
+ --bundle "$archive.sigstore.json" \
141
+ --certificate-identity "https://github.com/modelcontextprotocol/registry/.github/workflows/release.yml@refs/tags/${MCP_PUBLISHER_VERSION}" \
142
+ --certificate-oidc-issuer "https://token.actions.githubusercontent.com" \
143
+ "$archive"
144
+ tar xzf "$archive" mcp-publisher
145
+ rm -f "$archive" "$archive.sigstore.json"
146
+
147
+ - name: Publish to the MCP Registry
148
+ run: |
149
+ ./mcp-publisher login github-oidc
150
+ ./mcp-publisher publish
@@ -0,0 +1,9 @@
1
+ # Python artifacts
2
+ .venv/
3
+ __pycache__/
4
+ *.pyc
5
+ *.egg-info/
6
+ .pytest_cache/
7
+ .ruff_cache/
8
+ dist/
9
+ build/
@@ -0,0 +1,133 @@
1
+ # Contributing
2
+
3
+ Thanks for helping improve this project. Please read the content rules first: they are the things a pull request must never get wrong.
4
+
5
+ ## Content rules
6
+
7
+ - **The ASVS file stays unmodified.** `src/asvs_mcp/data/OWASP_Application_Security_Verification_Standard_5.0.0_en.csv` is OWASP's official file under CC BY-SA 4.0, and `tests/test_data.py` checks its checksum. Do not edit it; fix display issues in `asvs.py` instead.
8
+ - **Keep ASVS text in that one file.** In code, comments, tests and documentation, refer to requirements by ID (`V6.2.1`) and short descriptions in your own words. This keeps the CC BY-SA content in a single clearly licensed file, while everything else stays under Apache-2.0.
9
+ - **No PCI SSC text.** PCI DSS documents are copyrighted by PCI Security Standards Council, LLC. The PCI DSS mapping uses requirement IDs only, and its notes are short descriptions in our own words. Never paste text from PCI SSC documents anywhere in the repository, issues or pull requests.
10
+ - **No real secrets or personal data.** Never put real credentials, keys, tokens, card numbers or personal data in code, tests, issues or pull requests. Use obviously fake values.
11
+
12
+ ## How to contribute
13
+
14
+ This project follows gitflow. `main` holds released versions and `develop` is where new work comes together. Both branches are protected: nobody, maintainers included, can push or force-push to them. Every change goes in through a pull request, and CI (`test (3.11)` and `test (3.13)`) must pass before it can be merged.
15
+
16
+ 1. **Open an issue.** Search the existing issues first, then use the [bug report or feature request form](https://github.com/itssaeedyari/mcp-server-asvs-security-assistant/issues/new/choose). Typo fixes and other one-line changes can skip to step 3.
17
+ 2. **Agree on the approach in the issue.** Comment with how you plan to solve it and wait for a maintainer to confirm and assign the issue to you. This saves you from writing code that cannot be accepted, such as a rule mapped to the wrong requirement.
18
+ 3. **Fork the repository and branch from `develop`.**
19
+
20
+ ```bash
21
+ git clone https://github.com/<your-username>/mcp-server-asvs-security-assistant.git
22
+ cd mcp-server-asvs-security-assistant
23
+ git remote add upstream https://github.com/itssaeedyari/mcp-server-asvs-security-assistant.git
24
+ git fetch upstream
25
+ git switch -c feature/42-short-name upstream/develop
26
+ ```
27
+
28
+ Name the branch `feature/<issue>-<short-name>` for features and documentation, or `fix/<issue>-<short-name>` for bug fixes. Maintainers can branch in this repository instead of a fork.
29
+ 4. **Make the change and run the [checks](#checks).** Keep it to one change, with tests. Do not commit generated files, local configs or secrets.
30
+ 5. **Open a pull request into `develop`**, never into `main`. Fill in the template and write `Closes #42` in the description so the pull request is linked to its issue and the issue closes when it is merged.
31
+ 6. **Respond to the review.** A maintainer reviews every pull request. Answer comments by pushing new commits to the same branch, and do not force-push once the review has started, so the reviewer can see what changed. If your branch conflicts with `develop`, run `git fetch upstream && git merge upstream/develop` and push.
32
+ 7. **A maintainer merges it.** Once CI passes and the review is approved, a maintainer squash-merges the pull request into `develop`. Your change ships to `main` with the next release.
33
+
34
+ By contributing, you agree that your contributions are licensed under the [Apache License 2.0](LICENSE).
35
+
36
+ ## Releases and hotfixes (maintainers)
37
+
38
+ - **Release:** bump the version in `pyproject.toml` and `server.json` (see [Publishing](#publishing-maintainers)) through a normal pull request into `develop`. Then open a pull request from `develop` into `main` and merge it with **Create a merge commit**, never squash: a squash gives `main` a commit that `develop` does not have, and the next release pull request conflicts. After the merge, tag and publish the release on `main`:
39
+
40
+ ```bash
41
+ gh release create v0.1.0 --target main --generate-notes
42
+ ```
43
+
44
+ If `develop` must keep moving while a release is being tested, branch `release/<version>` from `develop`, put only release fixes on it, and open pull requests from it into both `main` and `develop`.
45
+ - **Hotfix:** for an urgent fix to a released version, branch `hotfix/<issue>-<short-name>` from `main` and open a pull request into `main`. Merge it with a merge commit and publish a patch release as above. Then open a second pull request from the same branch into `develop` so the next release does not lose the fix.
46
+
47
+ ## Publishing (maintainers)
48
+
49
+ Publishing a GitHub release for a tag `vX.Y.Z` on `main` runs [`.github/workflows/release.yml`](.github/workflows/release.yml). It checks that the tag matches the version, runs lint and tests, builds the package, installs the built wheel in a clean environment to check it, and then publishes:
50
+
51
+ - the package to **PyPI**, with Trusted Publishing (GitHub's OIDC token; no API token is stored anywhere);
52
+ - a multi-arch (amd64, arm64) Docker image to **ghcr.io**, tagged `X.Y.Z`, `X.Y` and `latest`;
53
+ - the server to the **MCP Registry** (`io.github.itssaeedyari/mcp-server-asvs-security-assistant`), after PyPI, because the registry checks the `mcp-name` line in the package README.
54
+
55
+ Running the workflow by hand (**Actions → Release → Run workflow**) is a dry run: it builds, tests and publishes to **TestPyPI** only.
56
+
57
+ **One-time setup**
58
+
59
+ 1. On [pypi.org](https://pypi.org/manage/account/publishing/) add a *pending publisher*: project `mcp-server-asvs-security-assistant`, owner `itssaeedyari`, repository `mcp-server-asvs-security-assistant`, workflow `release.yml`, environment `pypi`. Do the same on [test.pypi.org](https://test.pypi.org/manage/account/publishing/) with environment `testpypi`.
60
+ 2. In the repository's **Settings → Environments**, create `pypi` and `testpypi`. Limit `pypi` to tags matching `v*` and, if you like, require your approval before it runs.
61
+ 3. After the first release, open the `mcp-server-asvs-security-assistant` package under your GitHub profile's **Packages**, make it public, and link it to this repository.
62
+ 4. The MCP Registry needs no setup: the workflow's GitHub login proves you own the `io.github.itssaeedyari/` namespace.
63
+
64
+ **Each release**
65
+
66
+ 1. Bump the version in `pyproject.toml` and in both `version` fields of `server.json`, then run `uv lock`. `tests/test_release_metadata.py` fails if they disagree.
67
+ 2. Optionally do the dry run, then try the package from TestPyPI: `uvx --index https://test.pypi.org/simple/ --index-strategy unsafe-best-match mcp-server-asvs-security-assistant@X.Y.Z`.
68
+ 3. Publish the GitHub release for tag `vX.Y.Z` on `main`. PyPI never accepts the same version twice, so a fix after publishing needs a new patch version.
69
+
70
+ ## Setup
71
+
72
+ ```bash
73
+ uv sync --all-extras
74
+ ```
75
+
76
+ There is no dataset to build or download: the ASVS file is part of the package.
77
+
78
+ ## Checks
79
+
80
+ Run these before opening a pull request. CI runs the same ones on Python 3.11 and 3.13.
81
+
82
+ ```bash
83
+ uv run ruff check .
84
+ uv run pytest
85
+ ```
86
+
87
+ ## Adding a scanner rule
88
+
89
+ Scanners live in `src/asvs_mcp/scanners/`:
90
+
91
+ | File | Checks |
92
+ |---|---|
93
+ | `code_scanner.py` | Source code and config files: injection, deserialization, XXE, TLS and JWT verification, randomness, cryptography, secrets, cookies, CORS, debug mode, sensitive logging |
94
+ | `web_scanner.py` | Raw HTTP response headers and nginx configuration |
95
+ | `repo_scanner.py` | Walks a folder and routes files to the scanners above |
96
+
97
+ 1. **Most code rules are one `Rule(...)` entry** in `RULES` in `code_scanner.py`: a regex, severity, ASVS ID, CWE, description, remediation, and optionally the languages it applies to, an `unless` pattern that suppresses it and a `context` pattern it needs. Rules that need more context (cryptography, secrets, cookies, logging) are functions in the same file.
98
+ 2. **Use fixed text.** `issue_description` and `remediation_step` must be text written by you. Never put values from the scanned input in them: code, header values and file names belong in `evidence` or `location`, which are wrapped in `<scanned_artifact>` tags so a model treats them as data, not instructions.
99
+ 3. **Map to the most specific requirement.** Use the ASVS 5.0.0 ID whose requirement actually covers the issue and the closest CWE, and explain the choice in the pull request. `finding()` looks up the level from the bundled standard, and a test checks that every ID in the scanners exists.
100
+ 4. **Pick a severity:** `critical` for exposed keys, `high` for directly exploitable weaknesses, `medium` for weaknesses that need more conditions or for hardening gaps, `low` for defense in depth and informational issues.
101
+ 5. **Test both directions.** Add the vulnerable line to `test_rule_fires` and the safe form to `test_safe_code_is_quiet` in `tests/test_code_scanner.py` (or the equivalent in `tests/test_web_scanner.py`). When a rule could misfire on common safe code, add that case too. Use obviously fake secrets.
102
+ 6. **Watch the regex pitfall** the existing rules avoid: in a negative lookahead for "not a plain string", put the whitespace inside it (`\((?!\s*"...")`), or a space before the string defeats the check.
103
+ 7. **Update the rule tables** in the README's Scanner rules section.
104
+
105
+ ## Changing the PCI DSS mapping
106
+
107
+ `src/asvs_mcp/data/pci_dss_mapping.json` maps PCI DSS v4.0.1 requirement IDs to the ASVS 5.0.0 requirements that help meet them. Scanner findings get their `pci_dss_ids` from it, so a change here changes findings too.
108
+
109
+ 1. **IDs only.** Map a PCI DSS control (`"6.2.4"`) to a list of ASVS IDs. Map only what is clearly about the same control, and explain each change in the pull request with the reasoning in your own words.
110
+ 2. **Notes for disagreements.** When the standards conflict or PCI DSS is stricter, add a note under `notes` with a `kind` (`conflict`, `pci_stricter` or `pci_only`), the ASVS IDs involved and a short text (under 500 characters) that says how to meet both. Paraphrase; never quote PCI SSC text.
111
+ 3. **Check the IDs.** `tests/test_pci_mapping.py` checks that every ASVS ID exists and that PCI DSS IDs are well formed. If you have built the PCI DSS dataset locally with the [PCI DSS compliance assistant](https://github.com/itssaeedyari/mcp-server-pci-dss-compliance-assistant), also check that the PCI DSS IDs exist:
112
+
113
+ ```bash
114
+ PCI_DSS_DATA_PATH=/path/to/mcp-server-pci-dss-compliance-assistant/data/processed/pci_dss_v4_0_1.json uv run pytest tests/test_pci_mapping.py
115
+ ```
116
+
117
+ 4. **Keep the PCI DSS server consistent.** Its scanner findings carry `asvs_requirement_ids`. If you remap an ASVS requirement that one of its rules uses, open a matching issue there.
118
+
119
+ ## Keeping the server read-only
120
+
121
+ No file writes, network calls or subprocesses in `src/`. `tests/test_read_only.py` enforces this. Every tool goes through the `@tool` decorator in `server.py`, which applies the input caps from `security.py`, sanitizes the result and writes the audit log.
122
+
123
+ ## Updating to a new ASVS release (maintainers)
124
+
125
+ 1. Download the release's English CSV from [OWASP/ASVS](https://github.com/OWASP/ASVS) at its release tag and replace the file in `src/asvs_mcp/data/` (keep OWASP's file name).
126
+ 2. Update `VERSION` in `src/asvs_mcp/asvs.py`, `OFFICIAL_SHA256` and the counts in `tests/test_data.py`, `NOTICE` and `src/asvs_mcp/data/README.md`.
127
+ 3. Requirement IDs can change between releases: recheck every ID used in code, tests and documentation.
128
+
129
+ ## Pull requests
130
+
131
+ - Keep each pull request focused on one change, with tests.
132
+ - Do not commit generated files, local configs or secrets.
133
+ - By contributing, you agree that your contributions are licensed under the [Apache License 2.0](LICENSE).
@@ -0,0 +1,24 @@
1
+ # syntax=docker/dockerfile:1
2
+ # OWASP ASVS security assistant MCP server over stdio.
3
+ # The image includes the bundled OWASP ASVS 5.0.0 CSV (CC BY-SA 4.0, see NOTICE). It needs no network or write
4
+ # access at run time. For audit_directory, mount the project to scan read-only at /workspace. See README.md.
5
+
6
+ FROM python:3.11-slim AS build
7
+ COPY --from=ghcr.io/astral-sh/uv:0.12.19 /uv /bin/uv
8
+ ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy UV_PYTHON_DOWNLOADS=never UV_PROJECT_ENVIRONMENT=/opt/venv
9
+ WORKDIR /src
10
+ COPY pyproject.toml uv.lock ./
11
+ RUN uv sync --locked --no-install-project --no-editable
12
+ COPY README.md LICENSE NOTICE ./
13
+ COPY src ./src
14
+ RUN uv sync --locked --no-editable
15
+
16
+ FROM python:3.11-slim
17
+ RUN useradd --create-home --uid 10001 --shell /usr/sbin/nologin appuser && mkdir /workspace
18
+ COPY --from=build /opt/venv /opt/venv
19
+ ENV PATH="/opt/venv/bin:$PATH" \
20
+ PYTHONUNBUFFERED=1 \
21
+ PYTHONDONTWRITEBYTECODE=1
22
+ WORKDIR /app
23
+ USER appuser
24
+ ENTRYPOINT ["asvs-mcp"]
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.