From 85d01c6a042b465a8d276c1a9cfa8b10b91e45ce Mon Sep 17 00:00:00 2001 From: Jaret Burkett Date: Sun, 18 Oct 2026 13:05:41 -0600 Subject: [PATCH] Prevent possible traversal upstream through caption tags on captioner --- extensions_built_in/captioner/BaseCaptioner.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/extensions_built_in/captioner/BaseCaptioner.py b/extensions_built_in/captioner/BaseCaptioner.py index bf9a575..c7c9441 100644 --- a/extensions_built_in/captioner/BaseCaptioner.py +++ b/extensions_built_in/captioner/BaseCaptioner.py @@ -19,8 +19,9 @@ from toolkit.train_tools import get_torch_dtype AITK_Status = Literal["running", "stopped", "error", "completed"] -# prompt special token: -> contents of the media file's sibling .ext -_CAPTION_TOKEN_RE = re.compile(r"") +# prompt special token: -> contents of the media file's sibling .ext. +# ext is dot-separated alphanumeric segments only: no separators, no empty segments (..) +_CAPTION_TOKEN_RE = re.compile(r"") class CaptionConfig: @@ -162,11 +163,16 @@ class BaseCaptioner(BaseExtensionProcess): or blank when that file does not exist.""" if not prompt or "