maplewatch-mcp 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 (30) hide show
  1. maplewatch_mcp-0.1.0/.github/workflows/ci.yml +59 -0
  2. maplewatch_mcp-0.1.0/.github/workflows/release.yml +78 -0
  3. maplewatch_mcp-0.1.0/.gitignore +13 -0
  4. maplewatch_mcp-0.1.0/CHANGELOG.md +18 -0
  5. maplewatch_mcp-0.1.0/CONTRIBUTING.md +30 -0
  6. maplewatch_mcp-0.1.0/LICENSE +21 -0
  7. maplewatch_mcp-0.1.0/PKG-INFO +174 -0
  8. maplewatch_mcp-0.1.0/README.md +142 -0
  9. maplewatch_mcp-0.1.0/SECURITY.md +44 -0
  10. maplewatch_mcp-0.1.0/examples/claude_desktop_config.json +11 -0
  11. maplewatch_mcp-0.1.0/examples/docker-compose.socket-proxy.yaml +17 -0
  12. maplewatch_mcp-0.1.0/examples/stack.example.yaml +21 -0
  13. maplewatch_mcp-0.1.0/pyproject.toml +62 -0
  14. maplewatch_mcp-0.1.0/server.json +45 -0
  15. maplewatch_mcp-0.1.0/src/maplewatch/__init__.py +12 -0
  16. maplewatch_mcp-0.1.0/src/maplewatch/advisories.py +200 -0
  17. maplewatch_mcp-0.1.0/src/maplewatch/inventory.py +192 -0
  18. maplewatch_mcp-0.1.0/src/maplewatch/matcher.py +86 -0
  19. maplewatch_mcp-0.1.0/src/maplewatch/server.py +226 -0
  20. maplewatch_mcp-0.1.0/src/maplewatch/sources.py +181 -0
  21. maplewatch_mcp-0.1.0/src/maplewatch/text.py +36 -0
  22. maplewatch_mcp-0.1.0/src/maplewatch/versions.py +224 -0
  23. maplewatch_mcp-0.1.0/tests/conftest.py +224 -0
  24. maplewatch_mcp-0.1.0/tests/test_advisories.py +47 -0
  25. maplewatch_mcp-0.1.0/tests/test_inventory.py +94 -0
  26. maplewatch_mcp-0.1.0/tests/test_live.py +23 -0
  27. maplewatch_mcp-0.1.0/tests/test_matcher.py +52 -0
  28. maplewatch_mcp-0.1.0/tests/test_server.py +132 -0
  29. maplewatch_mcp-0.1.0/tests/test_sources.py +70 -0
  30. maplewatch_mcp-0.1.0/tests/test_versions.py +103 -0
