feat: adds a configurable PolicyFetcher - #73
Open
jvolkman wants to merge 1 commit into
Open
Conversation
Introduces a "fetch policy" feature to control remote asset downloads based on
URI patterns.
Rules match URIs with regular expressions and assign an action, one of:
- ACCEPT: Normal caching behavior.
- ACCEPT_REFRESH: Uses oldest_content_accepted to force a remote fetch.
- DENY: Blocks the download.
The first matching rule for each URI wins. No matching rules is a
default ACCEPT. If multiple URIs are passed in a single fetch request,
each is considered individually. If one URI matches a DENY and the other
does not, the accepted URI will still be fetched.
PolicyFetcher groups ACCEPT and ACCEPT_REFRESH URIs together and passes
each group separately to the downstream fetcher - starting with the ACCEPT
bucket - such that oldest_content_accepted can be set on the ACCEPT_REFRESH
bucket.
Example config:
```json
{
fetcher: {
policy: {
rules: [
{ "uri_regex": "^https://github[.]com/blocked-org/safe_file.txt", "action": "ACCEPT" },
{ "uri_regex": "^https://github[.]com/blocked-org/.*", "action": "DENY" },
{ "uri_regex": "^https://github[.]com/mutable-org/.*", "action": "ACCEPT_REFRESH" },
]
}
}
}
```
Member
|
Is anyone looking into this PR? @mortenmj ? |
tomcoldrick-ct
approved these changes
Aug 26, 2026
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.
Introduces a "fetch policy" feature to control remote asset downloads based on URI patterns.
Rules match URIs with regular expressions and assign an action, one of:
The first matching rule for each URI wins. No matching rules is a default ACCEPT. If multiple URIs are passed in a single fetch request, each is considered individually. If one URI matches a DENY and the other does not, the accepted URI will still be fetched.
PolicyFetcher groups ACCEPT and ACCEPT_REFRESH URIs together and passes each group separately to the downstream fetcher - starting with the ACCEPT bucket - such that oldest_content_accepted can be set on the ACCEPT_REFRESH bucket.
Example config:
{ "fetcher": { "policy": { "rules": [ { "uri_regex": "^https://github[.]com/blocked-org/safe_file.txt", "action": "ACCEPT" }, { "uri_regex": "^https://github[.]com/blocked-org/.*", "action": "DENY" }, { "uri_regex": "^https://github[.]com/mutable-org/.*", "action": "ACCEPT_REFRESH" }, ] } } }More context in slack - https://buildteamworld.slack.com/archives/CD6HZC750/p1778956175968159