Skip to content

Conversation

@bcpeinhardt
Copy link
Collaborator

@bcpeinhardt bcpeinhardt commented Sep 22, 2025

An allow rule can have a single domain pattern, like domain=google.com.
Subdomains are automatic matches.
To require subdomains only, use domain=*.github.com.
An allow rule can have multiple method and path patterns, separated by commas, like method=GET,HEAD or path=/wibble,/wibble/*.
A trailing asterisk in a path pattern, like /wibble/*, matches any number of trailing segments.
A leading asterisk in a domain pattern, like *.github.com, matches any number of subdomains. An asterisk in the middle of a domain or path pattern matches exactly one middle segment.

I think this encourages specific concise rules around individual domains, like --allow "domain=api.github.com method=GET,HEAD path=/repos/octocat/*/issues"

P.S. I realize the line count is somewhat daunting but that is mostly tests.

@bcpeinhardt bcpeinhardt marked this pull request as ready for review September 22, 2025 18:22
@@ -0,0 +1,232 @@
package rulesengine
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file has a set of integration tests that go through the full parse and match cycle that should illuminate the edge cases of how this syntax works 😎

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