Skip to content

fix(resolver): validate flag name format in resolve and apply#412

Open
nicklasl wants to merge 7 commits into
mainfrom
nicklasl/validate-flag-names
Open

fix(resolver): validate flag name format in resolve and apply#412
nicklasl wants to merge 7 commits into
mainfrom
nicklasl/validate-flag-names

Conversation

@nicklasl
Copy link
Copy Markdown
Member

@nicklasl nicklasl commented May 22, 2026

Summary

  • Adds validate_flag_name to the Rust core resolver, enforcing the flags/{id} format where {id} is 2-63 chars of [a-z0-9-]
  • Validates in both resolve_flags (requested flag names) and apply_flags (applied flag names)
  • Invalid flag names are silently dropped — they won't be resolved or applied
  • Matches the backend's DEFAULT_ID_PATTERN in NameFactoryImpl

Discussion point

Currently invalid flag names are silently dropped. An alternative would be to log a warning via the WASM host log_message import, but that would require adding the wasm_msg_host_log_message host function to JS, Go, and Python providers (Java already has it). Is silent drop sufficient, or should we add observability here?

Test plan

  • 10 new unit tests covering valid names, missing prefix, uppercase, spaces, too short/long, double prefix, special chars, and integration tests for resolve/apply skip behavior
  • All 357 tests pass
  • Clippy clean

🤖 Generated with Claude Code

nicklasl and others added 7 commits May 22, 2026 08:36
Reject flag names that don't match the expected `flags/{id}` format
where id is 2-63 lowercase alphanumeric/hyphen characters.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@nicklasl nicklasl marked this pull request as ready for review May 22, 2026 11:36
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.

1 participant