Commit graph

36 commits

Author SHA1 Message Date
Snider
d90a5be936 refactor: AX compliance sweep — replace banned stdlib imports with core primitives
Replaced fmt, strings, sort, os, io, sync, encoding/json, path/filepath,
errors, log, reflect with core.Sprintf, core.E, core.Contains, core.Trim,
core.Split, core.Join, core.JoinPath, slices.Sort, c.Fs(), c.Lock(),
core.JSONMarshal, core.ReadAll and other CoreGO v0.8.0 primitives.

Framework boundary exceptions preserved where stdlib types are required
by external interfaces (Gin, net/http, CGo, Wails, bubbletea).

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-13 09:32:00 +01:00
Snider
7bcb6d469c fix(pr#2): address CodeRabbit round 4 — newCacheStore fail-closed for unbounded cache
Prevent silent unbounded cache creation when both maxEntries and maxBytes
are non-positive: newCacheStore now returns nil, WithCacheLimits skips
middleware registration, and WithCache defaults to 1 000-entry LRU cap
when called with only a TTL argument.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-07 11:32:28 +01:00
Virgil
1491e16f9e fix(api): normalise runtime metadata snapshots
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 16:48:37 +00:00
Virgil
eb18611dc1 feat(api): snapshot authentik runtime config
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 13:17:08 +00:00
Virgil
f760ab6c72 feat(api): expose cache config snapshot
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 09:23:02 +00:00
Virgil
5e4cf1fde8 refactor(api): clarify cache limits api
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 08:34:09 +00:00
Virgil
d225fd3178 feat(api): add openapi info summary support
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 08:16:56 +00:00
Virgil
ec945970ee docs(api): add AX usage examples
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 07:51:21 +00:00
Virgil
b0549dc14e fix(api): deep-clone swagger security schemes
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 07:19:32 +00:00
Virgil
fb7702df67 feat(api): expose swagger security schemes
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 07:06:09 +00:00
Virgil
dd834211d8 fix(auth): exempt swagger ui path in authentik middleware
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 06:29:34 +00:00
Virgil
e47b010194 feat(api): add configurable websocket path
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 03:21:28 +00:00
Virgil
ef641c7547 feat(api): add configurable Swagger path
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 02:06:45 +00:00
Virgil
39bf094b51 feat(api): add configurable SSE path
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 02:01:43 +00:00
Virgil
085c57a06d feat(cache): add byte-bounded eviction
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 01:49:36 +00:00
Virgil
9b5477c051 fix(api): ignore blank swagger metadata overrides
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 00:12:13 +00:00
Virgil
68edd770d8 docs(api): add ax usage examples
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 00:03:10 +00:00
Virgil
0f20eaa7b8 fix(api): preserve sunset response headers
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-01 23:33:52 +00:00
Virgil
0984c2f48a docs(api): add AX usage examples
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-01 23:25:54 +00:00
Virgil
06f2263b73 fix(api): disable cache middleware for non-positive ttl
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-01 23:09:12 +00:00
Virgil
29324b0a0b feat(api): add sunset deprecation middleware
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-01 23:02:52 +00:00
Virgil
b64c8d3271 docs(api): add AX usage examples
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-01 22:55:39 +00:00
Virgil
bb7d88f3ce feat(openapi): add external docs metadata
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-01 20:47:38 +00:00
Virgil
4d7f3a9f99 feat(openapi): add terms of service metadata
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-01 20:44:01 +00:00
Virgil
a589d3bac6 feat(api): add OpenAPI contact metadata
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-01 20:35:08 +00:00
Virgil
b2d3c96ed7 feat(api): expose swagger licence metadata
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-01 20:26:55 +00:00
Virgil
2f8f8f805e fix(api): scope rate limiting by key
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-01 18:22:17 +00:00
Virgil
aff54403c6 fix(api): compose swagger server metadata
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-01 17:57:16 +00:00
Virgil
c48effb6b7 feat(api): normalise OpenAPI server metadata
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-01 17:31:45 +00:00
Virgil
90600aa434 feat(api): expose swagger server metadata
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-01 16:07:16 +00:00
Virgil
e713fb9f56 feat(api): emit rate limit headers on success and reject
Adds X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset to successful responses and 429 rejections, and documents the headers in OpenAPI.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-01 16:01:09 +00:00
Virgil
c4cbd018ac feat(api): auto-attach request metadata
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-01 14:00:04 +00:00
Virgil
9aa7c644ef fix(api): disable non-positive timeouts
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-01 13:12:51 +00:00
Virgil
837a910148 feat(cache): add LRU eviction limit
Add an optional maxEntries cap to WithCache so the in-memory cache can evict old entries instead of growing without bound.\n\nCo-Authored-By: Virgil <virgil@lethean.io>
2026-04-01 09:27:22 +00:00
Virgil
6fdd769212 feat(api): add per-IP rate limiting middleware
Adds a token-bucket WithRateLimit option that rejects excess requests with 429 Too Many Requests and a standard error envelope.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-01 06:54:58 +00:00
Snider
753812ad57 feat(api): merge go-api + php-api into polyglot repo
Go source at root level (Option B), PHP under src/php/.
Module path: forge.lthn.ai/core/api
Package name: lthn/api

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-14 10:03:29 +00:00