Packaged bot and service policy data
The packaged policy data is a built-in library of request rules for common bots, crawlers, clients, applications, services, and shared request patterns. Administrators select these rules from their main policy through imports. The selected rules then become part of runtime classification and can allow, deny, challenge, or change the weight of a request. See Configuration for the wider policy model and Configuration loading for the full load path.
Dataset model
The policy data is grouped by the kind of request it describes. The groups keep reusable rules separate from the policy choices that combine them.
Policy categories
The package exposes one embedded policy file system through data/embed.go. It includes the botPolicies.yaml default policy and YAML snippets under these groups:
| Group | Purpose | Typical signal |
|---|---|---|
bots | Identify unwanted or unusual automated agents | User-agent names or browser behavior |
crawlers | Classify search, archive, indexing, and training crawlers | User-agent data or published network ranges |
clients | Classify software that acts for a user or uses a non-browser client | Headers, user-agent data, or source addresses |
apps | Preserve known application routes and application-specific traffic | URL paths or request expressions |
services | Recognize external monitoring and service agents | User-agent data and source addresses |
common | Provide reusable request behavior checks | Paths, headers, and browser-like behavior |
meta | Combine rules into an administrator stance | Imports from several other groups |
These names describe the policy subject, not separate runtime engines. All groups produce the same kind of bot rule, so a selected rule enters classification in the same way as any other rule. References: data/embed.go• L5-7, data/…/README.md• L1-5, lib/…/config.go• L57-73
Policy composition
The data is designed for composition. A small snippet can describe one agent, while a meta policy can assemble many snippets into a broader choice such as aggressive AI blocking or a default set of trusted crawlers. data/botPolicies.yaml is the packaged starting point and shows how common rules, crawler rules, client rules, and meta rules can be combined.
Imports use the (data)/ prefix to select packaged data. A configuration can also import a local file, but packaged data stays available after the application is built and does not depend on a source checkout. A glob can select a group of snippets when a policy needs a set rather than one named rule. References: data/botPolicies.yaml• L1-50, data/…/default-config.yaml• L1-33, lib/…/import.go• L33-49, lib/…/import.go• L86-103
Runtime classification
Runtime classification turns the selected snippets into request checks. The configuration loader resolves imports first. The policy parser then turns each rule into a named action with one or more request conditions.
Import resolution
An import resolves to one or more policy documents. Nested imports are allowed, so a meta policy can point to other groups and those groups can point to individual rules. The loader flattens the result into the bot-rule list before request handling starts.
The loader rejects missing files, invalid patterns, unreadable data, and malformed policy documents. It also requires each imported document to produce valid rule definitions. This keeps packaged data from silently becoming a partial runtime policy. References: lib/…/import.go• L20-24, lib/…/import.go• L105-150, lib/…/import_test.go• L100-145
Rule evaluation
Each selected rule has a condition set and an action. Conditions can use request headers, paths, client addresses, expressions, or optional IP metadata. When a rule has several conditions, all conditions must match before its action applies.
The policy parser validates the rule and builds the request checks before it returns the active policy. The resulting action can allow or deny a request, issue a challenge, or adjust its weight for later threshold handling.
The following flow shows how packaged data reaches request classification.
flowchart LR
A[Main policy] --> B[Packaged import]
B --> C[Selected policy snippets]
C --> D[Validated request rules]
D --> E[Runtime request checks]
E --> F[Allow, deny, challenge, or weight]
References: lib/…/config.go• L35-53 lib/…/config.go• L96-200 lib/…/policy.go• L80-89 lib/…/policy.go• L150-262 lib/…/checker.go• L25-45
Dataset roles
The groups cover different sources of request identity. They let an administrator apply a narrow rule to a known service or compose a wider policy for a class of automated traffic.
Bot and crawler rules
Bot rules target agents that are unwanted, suspicious, or known to behave unlike a normal browser. Crawler rules cover search and archive systems that an administrator may want to allow so they can index a site without trying to bypass the protection.
The two groups can work together. For example, the aggressive AI meta policy imports a broad AI catch-all rule, rules for AI clients, and rules for AI search and training crawlers. The allow-list for known crawlers instead imports named crawler policies so trusted indexing traffic can be handled as a set.
The bot group also supports narrow allow rules for known automated agents. The Arch Linux IRC phrik rule allows the agent only when its expected user-agent and one of its published addresses match, which limits the rule to that specific service identity.
References: data/…/ai-catchall.yaml• L1-11 data/…/headless-browsers.yaml• L1-15 data/…/archlinux-phrik.yaml• L1-7 data/…/_allow-good.yaml• L1-13 data/…/ai-block-aggressive.yaml• L1-6
Client, application, and service rules
Client rules describe software that sends requests for a person or uses a specialized protocol. Application rules protect routes that should remain usable for a known application. Service rules recognize monitoring or other external service traffic.
These rules often combine identity with a second signal. The Git client rule checks both the client pattern and expected headers. The Mistral user client rule pairs its documented user-agent pattern with published source addresses. The API route rule checks the request method and path. The UptimeRobot rule pairs its user-agent with published source addresses. This reduces reliance on a name that a different client could copy.
References: data/…/git.yaml• L1-21 data/…/mistral-mistralai-user.yaml• L1-7 data/…/allow-api-routes.yaml• L1-6 data/…/uptime-robot.yaml• L1-8 lib/…/config.go• L103-120
Shared metadata rules
Shared rules express behavior that applies across several policy subjects. They cover routes that support normal web operation, browser-like request traits, domain-fronting signals, private addresses, and other common request properties.
Meta policies use these shared rules as building blocks. For example, the default policy imports rules for common web routes and domain fronting while also adding subject-specific bot and crawler choices. This separates a reusable fact about a request from the decision to allow, deny, challenge, or weigh it.
References: data/…/keep-internet-working.yaml• L1-13 data/…/acts-like-browser.yaml• L7-55 data/…/default-config.yaml• L1-33 data/…/README.md• L1-5
Data quality boundary
The embedded data is part of the runtime policy surface. Every packaged YAML file must be present in the embedded file system, contain content, parse as YAML, and yield valid policy rules when imported. A bad snippet can therefore prevent configuration loading rather than merely reduce one classification match.
The data also depends on external facts that can change. Published service address lists and user-agent names need review when a provider changes its traffic. Rules that use ASN or country checks need matching GeoIP data in the active policy. Rules that use request expressions must continue to match the request fields exposed by the policy environment.
References: data/embed_test.go• L11-53 lib/…/import_test.go• L100-145 lib/…/policy.go• L116-128 lib/…/policy.go• L217-233
Change checklist
When these files or sections are changed, remember to consider these:
- When adding or renaming a snippet, update every meta policy or default import that selects it.
- When changing a service address list or user-agent pattern, check that the rule still has a second reliable signal where one is required.
- When changing a rule that uses GeoIP, confirm that the matching database is available in deployments that select the rule.
- When changing an expression, confirm that its request fields and header names remain available to bot rules.
- When changing the embedded directory layout, preserve the
(data)/import path used by packaged and local policy examples.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A packaged import path does not exist or a glob matches no files | Configuration validation fails before the policy becomes active | Use paths under the embedded data groups and keep import targets covered by the import validation |
| A snippet contains invalid YAML or an invalid rule | The full policy load fails instead of installing a partial rule set | Keep each snippet valid and use the embedded YAML and import checks |
| A rule needs GeoIP data that is not configured | That rule is skipped and its intended match does not affect the request | Configure the required country or ASN database before selecting the rule |
| A trusted service changes its user-agent or source addresses | Expected service traffic can be classified as unknown or blocked | Review provider-published identity data when maintaining the snippet |
| A narrow bot allow rule has stale addresses or user-agent data | The known bot is not allowed as intended, or copied identity data may match unexpectedly | Keep the identity signals current and require both the expected agent and address |
| A broad user-agent rule matches a legitimate client | Legitimate traffic can receive an unintended action | Prefer narrow conditions and combine identity with headers, paths, or addresses |
Key files
| File | Why to read it |
|---|---|
| data/embed.go | Defines the packaged policy data available at runtime. |
| data/botPolicies.yaml | Shows the default composition of packaged rules. |
| data/…/default-config.yaml | Shows how a broad policy stance combines groups. |
| data/…/ai-block-aggressive.yaml | Shows a meta policy that combines bot, client, and crawler rules. |
| data/…/archlinux-phrik.yaml | Shows a narrow bot rule that uses both a service address and a user-agent. |
| data/…/mistral-mistralai-user.yaml | Shows a client rule that combines a documented user-agent with published source addresses. |
| lib/…/import.go | Defines how packaged and local imports become one policy. |
| lib/…/config.go | Defines the rule contract and the actions that runtime classification can produce. |
| lib/…/policy.go | Connects validated configuration to active request checks. |
| data/embed_test.go | Verifies that packaged files are embedded, non-empty, and valid YAML. |