57 Commits

Author SHA1 Message Date
h z
bfef232b8f Merge pull request 'feat: add 'agent' API key role (content CRUD + backup)' (#4) from feat/agent-role into main
Reviewed-on: #4
2026-05-17 14:10:29 +00:00
b31480bf25 feat: add 'agent' API key role (content CRUD + backup)
- ALLOWED_API_KEY_ROLES (+ apikey_cli ALLOWED_ROLES) gain 'agent'.
- 'agent' added to require_auth on markdown/patch/path create/update/
  delete/move and backup get/load. apikey mint, /backup/convert, logs,
  config, webhook and permission/template settings stay admin-only.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-17 15:06:17 +01:00
h z
9383f8cb03 Merge pull request 'feat: admin CLI for API key management (no admin login)' (#3) from feat/apikey-admin-cli into master
Reviewed-on: #3
2026-05-16 22:11:55 +00:00
67a04d67d9 feat: admin CLI for API key management (no admin login)
apikey_cli.py operates directly on the DB (run inside the backend
container). Subcommands: create (alias required; reusing an alias
renews — same key, validity reset, reactivated, name/roles updated;
roles allowlisted; configurable --ttl-days), list (masked keys,
--show-keys to reveal), revoke (by --alias or --key).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-16 23:10:31 +01:00
h z
f1584d1841 Merge pull request 'feat/apikey-alias-authorship' (#2) from feat/apikey-alias-authorship into master
Reviewed-on: #2
2026-05-16 22:06:14 +00:00
a3a6cbbec6 chore: standalone idempotent prod SQL migration (apikey alias + authorship)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-16 22:58:54 +01:00
bf4c0dbbbd feat: apikey alias/renewal + markdown/patch authorship
- APIKey.alias (unique, required). Creating with an existing alias
  renews that key: same key string kept, validity reset to 15d,
  reactivated, name/roles updated (response has renewed=true).
- get_actor(): X-API-Key -> key alias, Bearer -> 'admin'.
- markdown & patch create/update record author / created_at /
  updated_at / last_modified_by from the actor.
- Idempotent run_migrations() (information_schema-guarded ALTERs +
  backfill) so existing tables/data gain the new columns on startup;
  create_all still covers fresh DBs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-16 22:51:40 +01:00
h z
9e2477df8c Merge pull request 'fix/security-hardening' (#1) from fix/security-hardening into master
Reviewed-on: #1
2026-05-16 16:30:25 +00:00
155aa897c6 feat: markdown patch cards (model + API)
Add MarkdownPatch model (markdown_patch table, auto-created by
create_all) and /api/patch blueprint: list patches for a markdown
(inherits the parent's private/protected visibility), create/update
(admin|creator), delete (admin).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-16 17:28:04 +01:00
58f23ddcb8 Security hardening: fix RCE, auth and SSRF issues
Critical:
- backup: prevent Zip Slip path traversal and zip bombs in restore/convert
  via safe_extract(); serialize get_backup() with backup_lock and always
  restore CWD so concurrent requests can't corrupt the os.chdir state
- app: only enable the Werkzeug debugger/reloader when ENVIRONMENT=dev;
  always init rate limits (also under WSGI), not just under __main__
- apikey: fix create_key never committing (session.commit -> commit()),
  validate roles against an allowlist, and fix revoke_key/update_last_used
  operating on detached instances so revocation actually persists
- env_provider: redact DB_PASSWORD and SESSION_SECRET_KEY in summerize()

High:
- markdown: filter private/protected docs for non-admins in the listing,
  get_home, get_index and search endpoints (was an anonymous data leak);
  escape LIKE metacharacters and cap search results
- webhooks: validate target URL to block SSRF (loopback/private/link-local/
  metadata IPs), disable redirects, safely parse additional_header
- auth: validate JWT issuer and require exp/iat; add timeout to JWKS fetch;
  harden Authorization header parsing against malformed values
- log: require admin for GET /api/log and auth for POST; bound entry size

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-16 16:12:43 +01:00
1f4ca52a10 add: markdown deletion 2025-06-27 12:06:28 +01:00
62c33c47c6 add: markdown deletion 2025-06-23 15:41:03 +01:00
692c0794c5 upgrade react-query to v5 2025-05-09 00:44:53 +01:00
848c4b8fd8 fix: fix endpoints 2025-05-08 12:25:47 +01:00
1a160c9415 add: backend api auth by apikey/apikey gen/apikey revoke 2025-05-06 18:54:10 +01:00
85d8124a0c improve: upgrade node to 20, upgrade react-query to v4 2025-04-27 00:36:42 +01:00
84494827ad add: backup version converter/ backup logic 1.0 2025-04-25 13:00:41 +01:00
35c8934963 add: markdown permission setting
improve: template
2025-04-25 00:39:01 +01:00
cf247231e4 fix: template defects 2025-04-18 02:16:18 +01:00
0186a95dd4 fix: template defects 2025-04-17 21:44:45 +01:00
fa855bc7bb add: template editor 2025-04-14 17:02:22 +01:00
6626fac452 improve: add setting button to pathnode 2025-03-20 18:37:13 +00:00
e7000f0b2e improve: change db schema for settings 2025-03-20 13:58:24 +00:00
864b78641b add: webhook 2025-03-17 13:54:53 +00:00
acb1e2260f add: load backup 2025-03-05 17:33:17 +00:00
26b64f8c15 add: auto link feature 2025-01-17 16:33:39 +00:00
00f6895850 add: markdown search feature 2025-01-17 09:20:20 +00:00
e87ec256bb add: provide backup archive feature 2025-01-16 14:05:19 +00:00
9e0967c69e improve: css for change order 2024-12-29 19:30:46 +00:00
a96e833aa6 add: order paths & mds 2024-12-29 18:53:02 +00:00
c10c690149 improve: fix README 2024-12-10 21:28:08 +00:00
79acfb2313 fix: home md not shown 2024-12-10 13:25:17 +00:00
797bf65d4e add: display home markdown 2024-12-09 21:15:04 +00:00
038efb745a add: etag support 2024-12-09 08:00:25 +00:00
41ff76e6c9 improve: add production stage 2024-12-09 07:01:22 +00:00
072ae25f7c improve: use react-query for caching 2024-12-08 17:11:14 +00:00
7416294437 fix: edit function of markdown 2024-12-07 12:03:23 +00:00
4344b6e660 add: bind path to index markdown 2024-12-06 23:35:37 +00:00
a4313acf47 fix: render of markdown preview 2024-12-06 17:22:42 +00:00
eaa2350b72 add: api for rate control 2024-12-06 16:12:44 +00:00
b3ec244e06 Save Markdowns 2024-12-06 15:13:20 +00:00
48dd59f8e4 kc token public key/token issue, path root set to 1 2024-12-06 10:04:03 +00:00
4b9c1ba727 manage markdowns by path 2024-12-05 18:28:16 +00:00
178219f097 read configs from env 2024-12-05 13:39:08 +00:00
9d0fd5b33c config for oauth 2024-12-04 14:06:30 +00:00
ba2f5bb483 fix OAuth2 issue 2024-12-04 08:03:14 +00:00
dc8ee49c9e fix render issue 2024-12-03 16:36:32 +00:00
23b9db19a8 fix docker config 2024-12-03 14:35:25 +00:00
973d24ddd2 Dockerfile 2024-12-03 13:13:07 +00:00
969f200753 requirements 2024-12-03 12:42:09 +00:00