Skip to content

feat(release): prepare Castlegate Server for the QGIS plugin repository - #14

Merged
simonokeefe merged 5 commits into
mainfrom
claude/kind-goldberg-qzb18b
Nov 17, 2026
Merged

simonokeefe merged 5 commits into
mainfrom
claude/kind-goldberg-qzb18b

Conversation

@simonokeefe

@simonokeefe simonokeefe commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Castlegate Server is to be published in the QGIS plugin repository (plugins.qgis.org) as an experimental plugin. This makes the zip pass the repository's validation and security scan, adds a release route that builds the zip, and caps the size of every body the plugin parses.

Changes

  • server/castlegate_server/metadata.txt:
    • adds repository, which the repository requires, and homepage, tracker and tags;
    • sets experimental=True;
    • replaces description and about. The about is plain text in paragraphs, which is how the repository shows it, and says:
      • what Castlegate does;
      • what the rules table controls;
      • how it refuses;
      • what it leaves out;
      • that it has not yet been reviewed outside Vectoria.
    • names castlegate@vectoria.com.au as the contact, as spike/plugin/castlegate_spike/metadata.txt now does too.
  • scripts/build.py copies LICENSE into the plugin's folder. The repository refuses a zip without one.
  • transaction.py: is_transaction() no longer parses a body over MAX_BODY_BYTES.
    • It answers True, so read() refuses the body as too large. Before, it parsed a body of any size.
    • It does not answer False, which would pass a large Transaction to QGIS Server unread.
  • server/castlegate_server/.bandit skips B405, the import of xml.etree, with its reason: every parse in transaction.py goes through an expat parser that refuses any document type declaration and entity declaration, and no body over MAX_BODY_BYTES is parsed. The repository reads .bandit beside metadata.txt and lists such a version as "Validated (configured)".
  • request_filter.py and status.py: the two last-resort handlers that swallowed a second error (Bandit B110) now write it to QGIS Server's log.
  • .github/workflows/plugin-release.yml: a release tagged castlegate_server@<version> runs this workflow. It checks the tag against metadata.txt, runs the core and plugin tests, builds the zip and attaches it to the release.
  • RELEASING.md gives those steps. install/README.md says the release zip is on the Releases page.
  • Tests:
    • tests/plugin/test_build.py: the built zip holds one folder, LICENSE, .bandit and no compiled Python. metadata.txt has every field the repository requires, and is marked experimental. VERSION in status.py equals the version in metadata.txt.
    • tests/plugin/test_transaction.py: a body over the limit counts as a Transaction, unparsed, and read() refuses it. The test fails on the previous transaction.py.

Checks

  • python -m unittest discover -s tests/plugin -t . and python -m unittest discover -s tests/core -t . pass.
  • On the zip scripts/build.py builds:
    • bandit -r . reports 0 issues; with .bandit removed, 1 (B405);
    • detect-secrets scan --all-files --exclude-files 'metadata\.txt' ., as the repository runs it, reports 0.
  • configparser.ConfigParser(), the reader the repository uses, reads the about with its paragraphs.

- metadata.txt adds the repository, homepage, tracker and tags, marks the plugin experimental, and says in its about what Castlegate does, what it leaves out and that it has had no outside review; the zip now carries LICENSE and a .bandit that skips B405 with its reason.
- The two last-resort handlers that swallowed an error now log it; a release tagged castlegate_server@<version> builds the zip and attaches it (plugin-release.yml, RELEASING.md).
- Checked: core and plugin tests pass, test_build.py included; bandit and detect-secrets report 0 on the built zip.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- metadata.txt gives castlegate@vectoria.com.au as the plugin's email, which the QGIS plugin repository writes to.
- Checked: the plugin tests pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…'s contact

- spike/plugin/castlegate_spike/metadata.txt gives the same contact as the released plugin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread server/castlegate_server/.bandit Resolved
- The reason for skipping B405 says every parse refuses document type and entity declarations, and that only read() refuses a body over MAX_BODY_BYTES; is_transaction() parses with no size limit.
- Checked: the plugin tests pass; bandit reports 0 on the built zip.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@claude

claude Bot commented Nov 17, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

…ithout parsing it

- is_transaction() no longer parses a body over MAX_BODY_BYTES; it answers True, so read() refuses the body as too large and a large Transaction never reaches QGIS Server unread.
- .bandit's reason for skipping B405 says no body over the limit is parsed.
- Checked: the new test fails on the previous transaction.py and passes now; core and plugin tests pass; bandit reports 0 on the built zip.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@claude

claude Bot commented Nov 17, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@simonokeefe
simonokeefe merged commit 56e1f35 into main Nov 17, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants