Skip to content

Commit 01b3b22

Browse files
delanoclaude
andcommitted
Quote syslog tags to prevent shell injection in journalctl hint
Use shlex.quote() on generated tags in format_journalctl_hint to prevent potential shell injection if instance identifiers contain shell metacharacters. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 0a484d7 commit 01b3b22

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/ots_containers/commands/instance/_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def format_journalctl_hint(instances: dict[InstanceType, list[str]]) -> str:
3636
if not tags:
3737
return ""
3838

39-
tag_args = " ".join(f"-t {tag}" for tag in tags)
39+
tag_args = " ".join(f"-t {shlex.quote(tag)}" for tag in tags)
4040
return f"journalctl {tag_args} -f"
4141

4242

0 commit comments

Comments
 (0)