fix(abstract-node): restrict Grafana permissions and enforce PostgreSQL restart policy - #41
Open
malakasaray-del wants to merge 1 commit into
Open
Conversation
…QL restart policy
## Motivation
This PR resolves high-severity security and reliability issues within the `abstract-node` container composition, identified during the workspace-wide security audit.
Previously, Grafana was configured with `GF_AUTH_ANONYMOUS_ORG_ROLE: Admin` hardcoded. With anonymous access enabled and the login form disabled, this granted administrative rights to any request reaching port 3000[cite: 57]. This exposed the node to severe risks, as an unauthenticated user could create data sources to proxy server-side requests and access internal endpoints, such as the cloud metadata service[cite: 57]. Additionally, the `postgres` service lacked a restart policy; a crash or host reboot left the database stopped, causing the `external-node` to loop indefinitely until manual intervention[cite: 57].
## Modifications
* **Grafana Least Privilege (`docker/external-node.yml`)**:
* Demoted the hardcoded anonymous role from `Admin` to `Viewer` (`GF_AUTH_ANONYMOUS_ORG_ROLE: "${GRAFANA_ANONYMOUS_ROLE:-Viewer}"`)[cite: 57]. This restricts unauthenticated access to reading provisioned dashboards only, mitigating the server-side request forgery (SSRF) risk[cite: 57]. Operators requiring admin rights can restore the previous behavior by explicitly setting the `GRAFANA_ANONYMOUS_ROLE` environment variable[cite: 57].
* **Database Reliability (`docker/external-node.yml`)**:
* Added `restart: always` to the `postgres` service to ensure it automatically recovers after crashes or host reboots, maintaining the health dependency required by the `external-node` service[cite: 57].
## Checklist
- [x] Format your code according to the Contributor Guide.
- [ ] Add unit tests as outlined in the Contributor Guide.
- [x] Update documentation as needed, including docstrings or example tutorials.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
This PR resolves high-severity security and reliability issues within the
abstract-nodecontainer composition, identified during the workspace-wide security audit.Previously, Grafana was configured with
GF_AUTH_ANONYMOUS_ORG_ROLE: Adminhardcoded. With anonymous access enabled and the login form disabled, this granted administrative rights to any request reaching port 3000[cite: 57]. This exposed the node to severe risks, as an unauthenticated user could create data sources to proxy server-side requests and access internal endpoints, such as the cloud metadata service[cite: 57]. Additionally, thepostgresservice lacked a restart policy; a crash or host reboot left the database stopped, causing theexternal-nodeto loop indefinitely until manual intervention[cite: 57].Modifications
docker/external-node.yml):AdmintoViewer(GF_AUTH_ANONYMOUS_ORG_ROLE: "${GRAFANA_ANONYMOUS_ROLE:-Viewer}")[cite: 57]. This restricts unauthenticated access to reading provisioned dashboards only, mitigating the server-side request forgery (SSRF) risk[cite: 57]. Operators requiring admin rights can restore the previous behavior by explicitly setting theGRAFANA_ANONYMOUS_ROLEenvironment variable[cite: 57].docker/external-node.yml):restart: alwaysto thepostgresservice to ensure it automatically recovers after crashes or host reboots, maintaining the health dependency required by theexternal-nodeservice[cite: 57].Checklist
PR-Codex overview
This PR updates the
docker/external-node.ymlconfiguration for a service, enhancing the setup forprometheus,grafana,postgres, andexternal-node, including health checks, environment variables, and volume management.Detailed summary
namefor the external node service.GF_AUTH_ANONYMOUS_ORG_ROLEto default toViewer.postgresrestart policy.generate-secretsconfiguration.