Skip to content

chore(medcat-trainer): Harden MCT plugin scaffold with trust docs and URL/signal guards.#530

Merged
tomolopolis merged 3 commits into
mainfrom
feat/medcat-trainer/plugin-security-hardening
Jun 11, 2026
Merged

chore(medcat-trainer): Harden MCT plugin scaffold with trust docs and URL/signal guards.#530
tomolopolis merged 3 commits into
mainfrom
feat/medcat-trainer/plugin-security-hardening

Conversation

@tomolopolis

Copy link
Copy Markdown
Member

Document the in-process plugin trust model, validate bootstrap menu/route URLs against dangerous schemes, isolate plugin signal failures from core flows, and add secure API authoring guidance.

Document the in-process plugin trust model, validate bootstrap menu/route URLs against dangerous schemes, isolate plugin signal failures from core flows, and add secure API authoring guidance.
@tomolopolis tomolopolis changed the title Harden MCT plugin scaffold with trust docs and URL/signal guards. chore(medcat-trainer): Harden MCT plugin scaffold with trust docs and URL/signal guards. Jun 10, 2026

@alhendrickson alhendrickson left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me



# ---------------------------------------------------------------------------
# URL hardening for bootstrap-exposed entries

@alhendrickson alhendrickson Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only comment is I'd probably remove any mention of "security" or "hardening" throughout, and really just talk about it being a safety net for writing plugins. You've already got docs that say it isn't security, so would keep that message consistent

Would do a pass through of the documentation/code to reword like that really.

For example this code here doesnt give any security or hardening at all for malicious plugins, (and I get that you acknowledge that elsewhere ). I'd just write a plugin that edits this extensions.py file and restart trainer.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the example

Given this pydoc:

The registry helpers below apply light input hardening (URL-scheme validation on
menu/route entries) and signal emission is isolated via :func:`dispatch` so that
a buggy or hostile plugin receiver cannot break core request flows. These are
defence-in-depth measures, **not** a security boundary against malicious code
running in-process.

I'd probably remove the "hardening", "defence-in-depth" and "hostile plugin receiver" text here. Keep it consistent that it isn't defence at all. Function is called "validate", which feels like the right word to use throughout

@tomolopolis tomolopolis merged commit f97d14c into main Jun 11, 2026
10 checks passed
@tomolopolis tomolopolis deleted the feat/medcat-trainer/plugin-security-hardening branch June 11, 2026 10:39
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