Skip to content

Commit e081a93

Browse files
committed
πŸ“ Spec: Updated the SPEC for API servers πŸ“
1 parent eadc05c commit e081a93

1 file changed

Lines changed: 59 additions & 5 deletions

File tree

β€ŽAI.mdβ€Ž

Lines changed: 59 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9396,13 +9396,26 @@ data:
93969396
cve:
93979397
# NVD (NIST National Vulnerability Database)
93989398
source: "https://services.nvd.nist.gov/rest/json/cves/2.0"
9399-
# Only download CVEs relevant to project dependencies
9400-
filter_by_cpe: true
9399+
# Filtering the feed to "relevant" CVEs requires reliably deriving CPE
9400+
# (Common Platform Enumeration) strings from the project's dependency
9401+
# manifest. NVD's CPE dictionary doesn't map cleanly onto Go module
9402+
# paths, and no derivation is defined here β€” guessing wrong means a real
9403+
# CVE affecting a real dependency is silently never downloaded, with no
9404+
# error surfaced. Default to the full unfiltered feed; every CVE stays
9405+
# relevant until an actual, verified dependency-to-CPE mapping exists.
9406+
filter_by_cpe: false
94019407

94029408
trivy:
94039409
# Aqua Trivy vulnerability database (optional, for container scanning)
94049410
enabled: false
9405-
source: "https://ghcr.io/aquasecurity/trivy-db"
9411+
# trivy-db is an OCI artifact, not a plain HTTP-downloadable file β€” a
9412+
# bare `https://` GET against this repository path returns registry API
9413+
# JSON/HTML, never db.tar.gz. Pulling it requires an OCI registry client
9414+
# (e.g. go-containerregistry, the same library Trivy itself uses) that
9415+
# resolves the tag, fetches the manifest, and extracts the
9416+
# application/vnd.aquasec.trivy.db.layer.v1.tar+gzip layer blob. The tag
9417+
# is the DB schema version (currently 2), not "latest".
9418+
source: "ghcr.io/aquasecurity/trivy-db:2"
94069419
```
94079420

94089421
### Security Directory Structure
@@ -26506,6 +26519,7 @@ func trackingScript(r *http.Request) template.HTML {
2650626519
| Description | From branding config or project-specific |
2650726520
| Features | Key features list (project-specific) |
2650826521
| Links | GitHub, documentation, etc. |
26522+
| Third-party attribution | GeoIP (DB-IP / NRO CC BY 4.0 notices β€” see PART 19: GEOIP), plus any other license-required attribution |
2650926523

2651026524
**⚠️ CRITICAL: Content MUST come from IDEA.md - NEVER use generic placeholders.**
2651126525

@@ -26558,9 +26572,17 @@ func trackingScript(r *http.Request) template.HTML {
2655826572
<li><a href="https://jokeapi.readthedocs.io">Documentation</a></li>
2655926573
</ul>
2656026574
</section>
26575+
26576+
<section class="attribution">
26577+
<h2>Third-Party Attribution</h2>
26578+
<p><a href="https://db-ip.com/">IP Geolocation by DB-IP</a></p>
26579+
<p>Country and ASN data licensed CC BY 4.0 by the Number Resource Organization (NRO).</p>
26580+
</section>
2656126581
</article>
2656226582
```
2656326583

