Builds on #30782, which is merged; the branch now merges `main`. Adds `Coder.LatinAbbreviations`, a Vale rule that enforces [Latin abbreviations](https://github.com/coder/coder/blob/main/docs/.style/style-guide/accessibility-and-inclusion.md#latin-abbreviations). - Suggests "for example", "that is", and "and so on" for `e.g.`, `i.e.`, and `etc.`, including `eg.`, `ie.`, and a missing final period (`e.g`). - Severity: `suggestion`. Scope: `docs/**` except `docs/.style/style-guide/**`, limited to paragraphs, lists, headings, and blockquotes. Table cells and code are skipped. - Baseline: 170 findings in 91 files. The brief estimated 148. - Cleanup: 153 findings fixed across 81 hand-written pages, 0 left in linted pages. The count is lower than the original 158 because other PRs on `main` already rewrote or removed some of the lines, and `parameters.md` was deleted on `main`. - `vs.` and `et al.` aren't flagged. Commits: 1. `docs(docs): use English forms of Latin abbreviations` 2. `feat(docs/.style): enable Coder.LatinAbbreviations Vale rule` Generated pages: `.vale.ini` skips `docs/reference/{api,cli}/*.md` and `docs/admin/setup/configuration-reference.md` for this rule, as it does for `Coder.UnitSpacing`. Their prose comes from CLI flag help text and Swagger comments in Go source, and `make gen` rewrites them, so a hand edit fails the `gen` check (an earlier revision of this PR edited `configuration-reference.md` and failed `gen` for that reason). Cleaning them means editing Go and regenerating the help golden files and API docs, which is left for a follow-up. Linear: DOCS-450 <details> <summary>Decision log</summary> - `extends: substitution`, so the message names the replacement: "Consider 'for example' instead of 'e.g.'". - `scope: [paragraph, list, heading, blockquote]`. The single scope `paragraph` skips list items, blockquotes, and headings, so all four are listed. Table cells have their own scope and stay excluded. - Explicit `[Ee]` and `[Ii]` classes with `ignorecase: false`, so sentence-initial `E.g.,` still matches but the browser name `IE.` doesn't. - `eg.` and `ie.` require the trailing period so ordinary words and file extensions stay quiet. - Cleanup rules, applied by script and then reviewed line by line: - `e.g.` and `i.e.` become "for example," and "that is," (capitalized at the start of a sentence), with a comma added when the original had none. - `etc.` becomes "and so on", with the sentence-ending period kept when `etc.` closed the sentence. - Lines inside table rows, fenced blocks, and code spans are untouched, so are the style guide and the generated pages. - Hard-wrapped lines keep their wrapping, and CRLF files keep CRLF. - The rest of the Vale output is unchanged: the per-rule counts for every other rule match the pre-cleanup run. Test cases (fixtures under `/tmp/latin-test/`, not committed), run with LF and CRLF line endings: - Flagged (15 each): `e.g.,` in a paragraph, `i.e.,`, `etc.` at the end of a sentence and before a comma, `eg.`, `ie.`, `e.g` and `i.e` without the final period, `E.g.,`, `I.e.,`, `Etc.`, a blockquote, a list item, a numbered item, and a heading. - Not flagged: a table row with `e.g.,`, `i.e.,`, and `etc.`, code spans, a fenced block, "for example", "that is", "and so on", `IE.`, `genre`, `series`, `egg`, `tie`, `etcetera`, `vs.`, `et al.`. - Known edge case: a path-like token such as `path/i.e/x` outside code matches. It doesn't occur in the corpus. Checks: - `vale --output=line docs/`: 0 `Coder.LatinAbbreviations` findings. - `go run ./scripts/styleclaims` passes. - The pre-commit-light hook passes on both commits. </details> *Generated by [Coder Agents](https://coder.com/docs/ai-coder/agents) on behalf of @nickvigilante.*
5.0 KiB
5.0 KiB
title
| title |
|---|
| Rules engine documentation |
Note
Agent Firewall is part of AI Governance, which is included with a Premium license.
Overview
The rulesengine package provides a flexible rule-based filtering system for HTTP/HTTPS requests.
Rules use a simple key-value syntax with support for wildcards and multiple values.
Basic Syntax
Rules follow the format: key=value [key=value ...] with three supported keys:
method: HTTP method(s) - Any HTTP method (for example,GET,POST,PUT,DELETE),*(all methods), or comma-separated listdomain: Domain/hostname pattern -github.com,*.example.com,*(all domains)path: URL path pattern -/api/users,/api/*/users,*(all paths), or comma-separated list
Key behavior:
- If a key is omitted, it matches all values
- Multiple key-value pairs in one rule are separated by whitespace
- Multiple rules in the allowlist are OR'd together (OR logic)
- Default deny: if no rule matches, the request is denied
Examples:
allowlist:
- domain=github.com # All methods, all paths for github.com (exact match)
- domain=*.github.com # All subdomains of github.com
- method=GET,POST domain=api.example.com # GET/POST to api.example.com (exact match)
- domain=api.example.com path=/users,/posts # Multiple paths
- method=GET domain=github.com path=/api/* # All three keys
Wildcard Symbol for Domains
The * wildcard matches domain labels (parts separated by dots).
| Pattern | Matches | Does NOT Match |
|---|---|---|
* |
All domains | - |
github.com |
github.com (exact match only) |
api.github.com, v1.api.github.com (subdomains), github.io |
*.github.com |
api.github.com, v1.api.github.com (1+ subdomain levels) |
github.com (base domain) |
api.*.com |
api.github.com, api.google.com |
api.v1.github.com (* in the middle matches exactly one domain label) |
*.*.com |
api.example.com, api.v1.github.com |
- |
api.* |
❌ ERROR - Cannot end with * |
- |
Important:
- Patterns without
*match exactly (no automatic subdomain matching) *.example.commatches one or more subdomain levels- To match both base domain and subdomains, use separate rules:
domain=github.comanddomain=*.github.com - Domain patterns cannot end with asterisk
Wildcard Symbol for Paths
The * wildcard matches path segments (parts separated by slashes).
| Pattern | Matches | Does NOT Match |
|---|---|---|
* |
All paths | - |
/api/users |
/api/users |
/api/users/123 (subpaths don't match) |
/api/* |
/api/users, /api/posts |
/api |
/api/*/users |
/api/v1/users, /api/v2/users |
/api/users, /api/v1/v2/users |
/*/users |
/api/users, /v1/users |
/api/v1/users |
/api/v1/* |
/api/v1/users, /api/v1/users/123/details (1+ segments) |
/api/v1 |
Important:
*matches exactly one segment (except at the end)*at the end matches one or more segments (special behavior)*must match an entire segment (cannot be part of a segment like/api/user*)
Special Meaning of Wildcard at Beginning and End
| Position | Domain | Path |
|---|---|---|
| Beginning | 1+ subdomain levels | Exactly 1 segment |
| Middle | Exactly 1 label | Exactly 1 segment |
| End | ❌ Not allowed | 1+ segments (special) |
| Standalone | All domains | All paths |
Multipath
Specify multiple paths in a single rule by separating them with commas:
allowlist:
- domain=api.example.com path=/users,/posts,/comments
- domain=api.example.com path=/api,/api/*
NOTE: The pattern /api/* does not include the base path /api.
To match both, use path=/api,/api/*.