Skip to content

grafana/crocochrome

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Folders and files

NameName
Last commit message
Last commit date
Mar 19, 2025
Jul 10, 2024
Oct 22, 2024
Jul 10, 2024
Aug 30, 2024
Feb 21, 2025
Nov 13, 2024
Nov 28, 2024
Jan 23, 2025
Jul 10, 2024
Jul 10, 2024
Jan 23, 2025
Jan 23, 2025
Nov 4, 2024
Mar 12, 2025
Nov 26, 2024
Mar 5, 2025
Nov 25, 2024
Nov 29, 2024
Nov 13, 2024
Nov 28, 2024
Aug 30, 2024
Mar 5, 2025
Mar 5, 2025
Jun 26, 2024

Repository files navigation

Crocochrome logo, a mashup between the crocodile emoji and the chromium logo Crocochrome

Crocochrome is a chromium supervisor, which runs and reaps chromium processes on demand.

Crocochrome needs to be granted certain linux capabilities to funciton, see docs/capabilities.md for details.

Crocochrome runs chromium with --no-sandbox. The reason for this is that to run with sandboxing enabled, chromium needs user namespaces to work, which are not available everywhere.

Moreover, chromium's sandbox focuses on isolating the processes running untrusted code from other processes, the network, and the filesystem. Regarding process isolation, we only run one chromium process concurrently, and that's the only process in the container running as the (unprivileged) container. Therefore we do not see much value in this isolation. Regarding filesystem access, the whole container is run with a read-only filesystem. The Crocochrome binary is not readable or runnable by the user chromium is running on, and there should be no sensitive files to be accessed whatsoever. Regarding the network, we can use NetworkPolicy objects to forbid the Crocochrome container from accessing private IP ranges.

Manual testing

The manualtest folder includes some simple scripts that use browser and can be used to test Crocochrome. Additionally, a script called croco6.sh also in that folder acts as a k6 wrapper that connects to a running instance of Crocochrome and configures k6 to use it. It can be used as follows:

# Build and run container
docker build . -t localhost:5000/crocochrome && \
docker run -ti --rm -p 8080:8080 --memory=512M --read-only -v /tmp:/chromium-tmp localhost:5000/crocochrome

# Run a script
./manualtest/croco6.sh run manualtest/testk6io.js

All arguments passed to croco6.sh are passed to k6 unmodified. croco6.sh takes care of creating a browser session in Crocochrome, retrieving the websocket URL, passing it down to k6, and finally destroying the session when k6 exits.