26584+
**GeoIP attribution content above is canonical β€” see PART 19: GEOIP β†’ "License & Attribution" for the source of these notices; do not let this copy drift if that section is ever updated.**
26585+
2656426586
**Note:** Tor address is NOT shown here. Tor access is available via:
2656526587
- **Footer**: "Tor Support" link β†’ `/server/help#tor-access` (shown when Tor is enabled)
2656626588
- **Footer**: "I2P Support" link β†’ `/server/help#i2p-access` (shown when I2P is enabled and running)
@@ -27826,7 +27848,7 @@ Every project MUST include these scheduled tasks:
2782627848
| `ssl_renewal` | Daily at 03:00 | Renew `{config_dir}/ssl/letsencrypt/{fqdn}/` certs 7 days before expiry | No |
2782727849
| `geoip_update` | Weekly (Sunday 03:00) | Download/update ip-location-db GeoIP databases | Yes |
2782827850
| `blocklist_update` | Daily at 04:00 | Download/update IP/domain blocklists | Yes |
27829-
| `cve_update` | Daily at 05:00 | Download/update CVE/security databases | Yes |
27851+
| `cve_update` | Daily at 05:00 | Download/update CVE (NVD) and Trivy vulnerability databases β€” trivy has no separate scheduled task despite its own directory/config; this task owns it too | Yes |
2783027852
| `update_check` | Daily at 06:00 | Check release channel for a newer version β€” notify-only unless `update.auto_install: true` (default false); honors `update.defer_days` | Yes |
2783127853
| `token_cleanup` | Every 15 minutes | Remove expired API tokens and sessions | No |
2783227854
| `log_rotation` | Daily at 00:00 | Rotate and compress old logs | No |
@@ -28221,7 +28243,7 @@ All databases come from [sapics/ip-location-db](https://github.com/sapics/ip-loc
2822128243
| Country | CC BY 4.0 | NRO (RIR whois + geofeed + ASN data, merged) |
2822228244
| City | CC BY 4.0 | DB-IP |
2822328245

28224-
**Required, verbatim, on a page reachable from every screen that displays GeoIP-derived data (e.g. an "About" or footer link) AND in `LICENSE.md`'s third-party attribution section (see PART 2):**
28246+
**Required, verbatim, on `/server/about` (see "Standard Pages" β†’ /server/about) AND in `LICENSE.md`'s third-party attribution section (see PART 2):**
2822528247

2822628248
```html
2822728249
<a href="https://db-ip.com/">IP Geolocation by DB-IP</a>
@@ -28257,6 +28279,11 @@ server:
2825728279
deny_countries: []
2825828280
allow_countries: []
2825928281

28282+
# Named, operator-authored country lists for reuse across allow/deny
28283+
# fields and environments. Ships empty β€” see "Country Blocking Presets"
28284+
# below for why no preset is bundled by default.
28285+
presets: {}
28286+
2826028287
# Which databases to download and use - all three are CC BY 4.0 and
2826128288
# require the attribution above whenever their data is used
2826228289
databases:
@@ -28274,6 +28301,7 @@ server:
2827428301
| `geoip.dir` | Directory the downloaded `.mmdb` files live in |
2827528302
| `geoip.deny_countries` | ISO 3166-1 alpha-2 codes to block; all others allowed |
2827628303
| `geoip.allow_countries` | ISO 3166-1 alpha-2 codes to allow exclusively; wins if both lists are set |
28304+
| `geoip.presets` | Named operator-authored country lists (`name -> []code`), for reuse; empty by default β€” see Country Blocking Presets |
2827728305
| `geoip.databases.asn` | Enable ASN lookups |
2827828306
| `geoip.databases.country` | Enable country lookups |
2827928307
| `geoip.databases.city` | Enable city lookups |
@@ -28294,6 +28322,32 @@ server:
2829428322
- Tor exit nodes are evaluated by exit-node country, not by any inferred user origin
2829528323
- Private/internal IPs (RFC 1918, RFC 4193, loopback) are never looked up or country-blocked
2829628324

28325+
## Country Blocking Presets (Operator-Defined, Never Auto-Applied)
28326+
28327+
**The admin panel MUST let operators save the current `deny_countries` or
28328+
`allow_countries` selection as a named, reusable preset** (`geoip.presets`,
28329+
`name -> []code`) β€” so a list built once can be reapplied to other
28330+
allow/deny fields or exported/imported across environments without
28331+
hand-retyping ISO codes each time.
28332+
28333+
**No preset ships pre-populated, and this project MUST NOT bundle a
28334+
hardcoded regulatory country list (e.g. "OFAC sanctioned", "FATF high-risk")
28335+
as a built-in default.** Every project in this family stays server-agnostic
28336+
about jurisdiction and use case β€” sanctions/regulatory lists change over
28337+
time, differ by regime, and a template-bundled list presented as current
28338+
compliance guidance would go stale silently and could be relied on past the
28339+
point it's accurate. That is the same "outcome asserted, mechanism/accuracy
28340+
unverified" shape already fixed elsewhere in this spec (CVE CPE filtering,
28341+
Trivy DB source) β€” bundling a specific sanctions list here would reintroduce
28342+
it in a compliance-sensitive form.
28343+
28344+
**Preset rules:**
28345+
- A preset is only ever a name plus the country codes the operator entered β€” the project never fetches, infers, or auto-suggests preset contents from any external source
28346+
- `deny_countries: []` / `allow_countries: []` remain the defaults on every fresh install regardless of what presets exist β€” allow all, deny none, unchanged by this feature
28347+
- Selecting a preset in the admin UI only pre-fills `deny_countries`/`allow_countries` for the operator to review and save; it is never applied automatically or silently
28348+
- If an operator needs a compliance-driven blocklist, they build and save it themselves as a preset, sourced from their own current legal/compliance review β€” never from a template default
28349+
- Presets are a pure config-reuse convenience; the actually-enforced behavior is always driven by `deny_countries`/`allow_countries` at the time of the request, never by the preset name itself
28350+
2829728351
# PART 20: METRICS
2829828352

2829928353
## Overview

0 commit comments

Comments
Β (0)