Skip to content

feat(endpoint): warn when added security item's option toggle is disabled (DX-5701)#33

Merged
johnpmitsch merged 1 commit into
mainfrom
dx-5701-warn-when-adding-a-security-item-whose-option-toggle-is
Jun 13, 2026
Merged

feat(endpoint): warn when added security item's option toggle is disabled (DX-5701)#33
johnpmitsch merged 1 commit into
mainfrom
dx-5701-warn-when-adding-a-security-item-whose-option-toggle-is

Conversation

@johnpmitsch

Copy link
Copy Markdown
Collaborator

Summary

Items added under a disabled security option are not enforced and don't appear in list output until the option is enabled via set-options — so a plain success message made them look like they silently vanished:

❯ qn endpoint security referrer add ep-1 foo.com
✓ Whitelisted referrer "foo.com" on ep-1
# referrers toggle is disabled → the referrer has no effect and doesn't list

After every toggle-governed add/set (token create, referrer add, ip add, jwt add, domain-mask add, request-filter create, ip-header set), the CLI now makes one best-effort GET /endpoints/{id}/security_options and, if the governing option is disabled, warns on stderr with the exact enable command:

✓ Whitelisted referrer "foo.com" on ep-1
⚠ The 'referrers' security option is disabled on ep-1 —
  this referrer will have no effect until you enable it:
    qn endpoint security set-options --referrers enabled ep-1

The check never blocks: a failed lookup is swallowed (the add already succeeded, exit 0 either way), and --quiet skips the extra request entirely. Adds OutputCtx::warn for advisory stderr messages alongside note.

Closes DX-5701

Test plan

  • endpoint_security_referrer_add_warns_when_option_disabled — add + options GET both hit, exit 0
  • endpoint_security_referrer_add_skips_options_check_when_quiet — options GET .expect(0) under --quiet
  • endpoint_security_referrer_add_succeeds_when_options_check_fails — options GET 500 → still exit 0
  • endpoint_security_domain_mask_add_checks_options — second-command coverage
  • Subprocess stderr tests: disabled → warning text + enable hint present; enabled → ✓ note only, no ⚠
  • cargo test (all suites green), cargo clippy --all-targets -- -D warnings, cargo fmt --check

…bled (DX-5701)

Items added under a disabled security option are not enforced and do not
appear in list output until the option is enabled via set-options, so a
plain success message made them look like they silently vanished.

After every toggle-governed add/set (token create, referrer add, ip add,
jwt add, domain-mask add, request-filter create, ip-header set), the CLI
now makes one best-effort GET of the endpoint's security options and, if
the governing option is disabled, prints a stderr warning with the exact
'qn endpoint security set-options --<option> enabled <ID>' command.

The check never blocks: a failed lookup is swallowed (the add already
succeeded), and --quiet skips the extra request entirely. Adds
OutputCtx::warn for advisory stderr messages alongside note.

Tests: 4 in-process (disabled warns, quiet skips the GET, failed check
still exits 0, second command coverage) + 2 subprocess stderr-content
tests (warning text with enable hint; no warning when enabled).
@johnpmitsch johnpmitsch merged commit 12b685a into main Jun 13, 2026
13 checks passed
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