Skip to content

fix(supervisor): quote nft log prefix in bypass rules - #2555

Open
gracesmith6504 wants to merge 1 commit into
NVIDIA:mainfrom
gracesmith6504:fix/2470-nft-log-prefix-quoting
Open

fix(supervisor): quote nft log prefix in bypass rules#2555
gracesmith6504 wants to merge 1 commit into
NVIDIA:mainfrom
gracesmith6504:fix/2470-nft-log-prefix-quoting

Conversation

@gracesmith6504

Copy link
Copy Markdown
Contributor

Summary

The nft log prefix value in bypass detection rules contains colons but is not wrapped in double quotes, causing nft to reject the command with a syntax error. This silently disables all bypass-attempt logging. This PR adds an nft_quote() helper that wraps prefixes in nft-quoted strings, and applies it to all four log-rule generation sites.

Related Issue

Fixes #2470

Changes

  • Add nft_quote() helper function that wraps a string in double quotes and strips any embedded double-quotes (nft quoted strings don't support escape sequences)
  • Quote the log prefix in all 4 LOG rule generation sites (TCP + UDP, for both per-sandbox and sidecar bypass rulesets) in nft_ruleset.rs
  • Update 2 existing tests to assert the quoted form
  • Add regression test that structurally validates log prefix quoting
  • Add unit test for nft_quote() covering colons, quotes, and backslashes

Testing

  • mise run pre-commit passes (all checks green: clippy, format, license, markdown, helm)
  • Unit tests added/updated
  • E2E tests added/updated (if applicable) — N/A, no E2E changes
  • Note: netns module is #[cfg(target_os = "linux")] so unit tests only run in CI, not on macOS. Compilation and clippy verified locally.

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)
  • Architecture docs updated (if applicable) — N/A, no architecture changes

@copy-pr-bot

copy-pr-bot Bot commented Jul 30, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

The log prefix value passed to nft contains colons (e.g.
openshell:bypass:sandbox-cc817378:) but was not wrapped in double
quotes. Since nft concatenates argv entries and parses the result,
the bare colons cause a syntax error that silently prevents all
bypass-attempt LOG rules from installing.

Wrap log prefix values in nft-quoted strings via a new nft_quote()
helper that strips embedded double-quotes (nft quoted strings don't
support escape sequences). All four log-rule generation sites (TCP
and UDP, for both per-sandbox and sidecar rulesets) are updated.

Fixes NVIDIA#2470

Signed-off-by: Grace Smith <grasmith@redhat.com>
@gracesmith6504
gracesmith6504 force-pushed the fix/2470-nft-log-prefix-quoting branch from 567ffba to 34ffe52 Compare July 30, 2026 09:15
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.

bug(supervisor): quote nft log prefixes in bypass rules

1 participant