Align healthchecks, API_READ_TOKEN policy, and OpenAPI coverage #9
No reviewers
Labels
No labels
bug
codex
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
quentinreytinas/borgmatic-api-nextcloud-aio!9
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "quentin/fix-healthchecks-and-align-api-documentation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Motivation
API_READ_TOKEN.Description
/healthto/health/publicin theDockerfileanddocker-compose.example.yml(so liveness checks do not require authentication).API_READ_TOKENoptional in the compose example by defaulting it toBORG_API_TOKENwhen unset, remove the strictAPI_READ_TOKENstartup validation inborgmatic_api_app/config.py, and updateREADME.mdto document the fallback behavior.openapi.yamlto match the Flask routes, including/health/public,/metrics,/repositories/{label}/create,/security/exec-whitelist,/security/exec-whitelist/validate, and/security/audit-log, add theSecuritytag, and update the read-auth description to reflect that read endpoints acceptREAD_TOKENorWRITE_TOKENand also acceptX-Progress-Token: READ_TOKEN.external: trueline fornextcloud_aio_nextcloud_dataindocker-compose.example.ymland update example health check calls inREADME.mdto use/health/public.Testing
@bp.route(...)entries inborgmatic_api_app/routes/legacy.pyagainst paths inopenapi.yaml, which returned no missing routes (success).docker compose -f docker-compose.example.yml configbut it could not run in this environment because thedockercommand is not available (failure due to environment).pytest -qwhich failed in this environment due to missing runtime dependency (flask), causing test errors unrelated to the changed logic (failure due to missing dependency).Codex Task
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
fc1a0b16caℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
@ -49,10 +49,6 @@ class Settings:raise RuntimeError("API_TOKEN must be set and non empty to start the Borgmatic API")Removing the
API_READ_TOKENvalidation lets the app start with an explicitly empty read token, which turns into an authentication bypass for every read-only endpoint: inAuthManager.verify()(borgmatic_api_app/auth.py), the read path acceptsX-Progress-Tokenwhen it equalssettings.read_token, so withread_token == ""a request with no auth token (and onlyX-From-NodeRed) is accepted because"" == "". Previously this misconfiguration failed fast at startup.Useful? React with 👍 / 👎.
The added
/repositories/{label}/createschema documentsstats/progress/verbosity, but the implementationrepo_create()consumes different options (encryption,repository,source_repository,storage_quota,copy_crypt_key,append_only,make_parent_dirs, etc., inborgmatic_api_app/routes/legacy.py). This contract mismatch can cause generated clients to send ineffective payloads and miss the controls the endpoint really supports.Useful? React with 👍 / 👎.
The new OpenAPI entry requires
AuthWrite, but the actual handlersecurity_validate_exec()enforces_require_auth(read_only=True)(borgmatic_api_app/routes/legacy.py), soREAD_TOKENis valid at runtime. This mismatch makes generated clients and policy tooling over-request write credentials for a read-only dry-run endpoint, undermining least-privilege access and breaking callers that only have read tokens.Useful? React with 👍 / 👎.