
Product
Rubygems Ecosystem Support Now Generally Available
Socket's Rubygems ecosystem support is moving from beta to GA, featuring enhanced security scanning to detect supply chain threats beyond traditional CVEs in your Ruby dependencies.
docker-chromium
Advanced tools
Node library for controlling a Chromium instance running in a Docker container
Node library for controlling a Chromium instance running in a Docker container
Requirements:
npm install --save docker-chromium
const {
dockerSetChromiumConfig,
dockerRunChromium,
dockerShutdownChromium
} = require("docker-chromium");
(async () => {
await dockerSetChromiumConfig({
revision: "123456"
flags: [' -–ignore-certificate-errors']
});
const webSocketUri = await dockerRunChromium();
// do some other stuff...
await dockerShutdownChromium();
})();
Default is trying to connect to Chromium 5 times with a 500 milisecond interval between each attempt. You can customize timeout/attempts by passing arguments to dockerRunChromium
:
// ...
const webSocketUri = await dockerRunChromium({
maxAttempts: 10,
retryInterval: 5000 // 5 seconds
});
Or by defining environment variables DOCKER_CHROMIUM_MAX_ATTEMPTS
and DOCKER_CHROMIUM_RETRY_INTERVAL
. Passing arguments to dockerRunChromium
takes precedence over environment variables.
docker-chromium
pulls a pre-built Docker image running a version of Chromium specified by you from a Docker Hub repository. You can then fetch the WebSocket URI to connect to the instance in your own application. If the pre-built image is unavailable or corrupt (rare case), a backup mechanism is in place, which builds the image from scratch locally instead.
Due to Ubuntu 14.04 LTS transitioning to ESM support, we have had to upgrade the Ubuntu version to 18.04 LTS. The Dockerfile used in the pre-built version in Docker Hub remains on the old version. Until this is changed, we have to disable this option for the time being.
Function which is used for the configuration of Chromium, before running it with dockerRunChromium
.
await dockerSetChromiumConfig({
revision: '123456',
flags: [' -–ignore-certificate-errors']
});
revision: string
flags: string[]
process.env.CHROMIUM_ADDITIONAL_ARGS
downloadHost: string
process.env.PUPPETEER_DOWNLOAD_HOST || process.env.npm_config_puppeteer_download_host || process.env.npm_package_config_puppeteer_download_host || 'https://storage.googleapis.com'
$CHROMIUM_DOWNLOAD_HOST/chromium-browser-snapshots/Linux_x64/$REV/chrome-linux.zip
- $CHROMIUM_DOWNLOAD_HOST
describes downloadHost
argumentdockerSetChromiumConfig({downloadHost: 'https://internal.service.com, revision: 99999})
, it means that Chromium snapshot will be downloaded from https://internal.service.com/chromium-browser-snapshots/Linux_x64/99999/chrome-linux.zipuseClosestUbuntuMirror: boolean
process.env.USE_CLOSEST_UBUNTU_MIRROR || process.env.npm_config_use_closest_ubuntu_mirror || process.env.npm_package_config_use_closest_ubuntu_mirror|| false
Function which is used to build and run the Docker container.
const webSocketUri = await dockerRunChromium({
maxAttempts: 10,
retryInterval: 5000
});
maxAttempts: number
retryInterval: number
Promise<string>
Function which is used to shutdown the launched Docker container.
await dockerShutdownChromium();
FAQs
Node library for controlling a Chromium instance running in a Docker container
The npm package docker-chromium receives a total of 1,648 weekly downloads. As such, docker-chromium popularity was classified as popular.
We found that docker-chromium demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket's Rubygems ecosystem support is moving from beta to GA, featuring enhanced security scanning to detect supply chain threats beyond traditional CVEs in your Ruby dependencies.
Research
The Socket Research Team investigates a malicious npm package that appears to be an Advcash integration but triggers a reverse shell during payment success, targeting servers handling transactions.
Security Fundamentals
The Socket Threat Research Team uncovers how threat actors weaponize shell techniques across npm, PyPI, and Go ecosystems to maintain persistence and exfiltrate data.