Require bearer authentication on all direct search routes #19
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Problem
The compatibility search routes in
svr/svc_ccwget.pyaccept requests without a bearer token.Confirmed behavior:
/query,/list-fqdn,/list-domain,/domain-enum, and/sha1callqueue_sync_request()when_queued=1is absent.queue_sync_request()maps a missing or invalid identity to the literal client IDanonymousinstead of returning the existing unauthorized response.tests/test_auth_and_object.py::test_direct_search_route_uses_queuecurrently verifies the unauthenticated behavior.This allows an unauthenticated network caller to submit expensive ClickHouse searches and retrieve indexed results, bypassing the authentication enforced by
/jobsand object routes. It also permits anonymous resource consumption until queue limits are reached.Proposed approach
Require successful bearer authentication before direct compatibility routes enqueue work. Reuse
authenticate_request()andunauthorized_response(); do not introduce a second authentication mechanism.Preserve the existing queued execution path and token-scoped queue ownership. If unauthenticated compatibility access is required for a trusted local deployment, make it an explicit configuration mode with a secure default rather than an implicit fallback.
This requires server code, tests, and documentation. No database migration is expected.
Scope
queue_sync_request()or at every direct search route.anonymousidentity fallback for network requests._queued=1worker execution without attempting to authenticate the internal test request context.Acceptance criteria
Dependencies
Implemented and pushed in commit
496c897.Changes:
Verification: Black passed; 146 pytest tests passed; targeted Pylint score 10.00/10.