@@ -0,0 +1,59 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ schedule:
8
+ - cron: "17 11 * * 1" # Mondays: the live test catches changes in cyber.gc.ca's format early
9
+
10
+ permissions:
11
+ contents: read
12
+
13
+ jobs:
14
+ test:
15
+ runs-on: ubuntu-latest
16
+ strategy:
17
+ fail-fast: false # report every Python version, not just the first failure
18
+ matrix:
19
+ python: ["3.11", "3.12", "3.13"]
20
+ steps:
21
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
22
+ with:
23
+ persist-credentials: false
24
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
25
+ with:
26
+ python-version: ${{ matrix.python }}
27
+ activate-environment: true
28
+ - run: uv pip install -e ".[dev]"
29
+ - run: ruff check src tests && ruff format --check src tests
30
+ - run: pytest -q
31
+
32
+ live:
33
+ # Real requests to cyber.gc.ca: weekly and on demand only, never on every push.
34
+ if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
35
+ runs-on: ubuntu-latest
36
+ steps:
37
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
38
+ with:
39
+ persist-credentials: false
40
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
41
+ with:
42
+ python-version: "3.13"
43
+ activate-environment: true
44
+ - run: uv pip install -e ".[dev]"
45
+ - run: MAPLEWATCH_LIVE=1 pytest -q -m live
46
+
47
+ secrets:
48
+ runs-on: ubuntu-latest
49
+ steps:
50
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
51
+ with:
52
+ persist-credentials: false
53
+ - name: gitleaks (pinned release, checksum verified)
54
+ run: |
55
+ set -euo pipefail
56
+ curl -sSLO https://github.com/gitleaks/gitleaks/releases/download/v8.28.0/gitleaks_8.28.0_linux_x64.tar.gz
57
+ echo "a65b5253807a68ac0cafa4414031fd740aeb55f54fb7e55f386acb52e6a840eb gitleaks_8.28.0_linux_x64.tar.gz" | sha256sum -c -
58
+ tar xzf gitleaks_8.28.0_linux_x64.tar.gz gitleaks
59
+ ./gitleaks dir . --redact --verbose
@@ -0,0 +1,78 @@
1
+ # Push a tag like v0.1.0 -> tests -> PyPI (trusted publishing, no token) -> MCP Registry (OIDC, no token).
2
+ name: Release
3
+
4
+ on:
5
+ push:
6
+ tags: ["v*"]
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ test:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
16
+ with:
17
+ persist-credentials: false
18
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
19
+ with:
20
+ python-version: "3.13"
21
+ activate-environment: true
22
+ - run: uv pip install -e ".[dev]"
23
+ - run: pytest -q
24
+ - name: Tag, pyproject.toml and server.json must agree
25
+ run: |
26
+ set -euo pipefail
27
+ tag="${GITHUB_REF_NAME#v}"
28
+ py=$(python -c "import tomllib;print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
29
+ sj=$(python -c "import json;d=json.load(open('server.json'));print(d['version'], d['packages'][0]['version'])")
30
+ test "$py" = "$tag" && test "$sj" = "$tag $tag" || { echo "version mismatch: tag=$tag pyproject=$py server.json=$sj"; exit 1; }
31
+
32
+ pypi:
33
+ needs: test
34
+ runs-on: ubuntu-latest
35
+ environment: pypi
36
+ permissions:
37
+ id-token: write # PyPI trusted publishing
38
+ steps:
39
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
40
+ with:
41
+ persist-credentials: false
42
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
43
+ - run: uv build
44
+ - uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
45
+
46
+ mcp-registry:
47
+ needs: pypi
48
+ runs-on: ubuntu-latest
49
+ permissions:
50
+ id-token: write # MCP Registry login (github-oidc)
51
+ contents: read
52
+ env:
53
+ MCP_PUBLISHER_VERSION: v1.8.9
54
+ steps:
55
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
56
+ with:
57
+ persist-credentials: false
58
+ - uses: sigstore/cosign-installer@756fe2d284c7292c4e9b62c8a28f1e5629c59532 # v4.1.3
59
+ - name: Download and verify mcp-publisher
60
+ run: |
61
+ set -euo pipefail
62
+ archive="mcp-publisher_linux_amd64.tar.gz"
63
+ base="https://github.com/modelcontextprotocol/registry/releases/download/${MCP_PUBLISHER_VERSION}"
64
+ curl -fsSL -o "$archive" "$base/$archive"
65
+ curl -fsSL -o "$archive.sigstore.json" "$base/$archive.sigstore.json"
66
+ cosign verify-blob --bundle "$archive.sigstore.json" \
67
+ --certificate-identity "https://github.com/modelcontextprotocol/registry/.github/workflows/release.yml@refs/tags/${MCP_PUBLISHER_VERSION}" \
68
+ --certificate-oidc-issuer "https://token.actions.githubusercontent.com" "$archive"
69
+ tar xzf "$archive" mcp-publisher
70
+ - name: Wait for the new version on PyPI
71
+ run: |
72
+ for i in $(seq 1 30); do
73
+ curl -fsS "https://pypi.org/pypi/maplewatch-mcp/${GITHUB_REF_NAME#v}/json" >/dev/null && exit 0
74
+ sleep 10
75
+ done
76
+ exit 1
77
+ - run: ./mcp-publisher login github-oidc
78
+ - run: ./mcp-publisher publish
@@ -0,0 +1,13 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ dist/
5
+ build/
6
+ *.egg-info/
7
+ .pytest_cache/
8
+ .ruff_cache/
9
+ .coverage
10
+ .env
11
+ # your real inventory stays local; commit only the example
12
+ stack.yaml
13
+ *.sbom.json
@@ -0,0 +1,18 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 (unreleased)
4
+
5
+ First release.
6
+
7
+ - Five read-only MCP tools: `maplewatch_check_stack`, `maplewatch_latest`, `maplewatch_search`, `maplewatch_get`,
8
+ `maplewatch_my_stack`. English and French.
9
+ - Data: the full Cyber Centre advisory archive (2016 onwards) plus the Atom feed, cached on disk
10
+ (archive daily, feed every 15 minutes), with an offline fallback.
11
+ - Version rules: "prior to", "prior to or equal to", "and prior", ranges, release lines (`15.x versions prior to
12
+ 15.2.3`), lists of fixes per release line, exact versions, "all versions", in English and French.
13
+ Vendor version schemes near a boundary are reported as "check".
14
+ - Inventory: stack file (YAML/JSON), CycloneDX SBOMs, Docker (labels, `<APP>_VERSION`, tags) through
15
+ a read-only socket proxy.
16
+ - `maplewatch-mcp --report` for terminals, cron and n8n.
17
+ - Security: host allowlist incl. redirects, no path/URL tool arguments, text sanitising, ReDoS-safe parsing,
18
+ response size cap, threat model in SECURITY.md.
@@ -0,0 +1,30 @@
1
+ # Contributing
2
+
3
+ Thanks for helping. maplewatch is small on purpose: read-only, one data source, honest about uncertainty.
4
+ Contributions that keep it that way are very welcome.
5
+
6
+ ## Getting set up
7
+
8
+ ```bash
9
+ git clone https://github.com/PacketSnifferHK/maplewatch-mcp && cd maplewatch-mcp
10
+ uv venv && uv pip install -e ".[dev]"
11
+ pytest && ruff check src tests && ruff format --check src tests
12
+ ```
13
+
14
+ `pytest` never touches the network. `MAPLEWATCH_LIVE=1 pytest -m live` checks the parser against today's real advisories.
15
+
16
+ ## Good first issues
17
+
18
+ - **A version phrasing maplewatch reports as "can't tell"** but a human can read. Add the real sentence to the
19
+ table in `tests/test_versions.py` first, then make it pass in `src/maplewatch/versions.py`.
20
+ - **A new inventory source:** Proxmox (`pveversion`), Kubernetes images, `dpkg -l`, Homebrew. Same rules as
21
+ the existing ones: location from an environment variable, read-only, size-limited.
22
+ - **Output formats** for `--report`: Markdown, JSON, SARIF.
23
+
24
+ ## Rules of the road
25
+
26
+ - **No write, exec or network tools.** If a feature needs one, open an issue first so we can talk about it.
27
+ - **No guessing.** When the data is ambiguous, the answer is "check" with a reason.
28
+ - **Tests with real wording.** Paste the real advisory phrase (with its serial in a comment), not an invented one.
29
+ - **Security-relevant changes** update the table in `SECURITY.md`.
30
+ - One logical change per pull request, with a short description of the user-visible effect.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Harsh Kapoor
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,174 @@
1
+ Metadata-Version: 2.5
2
+ Name: maplewatch-mcp
3
+ Version: 0.1.0
4
+ Summary: Unofficial MCP server that checks Canadian Cyber Centre security advisories against the software you actually run.
5
+ Project-URL: Homepage, https://github.com/PacketSnifferHK/maplewatch-mcp
6
+ Project-URL: Issues, https://github.com/PacketSnifferHK/maplewatch-mcp/issues
7
+ Project-URL: Security, https://github.com/PacketSnifferHK/maplewatch-mcp/blob/main/SECURITY.md
8
+ Author: Harsh Kapoor
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: advisories,canada,cyber-centre,mcp,model-context-protocol,security,vulnerability
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Information Technology
14
+ Classifier: Intended Audience :: System Administrators
15
+ Classifier: Natural Language :: English
16
+ Classifier: Natural Language :: French
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Topic :: Security
19
+ Classifier: Topic :: System :: Monitoring
20
+ Requires-Python: >=3.11
21
+ Requires-Dist: beautifulsoup4<5,>=4.12
22
+ Requires-Dist: defusedxml<1,>=0.7
23
+ Requires-Dist: httpx<1,>=0.28
24
+ Requires-Dist: mcp<3,>=2.3
25
+ Requires-Dist: platformdirs<5,>=4
26
+ Requires-Dist: pyyaml<7,>=6
27
+ Provides-Extra: dev
28
+ Requires-Dist: anyio>=4; extra == 'dev'
29
+ Requires-Dist: pytest>=8; extra == 'dev'
30
+ Requires-Dist: ruff>=0.6; extra == 'dev'
31
+ Description-Content-Type: text/markdown
32
+
33
+ # maplewatch 🍁
34
+
35
+ **Which Canadian Cyber Centre security advisories actually affect the software you run?**
36
+
37
+ The Canadian Centre for Cyber Security published over 1,190 advisories in 2026 alone, three or four
38
+ every day. Nobody can read them all. maplewatch is an [MCP](https://modelcontextprotocol.io) server
39
+ (and a small CLI) that checks every advisory against your own stack: a short YAML file, your SBOMs,
40
+ or your running Docker containers. It tells you which ones hit you, which version fixes them, and why.
41
+
42
+ <!-- mcp-name: io.github.PacketSnifferHK/maplewatch-mcp -->
43
+
44
+ > **Unofficial.** maplewatch is not affiliated with or endorsed by the Canadian Centre for Cyber
45
+ > Security, the Communications Security Establishment, or the Government of Canada. It reads their
46
+ > public advisories and links back to each one. Always confirm on the linked advisory before acting.
47
+
48
+ ```text
49
+ $ maplewatch-mcp --report
50
+ maplewatch 0.1.0: 1304 Cyber Centre advisories since 2025-11-17, 8 pieces of software checked
51
+
52
+ AFFECTED AV26-1168 GitLab 19.5.5 (GitLab) 19.5.5 is on the 19.5.x line, fixed in 19.5.6
53
+ https://www.cyber.gc.ca/en/alerts-advisories/gitlab-security-advisory-av26-1168
54
+ AFFECTED AV26-285 Grafana 12.2.0 (Grafana) 12.2.0 is on the 12.2.x line, fixed in 12.2.8
55
+ https://www.cyber.gc.ca/en/alerts-advisories/grafana-security-advisory-av26-285
56
+ AFFECTED AV26-1075 Roundcube 1.6.14 (Roundcube Webmail) 1.6.14 is on the 1.6.x line, fixed in 1.6.20
57
+ https://www.cyber.gc.ca/en/alerts-advisories/roundcube-security-advisory-av26-1075
58
+ CHECK AV26-584 n8n 1.120.4 (n8n (Credential Exfiltration)) ... these aren't machine-readable: multiple versions
59
+ ...
60
+ 58 name matches ruled out by version.
61
+ ```
62
+ *(Output from [`examples/stack.example.yaml`](examples/stack.example.yaml), shortened.)*
63
+
64
+ ## What it does
65
+
66
+ - **Reads the whole archive.** Every advisory since 2016 comes from the same public endpoint cyber.gc.ca's
67
+ own advisories page uses, plus the Atom feed for anything published in the last few minutes. Both English and French.
68
+ - **Understands how advisories describe versions.** "Prior to 19.5.6", "versions 0.123.0 to versions prior
69
+ to 1.121.3", "15.x versions prior to 15.2.3", "Versions antérieures à la version 3.1.2, 3.0.9 et 2.9.14", and
70
+ maintained release lines: GitLab 19.4.7 is checked against the 19.4 fix, not the 19.5 one.
71
+ - **Never guesses.** When the advisory says "multiple versions", when a vendor uses its own scheme
72
+ (`22.7R2.5`), or when your image is `:latest`, the answer is **check**, with the reason. It doesn't
73
+ invent a yes or a no.
74
+ - **Read-only, everywhere.** No tool writes, executes or deletes anything. See [SECURITY.md](SECURITY.md).
75
+
76
+ ## Quick start
77
+
78
+ 1. List what you run (or skip this and use Docker discovery or SBOMs, below):
79
+
80
+ ```yaml
81
+ # ~/maplewatch/stack.yaml
82
+ software:
83
+ - name: GitLab
84
+ version: 19.5.5
85
+ - name: Roundcube
86
+ version: 1.6.14
87
+ aliases: [Roundcube Webmail]
88
+ ```
89
+
90
+ 2. Try it from a terminal (needs [uv](https://docs.astral.sh/uv/)):
91
+
92
+ ```bash
93
+ MAPLEWATCH_STACK=~/maplewatch/stack.yaml uvx maplewatch-mcp --report # English
94
+ MAPLEWATCH_STACK=~/maplewatch/stack.yaml uvx maplewatch-mcp --report --lang fr # français
95
+ ```
96
+
97
+ 3. Add it to your MCP client (Claude Desktop shown; any MCP client works):
98
+
99
+ ```json
100
+ {
101
+ "mcpServers": {
102
+ "maplewatch": {
103
+ "command": "uvx",
104
+ "args": ["maplewatch-mcp"],
105
+ "env": { "MAPLEWATCH_STACK": "/Users/you/maplewatch/stack.yaml" }
106
+ }
107
+ }
108
+ }
109
+ ```
110
+
111
+ Then ask: *"Which Cyber Centre advisories affect my stack this year?"*
112
+
113
+ The first run downloads the archive (about 2 MB compressed) and takes about 10 seconds. After that it starts
114
+ from a local cache in under a second.
115
+
116
+ ## Tools
117
+
118
+ | Tool | What it answers |
119
+ |---|---|
120
+ | `maplewatch_check_stack` | Which advisories affect my software? (`days`: look-back window, default 365) |
121
+ | `maplewatch_latest` | The newest alerts and advisories, optionally for one vendor |
122
+ | `maplewatch_search` | Every advisory since 2016 mentioning a product, vendor or CVE id |
123
+ | `maplewatch_get` | One advisory in detail: affected products and versions, CVEs, vendor links |
124
+ | `maplewatch_my_stack` | What maplewatch thinks you run, and which entries can't be compared |
125
+
126
+ All five are marked `readOnlyHint: true`. Everything takes a `lang` of `en` or `fr`.
127
+
128
+ ## What you run: three sources
129
+
130
+ | Source | Turn it on with | Notes |
131
+ |---|---|---|
132
+ | Stack file | `MAPLEWATCH_STACK=/path/stack.yaml` | `software: [{name, version, aliases}]` or a plain `name: version` map |
133
+ | SBOMs | `MAPLEWATCH_SBOM=/path/a.json,/path/b.json` | CycloneDX JSON from `syft`, `trivy`, ... |
134
+ | Docker | `MAPLEWATCH_DOCKER=1` | Reads the version from image labels, `<APP>_VERSION` env vars, or the tag |
135
+
136
+ For Docker, point `DOCKER_HOST` at a **read-only socket proxy** instead of the raw socket. See
137
+ [`examples/docker-compose.socket-proxy.yaml`](examples/docker-compose.socket-proxy.yaml).
138
+
139
+ **About `:latest`:** an image tagged `latest` with no version label has no version maplewatch can compare,
140
+ so it can only ever say "check". Pinning image versions is good practice anyway: you can't patch what you
141
+ can't identify.
142
+
143
+ ## How a verdict is reached
144
+
145
+ 1. **Name match.** *exact* (`GitLab` = `GitLab`), *likely* (the advisory's vendor is the software you
146
+ listed, e.g. Roundcube's advisory for "Webmail"), or *possible* (your name is only part of the product name).
147
+ 2. **Version check** against the advisory's affected versions.
148
+ 3. **Result.** **affected** = a confident name match and a version inside an affected range. **check** = a
149
+ human should look. A match ruled out by version is counted, not shown.
150
+
151
+ ## Data and fair use
152
+
153
+ - Advisory data © Government of Canada (Communications Security Establishment), used under its
154
+ [terms](https://www.cse-cst.gc.ca/en/about-apropos/terms-and-conditions) for non-commercial reproduction with
155
+ attribution. Every result carries the source and a link to the original advisory.
156
+ - Polite by design: the archive is fetched at most once a day, the feed at most every 15 minutes, with an
157
+ identifying User-Agent. If the site is down, maplewatch serves its cache and says so.
158
+ - No telemetry. Nothing about your stack leaves your machine; the only outbound requests go to `www.cyber.gc.ca`.
159
+
160
+ ## Development
161
+
162
+ ```bash
163
+ uv venv && uv pip install -e ".[dev]"
164
+ pytest # offline suite, no network
165
+ MAPLEWATCH_LIVE=1 pytest -m live # against the real cyber.gc.ca
166
+ ruff check src tests && ruff format --check src tests
167
+ ```
168
+
169
+ See [CONTRIBUTING.md](CONTRIBUTING.md). Good first issues: more version phrasings, more inventory sources
170
+ (Proxmox, Kubernetes, `dpkg -l`), and output formats (Markdown, SARIF).
171
+
172
+ ## License
173
+
174
+ MIT for the code. Advisory content belongs to the Government of Canada; see *Data and fair use*.
@@ -0,0 +1,142 @@
1
+ # maplewatch 🍁
2
+
3
+ **Which Canadian Cyber Centre security advisories actually affect the software you run?**
4
+
5
+ The Canadian Centre for Cyber Security published over 1,190 advisories in 2026 alone, three or four
6
+ every day. Nobody can read them all. maplewatch is an [MCP](https://modelcontextprotocol.io) server
7
+ (and a small CLI) that checks every advisory against your own stack: a short YAML file, your SBOMs,
8
+ or your running Docker containers. It tells you which ones hit you, which version fixes them, and why.
9
+
10
+ <!-- mcp-name: io.github.PacketSnifferHK/maplewatch-mcp -->
11
+
12
+ > **Unofficial.** maplewatch is not affiliated with or endorsed by the Canadian Centre for Cyber
13
+ > Security, the Communications Security Establishment, or the Government of Canada. It reads their
14
+ > public advisories and links back to each one. Always confirm on the linked advisory before acting.
15
+
16
+ ```text
17
+ $ maplewatch-mcp --report
18
+ maplewatch 0.1.0: 1304 Cyber Centre advisories since 2025-11-17, 8 pieces of software checked
19
+
20
+ AFFECTED AV26-1168 GitLab 19.5.5 (GitLab) 19.5.5 is on the 19.5.x line, fixed in 19.5.6
21
+ https://www.cyber.gc.ca/en/alerts-advisories/gitlab-security-advisory-av26-1168
22
+ AFFECTED AV26-285 Grafana 12.2.0 (Grafana) 12.2.0 is on the 12.2.x line, fixed in 12.2.8
23
+ https://www.cyber.gc.ca/en/alerts-advisories/grafana-security-advisory-av26-285
24
+ AFFECTED AV26-1075 Roundcube 1.6.14 (Roundcube Webmail) 1.6.14 is on the 1.6.x line, fixed in 1.6.20
25
+ https://www.cyber.gc.ca/en/alerts-advisories/roundcube-security-advisory-av26-1075
26
+ CHECK AV26-584 n8n 1.120.4 (n8n (Credential Exfiltration)) ... these aren't machine-readable: multiple versions
27
+ ...
28
+ 58 name matches ruled out by version.
29
+ ```
30
+ *(Output from [`examples/stack.example.yaml`](examples/stack.example.yaml), shortened.)*
31
+
32
+ ## What it does
33
+
34
+ - **Reads the whole archive.** Every advisory since 2016 comes from the same public endpoint cyber.gc.ca's
35
+ own advisories page uses, plus the Atom feed for anything published in the last few minutes. Both English and French.
36
+ - **Understands how advisories describe versions.** "Prior to 19.5.6", "versions 0.123.0 to versions prior
37
+ to 1.121.3", "15.x versions prior to 15.2.3", "Versions antérieures à la version 3.1.2, 3.0.9 et 2.9.14", and
38
+ maintained release lines: GitLab 19.4.7 is checked against the 19.4 fix, not the 19.5 one.
39
+ - **Never guesses.** When the advisory says "multiple versions", when a vendor uses its own scheme
40
+ (`22.7R2.5`), or when your image is `:latest`, the answer is **check**, with the reason. It doesn't
41
+ invent a yes or a no.
42
+ - **Read-only, everywhere.** No tool writes, executes or deletes anything. See [SECURITY.md](SECURITY.md).
43
+
44
+ ## Quick start
45
+
46
+ 1. List what you run (or skip this and use Docker discovery or SBOMs, below):
47
+
48
+ ```yaml
49
+ # ~/maplewatch/stack.yaml
50
+ software:
51
+ - name: GitLab
52
+ version: 19.5.5
53
+ - name: Roundcube
54
+ version: 1.6.14
55
+ aliases: [Roundcube Webmail]
56
+ ```
57
+
58
+ 2. Try it from a terminal (needs [uv](https://docs.astral.sh/uv/)):
59
+
60
+ ```bash
61
+ MAPLEWATCH_STACK=~/maplewatch/stack.yaml uvx maplewatch-mcp --report # English
62
+ MAPLEWATCH_STACK=~/maplewatch/stack.yaml uvx maplewatch-mcp --report --lang fr # français
63
+ ```
64
+
65
+ 3. Add it to your MCP client (Claude Desktop shown; any MCP client works):
66
+
67
+ ```json
68
+ {
69
+ "mcpServers": {
70
+ "maplewatch": {
71
+ "command": "uvx",
72
+ "args": ["maplewatch-mcp"],
73
+ "env": { "MAPLEWATCH_STACK": "/Users/you/maplewatch/stack.yaml" }
74
+ }
75
+ }
76
+ }
77
+ ```
78
+
79
+ Then ask: *"Which Cyber Centre advisories affect my stack this year?"*
80
+
81
+ The first run downloads the archive (about 2 MB compressed) and takes about 10 seconds. After that it starts
82
+ from a local cache in under a second.
83
+
84
+ ## Tools
85
+
86
+ | Tool | What it answers |
87
+ |---|---|
88
+ | `maplewatch_check_stack` | Which advisories affect my software? (`days`: look-back window, default 365) |
89
+ | `maplewatch_latest` | The newest alerts and advisories, optionally for one vendor |
90
+ | `maplewatch_search` | Every advisory since 2016 mentioning a product, vendor or CVE id |
91
+ | `maplewatch_get` | One advisory in detail: affected products and versions, CVEs, vendor links |
92
+ | `maplewatch_my_stack` | What maplewatch thinks you run, and which entries can't be compared |
93
+
94
+ All five are marked `readOnlyHint: true`. Everything takes a `lang` of `en` or `fr`.
95
+
96
+ ## What you run: three sources
97
+
98
+ | Source | Turn it on with | Notes |
99
+ |---|---|---|
100
+ | Stack file | `MAPLEWATCH_STACK=/path/stack.yaml` | `software: [{name, version, aliases}]` or a plain `name: version` map |
101
+ | SBOMs | `MAPLEWATCH_SBOM=/path/a.json,/path/b.json` | CycloneDX JSON from `syft`, `trivy`, ... |
102
+ | Docker | `MAPLEWATCH_DOCKER=1` | Reads the version from image labels, `<APP>_VERSION` env vars, or the tag |
103
+
104
+ For Docker, point `DOCKER_HOST` at a **read-only socket proxy** instead of the raw socket. See
105
+ [`examples/docker-compose.socket-proxy.yaml`](examples/docker-compose.socket-proxy.yaml).
106
+
107
+ **About `:latest`:** an image tagged `latest` with no version label has no version maplewatch can compare,
108
+ so it can only ever say "check". Pinning image versions is good practice anyway: you can't patch what you
109
+ can't identify.
110
+
111
+ ## How a verdict is reached
112
+
113
+ 1. **Name match.** *exact* (`GitLab` = `GitLab`), *likely* (the advisory's vendor is the software you
114
+ listed, e.g. Roundcube's advisory for "Webmail"), or *possible* (your name is only part of the product name).
115
+ 2. **Version check** against the advisory's affected versions.
116
+ 3. **Result.** **affected** = a confident name match and a version inside an affected range. **check** = a
117
+ human should look. A match ruled out by version is counted, not shown.
118
+
119
+ ## Data and fair use
120
+
121
+ - Advisory data © Government of Canada (Communications Security Establishment), used under its
122
+ [terms](https://www.cse-cst.gc.ca/en/about-apropos/terms-and-conditions) for non-commercial reproduction with
123
+ attribution. Every result carries the source and a link to the original advisory.
124
+ - Polite by design: the archive is fetched at most once a day, the feed at most every 15 minutes, with an
125
+ identifying User-Agent. If the site is down, maplewatch serves its cache and says so.
126
+ - No telemetry. Nothing about your stack leaves your machine; the only outbound requests go to `www.cyber.gc.ca`.
127
+
128
+ ## Development
129
+
130
+ ```bash
131
+ uv venv && uv pip install -e ".[dev]"
132
+ pytest # offline suite, no network
133
+ MAPLEWATCH_LIVE=1 pytest -m live # against the real cyber.gc.ca
134
+ ruff check src tests && ruff format --check src tests
135
+ ```
136
+
137
+ See [CONTRIBUTING.md](CONTRIBUTING.md). Good first issues: more version phrasings, more inventory sources
138
+ (Proxmox, Kubernetes, `dpkg -l`), and output formats (Markdown, SARIF).
139
+
140
+ ## License
141
+
142
+ MIT for the code. Advisory content belongs to the Government of Canada; see *Data and fair use*.
@@ -0,0 +1,44 @@
1
+ # Security
2
+
3
+ ## Reporting a vulnerability
4
+
5
+ Please use GitHub's **private vulnerability reporting** (Security tab → *Report a vulnerability*). Don't open
6
+ a public issue. You'll get a reply within 7 days. maplewatch has no servers or user data of its own; the
7
+ realistic risks are in what it reads and what it returns to a model, described below.
8
+
9
+ ## Threat model
10
+
11
+ maplewatch sits between three things it doesn't control: **a model** that calls its tools, **the internet**
12
+ (advisory text), and **your machine** (files and Docker). The design rule: maplewatch only reads, and only
13
+ from places the person who installed it chose.
14
+
15
+ ### What it can and can't do
16
+
17
+ | Can | Can't |
18
+ |---|---|
19
+ | HTTPS GET to `www.cyber.gc.ca` (two endpoints) | Contact any other host, including after a redirect |
20
+ | Read the stack file and SBOMs named in its environment | Read a path a model asks for: no tool takes a path or URL |
21
+ | `GET /containers/json` and `GET /images/{sha256}/json` on Docker, if enabled | Start, stop, exec or change anything in Docker |
22
+ | Write its own cache (one JSON file per language) | Write anywhere else, or run commands |
23
+
24
+ ### Threats and mitigations
25
+
26
+ | # | Threat | Mitigation | Tested in |
27
+ |---|---|---|---|
28
+ | 1 | **Prompt injection via advisory text.** A product name or vendor link title says "ignore previous instructions…". Advisory text is written by vendors and copied by the Cyber Centre, so it can't be fully trusted. | All internet text goes through `clean()`: HTML stripped; zero-width and bidi-override characters removed; length capped (product names 200 chars). It's returned in labelled data fields, and the server instructions tell the model it's data. There is **no tool that could act** on an injected instruction: every tool is read-only. | `test_server.py::test_prompt_injection_in_advisory_text_stays_data` |
29
+ | 2 | **SSRF / data exfiltration.** A model is tricked into making maplewatch fetch an attacker's URL. | No tool accepts a URL or path. Advisories are looked up by validated serial (`^[A-Z]{2}\d{2}-\d{1,5}$`). An httpx request hook rejects every request, redirects included, that isn't `https://www.cyber.gc.ca`. | `test_sources.py::test_redirects_off_site_are_blocked`, `::test_only_https_cyber_centre_is_allowed`, `test_server.py::test_bad_input_is_rejected` |
30
+ | 3 | **Arbitrary file read.** A model asks to "check the stack at /etc/shadow". | Inventory locations come only from environment variables set at install time. Files over 5 MB are refused. YAML is parsed with `safe_load` (no object construction). | `test_inventory.py::test_stack_file_is_not_executed` |
31
+ | 4 | **Docker socket = root.** The raw socket allows anything. | Only two GET endpoints, image ids validated as `sha256:<64 hex>`, and the docs recommend a read-only socket proxy with `POST=0`. | `test_inventory.py::test_docker_discovery_reads_labels_env_and_tags` |
32
+ | 5 | **ReDoS.** Hostile advisory text with a long run of version numbers freezes the parser. | **Found in development:** an early version regex backtracked catastrophically on long lists (a test run hung for minutes). Fixed with possessive quantifiers (linear time) plus a 200-char cap per rule. Digit strings over 12 characters are never converted to integers. | `test_versions.py::test_no_catastrophic_backtracking` |
33
+ | 6 | **Oversized or malformed responses.** | 60 MB response cap while streaming, 30 s timeout, `defusedxml` for the Atom feed, and an unexpected archive shape is an error, not a crash. | `test_sources.py::test_response_size_cap` |
34
+ | 7 | **Wrong answers that look confident.** A bad "not affected" is worse than no tool. | Uncertainty is a first-class result: unreadable wording, vendor version schemes near a boundary, `:latest` images and partial name matches all become **check**, with the reason. The archive's vendor tag is overridden by the title because it's sometimes wrong (a GitHub incident tagged "gitlab"). Every finding links to the official advisory. | `test_versions.py` (40+ real phrasings), `test_matcher.py::test_mislabelled_alert_does_not_match` |
35
+ | 8 | **Stale data during an outage.** | The disk cache is served with an explicit warning in every response. With no cache, the tool returns a clear error instead of an empty "all clear". | `test_sources.py::test_disk_cache_survives_restart_and_offline`, `test_server.py::test_data_outage_is_a_clear_tool_error` |
36
+ | 9 | **Supply chain.** | Every GitHub Action is pinned to a commit SHA. PyPI releases use trusted publishing (no stored token). The `mcp-publisher` binary is verified with cosign before use. gitleaks runs on every push. Dependencies have upper bounds. | CI |
37
+ | 10 | **Misrepresenting the government.** | "Unofficial" appears in the package description, README, server instructions and every tool response. No government name or symbol in the project name, and no logo. | — |
38
+
39
+ ### Out of scope
40
+
41
+ - The correctness of the Cyber Centre's advisories themselves.
42
+ - A compromised machine running maplewatch (it runs with the user's own permissions).
43
+ - Model behaviour outside maplewatch's tools: an MCP client that lets a model run shell commands is a risk
44
+ regardless of maplewatch.
@@ -0,0 +1,11 @@
1
+ {
2
+ "mcpServers": {
3
+ "maplewatch": {
4
+ "command": "uvx",
5
+ "args": ["maplewatch-mcp"],
6
+ "env": {
7
+ "MAPLEWATCH_STACK": "/Users/you/maplewatch/stack.yaml"
8
+ }
9
+ }
10
+ }
11
+ }
@@ -0,0 +1,17 @@
1
+ # Let maplewatch see your containers without giving it the Docker socket.
2
+ # The proxy only answers GET /containers and GET /images; POST (start, stop, exec...) is off by default.
3
+ #
4
+ # docker compose -f docker-compose.socket-proxy.yaml up -d
5
+ # then run maplewatch with: MAPLEWATCH_DOCKER=1 DOCKER_HOST=tcp://127.0.0.1:2375
6
+ services:
7
+ docker-proxy:
8
+ image: tecnativa/docker-socket-proxy:v0.6.0
9
+ restart: unless-stopped
10
+ environment:
11
+ CONTAINERS: 1
12
+ IMAGES: 1
13
+ POST: 0
14
+ volumes:
15
+ - /var/run/docker.sock:/var/run/docker.sock:ro
16
+ ports:
17
+ - "127.0.0.1:2375:2375" # localhost only, never on the LAN
@@ -0,0 +1,21 @@
1
+ # Example inventory. Replace the versions with yours (`docker image inspect`, `pveversion`, app "About" pages).
2
+ # Name is what you call it; aliases help match how vendors write it.
3
+ software:
4
+ - name: GitLab
5
+ version: 19.5.5
6
+ - name: Grafana
7
+ version: 12.2.0
8
+ - name: n8n
9
+ version: 1.120.4
10
+ - name: Roundcube
11
+ version: 1.6.14
12
+ aliases: [Roundcube Webmail]
13
+ - name: Jellyfin
14
+ version: 10.11.0
15
+ - name: Proxmox VE
16
+ version: 9.1.1
17
+ aliases: [Proxmox Virtual Environment]
18
+ - name: OpenSSH
19
+ version: 9.6p1
20
+ - name: Forgejo
21
+ version: latest # a ':latest' tag can't be compared, so it can only ever be "check"