fix: protect Crawl4AI nginx exposure#75
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9c2e47fc6e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| # Security: the Crawl4AI REST API accepts arbitrary crawl URLs and can be | ||
| # abused as an SSRF primitive. Only expose it through nginx when Authelia is | ||
| # active; otherwise keep the backend reachable solely on the Docker network. | ||
| if [[ "${ENABLE_CRAWL4AI:-false}" == "true" && "${ENABLE_AUTHELIA:-false}" == "true" ]]; then |
There was a problem hiding this comment.
Don't silently disable Crawl4AI for agents installs
For DEPLOY_PROFILE=agents (and custom installs that select Crawl4AI but decline Authelia), templates/services/registry.yaml still implies ENABLE_CRAWL4AI=true without ENABLE_AUTHELIA=true, and the wizard still advertises agmind-crawl.local. With this new condition, generate_nginx_config deletes every Crawl4AI server block in that configuration, while compose only publishes nginx's 11235 port rather than the Crawl4AI container itself, so the selected service starts but has no advertised/reachable host route. Either force Authelia when Crawl4AI is enabled, or stop enabling/advertising Crawl4AI in non-Authelia profiles.
Useful? React with 👍 / 👎.
Motivation
Description
lib/config.shso the Crawl4AI markers are only stripped when bothENABLE_CRAWL4AIandENABLE_AUTHELIAaretrue.auth_request /authelia-authhandling and an internal/authelia-authendpoint to the Crawl4AI dedicated-port and mDNS nginx vhosts intemplates/nginx.conf.templateso requests to:11235andagmind-crawl.localcan be authenticated when enabled.CRAWL4AI_BIND_ADDRand changing the port mapping intemplates/docker-compose.ymlto${CRAWL4AI_BIND_ADDR:-127.0.0.1}:${EXPOSE_CRAWL4AI_PORT:-11235}:11235and addCRAWL4AI_BIND_ADDR=127.0.0.1totemplates/env.lan.template.tests/unit/test_crawl4ai_auth_exposure.shthat asserts the nginx activation condition, presence ofauth_requestand/authelia-auth, explicit/healthhandling, and the default loopback binding, and update golden fixtures/checksums accordingly.Testing
bash tests/unit/test_crawl4ai_auth_exposure.shwhich passed and validates the new activation condition,auth_requestmarkers and default bind settings.bash tests/unit/test_nginx_no_static_proxy_pass.shwhich passed and confirmed nginx proxy patterns are unchanged.sha256checksums for updated golden fixtures withsha256sum -c checksums.sha256which succeeded for the updated fixtures.bash -n lib/config.sh tests/unit/test_crawl4ai_auth_exposure.shwhich returned without syntax errors.bash tests/unit/test_compose_security_invariants.shwas skipped due to missingpython3 + PyYAMLin the environment, andbash tests/golden/run.sh full_lan --updatewas skipped due to Docker CLI / Docker Compose not available in the environment.Codex Task