A comment with a single quote in a base ufw_rules entry fails only when it is applied, after the earlier rules in the loop have already gone in, and the loop then goes on to the later entries.
community.general.ufw builds the ufw command with the comment unquoted. A comment such as SSH from this host's containers leaves an open quote. The module fails with Invalid command syntax in run_command: No closing quotation, and only that one loop item fails.
Why it is dangerous since 1.6.0:delete: true entries run after every other rule in roles/ufw/tasks/rules.yml. Take a list that adds a narrower SSH rule with a bad comment and deletes the broad one. The add fails, the delete still runs, and the host is left with neither rule. That locks out SSH clients that only the new rule would have admitted. This was hit in a --check run of a consumer before any change was applied.
Evidence (v1.6.0)
roles/ufw/tasks/service_rules.yml:99-105: service rules already go through Validate the rule comments, which refuses a single quote or backslash, non-printable ASCII and surrounding whitespace before anything is applied.
roles/ufw/tasks/validate.yml: the base rules get a key check, a schema check and the add-and-delete conflict check, but no comment check.
roles/ufw/tasks/rules.yml: the base rules are applied in one loop. The deletes are ordered last.
Proposed change
In tasks/validate.yml, refuse a base ufw_rules entry whose comment would fail the same rule as the service-rule comment check: printable ASCII, no single quote, no backslash, no surrounding whitespace. Reuse that check's expression, not a copy. Delete entries are sent without their comment, so either skip them or check them too for consistency; state the choice in the README.
Molecule: a refusal block in which a base rule's comment has an apostrophe, expecting the new message, before anything is applied.
README and argument_specs: describe the restriction on ufw_rules[].comment.
Changelog fragment (bugfixes).
Out of scope
Quoting the comment in community.general.ufw itself (upstream).
## Problem
A comment with a single quote in a base `ufw_rules` entry fails only when it is applied, after the earlier rules in the loop have already gone in, and the loop then goes on to the later entries.
`community.general.ufw` builds the `ufw` command with the comment unquoted. A comment such as `SSH from this host's containers` leaves an open quote. The module fails with `Invalid command syntax in run_command: No closing quotation`, and only that one loop item fails.
**Why it is dangerous since 1.6.0:** `delete: true` entries run after every other rule in `roles/ufw/tasks/rules.yml`. Take a list that adds a narrower SSH rule with a bad comment and deletes the broad one. The add fails, the delete still runs, and the host is left with neither rule. That locks out SSH clients that only the new rule would have admitted. This was hit in a `--check` run of a consumer before any change was applied.
## Evidence (v1.6.0)
- `roles/ufw/tasks/service_rules.yml:99-105`: service rules already go through **Validate the rule comments**, which refuses a single quote or backslash, non-printable ASCII and surrounding whitespace before anything is applied.
- `roles/ufw/tasks/validate.yml`: the base rules get a key check, a schema check and the add-and-delete conflict check, but no comment check.
- `roles/ufw/tasks/rules.yml`: the base rules are applied in one loop. The deletes are ordered last.
## Proposed change
- [ ] In `tasks/validate.yml`, refuse a base `ufw_rules` entry whose `comment` would fail the same rule as the service-rule comment check: printable ASCII, no single quote, no backslash, no surrounding whitespace. Reuse that check's expression, not a copy. Delete entries are sent without their comment, so either skip them or check them too for consistency; state the choice in the README.
- [ ] Molecule: a refusal block in which a base rule's comment has an apostrophe, expecting the new message, before anything is applied.
- [ ] README and `argument_specs`: describe the restriction on `ufw_rules[].comment`.
- [ ] Changelog fragment (`bugfixes`).
## Out of scope
- Quoting the comment in `community.general.ufw` itself (upstream).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Proposed, not done: labels Kind/Bug and Status/Needs Triage.
Review of the map (2026-11-17).
This issue has no label. It edits `roles/ufw/tasks/validate.yml` and adds a negative test, the same files that [refactor(roles): validate through spec keys and validate.yml, and prefix internal variables with __ROLE_](https://git.rkdr.net/Mortis/Kamino/issues/137) reorders. By the order decision a role fix does not wait on the refactor; whichever lands second rebases.
Proposed, not done: labels `Kind/Bug` and `Status/Needs Triage`.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Problem
A comment with a single quote in a base
ufw_rulesentry fails only when it is applied, after the earlier rules in the loop have already gone in, and the loop then goes on to the later entries.community.general.ufwbuilds theufwcommand with the comment unquoted. A comment such asSSH from this host's containersleaves an open quote. The module fails withInvalid command syntax in run_command: No closing quotation, and only that one loop item fails.Why it is dangerous since 1.6.0:
delete: trueentries run after every other rule inroles/ufw/tasks/rules.yml. Take a list that adds a narrower SSH rule with a bad comment and deletes the broad one. The add fails, the delete still runs, and the host is left with neither rule. That locks out SSH clients that only the new rule would have admitted. This was hit in a--checkrun of a consumer before any change was applied.Evidence (v1.6.0)
roles/ufw/tasks/service_rules.yml:99-105: service rules already go through Validate the rule comments, which refuses a single quote or backslash, non-printable ASCII and surrounding whitespace before anything is applied.roles/ufw/tasks/validate.yml: the base rules get a key check, a schema check and the add-and-delete conflict check, but no comment check.roles/ufw/tasks/rules.yml: the base rules are applied in one loop. The deletes are ordered last.Proposed change
tasks/validate.yml, refuse a baseufw_rulesentry whosecommentwould fail the same rule as the service-rule comment check: printable ASCII, no single quote, no backslash, no surrounding whitespace. Reuse that check's expression, not a copy. Delete entries are sent without their comment, so either skip them or check them too for consistency; state the choice in the README.argument_specs: describe the restriction onufw_rules[].comment.bugfixes).Out of scope
community.general.ufwitself (upstream).🤖 Generated with Claude Code
Review of the map (2026-11-17).
This issue has no label. It edits
roles/ufw/tasks/validate.ymland adds a negative test, the same files that refactor(roles): validate through spec keys and validate.yml, and prefix internal variables with _ROLE reorders. By the order decision a role fix does not wait on the refactor; whichever lands second rebases.Proposed, not done: labels
Kind/BugandStatus/Needs Triage.