Log the authentication status at app startup. Emits a prominent WARNING when the API is unauthenticated so the insecure default is impossible to miss in logs.
()
| 108 | |
| 109 | |
| 110 | def log_auth_status() -> None: |
| 111 | """Log the authentication status at app startup. |
| 112 | |
| 113 | Emits a prominent WARNING when the API is unauthenticated so the insecure |
| 114 | default is impossible to miss in logs. |
| 115 | """ |
| 116 | if get_configured_api_key(): |
| 117 | logger.info("API key authentication is ENABLED (CGC_API_KEY is set).") |
| 118 | else: |
| 119 | logger.warning( |
| 120 | "⚠️ CodeGraphContext API is running WITHOUT authentication. " |
| 121 | "Anyone who can reach this server can index code, run Cypher queries " |
| 122 | "and call tools. Set CGC_API_KEY to require a key." |
| 123 | ) |
no test coverage detected