Adds automatic domain validation and allow-listing #2092
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.
This pull request introduces an automatic domain validation and allow-listing feature to Percy, enabling projects to dynamically validate and manage allowed and blocked domains during builds. The implementation adds configuration options, integrates with an external validation endpoint, and persists newly discovered domains to the project configuration for future builds.
Auto Domain Validation Feature:
autoDomainValidationconfiguration option inconfig.jsto control domain validation settings, including enabling/disabling, endpoint URL, timeout, and whether to save results to the project.Percyclass now maintains domain validation state, loads pre-approved/pre-blocked domains from the project on startup, and saves newly discovered allowed/blocked domains at shutdown. This ensures persistent and evolving domain allow-lists per project. [1] [2] [3] [4]Domain Validation Logic Integration:
Networkclass and resource handling logic now use the auto domain validation context. Requests are checked against manual config, then validated via the external service if not explicitly allowed/blocked, with results cached for the session and persisted for future builds. [1] [2] [3] [4]validateDomainForAllowlist()to handle validation, caching, and error fallback, ensuring robust and efficient domain management during resource requests.Percy Client API Extensions:
PercyClientclass now provides methods to fetch and update project domain configuration, and to validate domains via the external endpoint, supporting the new auto domain validation workflow.These changes collectively enable Percy to automatically manage domain allow-lists, improving build reliability and reducing manual configuration.