Add validation for safe-outputs.allowed-domains#9017
Merged
Conversation
- Create validation function for domain patterns (plain and wildcard) - Add comprehensive test coverage for domain validation - Integrate validation into compiler workflow - Support wildcards like *.github.com - Validate against invalid patterns (multiple wildcards, empty, etc.) Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Apply De Morgan's law to character validation logic - Use require for error assertions as per testifylint rules Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add support for safe-outputs.allowed-domain validation
Add validation for safe-outputs.allowed-domains
Jan 5, 2026
Collaborator
|
@copilot add support in the javascript secret redaction code to also support the wildcards and filter domains accordingly. |
pelikhan
reviewed
Jan 5, 2026
- Add tests for wildcard domain patterns (*.example.com) - Test wildcard matching with subdomains and base domains - Test mixed wildcard and plain domain configurations - Verify redaction for non-matching domains - Confirm existing wildcard implementation works correctly Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Contributor
Author
The JavaScript sanitization code already has wildcard support implemented in The tests confirm:
|
- Add 60+ test cases for domain pattern regex validation - Test valid patterns: plain domains, wildcards, numbers, hyphens, case variations - Test invalid patterns: special chars, dot placement, wildcard rules, hyphen rules - Test edge cases: length limits (63 chars), single labels, IP-like formats - Verify regex correctly handles all domain validation scenarios Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements validation for domain patterns in
safe-outputs.allowed-domainsconfiguration to catch malformed domains at compile time.Changes
Validation logic (
pkg/workflow/safe_outputs_domains_validation.go)github.com) and wildcard patterns (*.github.com)Compiler integration (
pkg/workflow/compiler.go)CompileWorkflowData()after sandbox validationTest coverage (
pkg/workflow/safe_outputs_domains_validation_test.go)JavaScript wildcard tests (
actions/setup/js/sanitize_content.test.cjs)sanitize_content_core.cjsworks correctly with patterns like*.example.comExample
Valid configuration:
Error for invalid pattern:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.