Data

Get every firewall decision out of the container and into your SIEM.

Every package download the firewall checks produces a decision event: allowed, warned, monitored, or blocked. You can ship those events three ways.

OutputConfigureUse whenPage
Splunk HECContainer env varsYou use SplunkSplunk config
WebhookContainer env varsAnything else: Sentinel, Elastic, a ticketing workflowWebhook config
Container logsOne .env lineYou already ship container stdoutBelow
🚧

Two different webhooks

These pages cover the firewall's webhook, set by environment variables on the container. The webhook under Dashboard → Settings → Webhooks is separate and does not carry install decisions.

What an event contains

Each event is JSON and carries the fields in the table below.

FieldMeaning
timestampEpoch seconds, with a fraction (for example 1793310476.523)
client_ipWho requested the package
registryFqdnThe firewall hostname the request arrived on, not the upstream registry
repoWhich route served it
purl / artifact_purlpurl names the package and artifact_purl names the exact file that was checked. For npm both include the version. For PyPI, purl is the package name plus ?artifact_filename=... with no version, and artifact_purl adds the version
action, decisionWhat the firewall did
block_reason / warn_reason / monitor_reasonWhy, for blocks, warnings and monitored downloads
blocked_alertsThe alerts that caused a block
request_idMatches the ID a developer sees in a blocked install
cachedWhether the verdict came from the firewall's cache

Container logs (one setting)

Decisions are written to stdout as [SOCKET_DECISION] lines followed by JSON, but each kind is logged at its own level, and clean allows are hidden by default:

DecisionDefault log levelShown by default
BlockerrorYes
Allowed with a warn alertwarnYes
Allowed with a monitor alertnoticeYes
Clean allow (ignore)debugNo

To log every decision, add this to .env and recreate the container. Stand up Socket Firewall for the first time already includes it.

SOCKET_IGNORE_LOG_LEVEL=warn
docker compose up -d --force-recreate
docker compose logs socket-firewall | grep SOCKET_DECISION
📘

Reassemble split events

An event longer than socket.log_max_body_size is split across several lines tagged [SOCKET_DECISION 1/2], [SOCKET_DECISION 2/2]. Reassemble the lines before parsing; jq fails on the fragments. Filter on the prefix [SOCKET_DECISION, not on log level.

Things that apply to every output

  • Events fire on downloads only, unless metadata filtering is on. Without metadata filtering, requests for package metadata produce no events. With metadata filtering, each listing logs one event per version checked, up to max_versions. These events carry block_source: "metadata". Leave them out when counting blocked installs. For PyPI, pip downloads the .whl.metadata file and then the wheel, so one package logs two events with the same purl and different source_path. To count PyPI installs once, dedupe on purl plus client_ip.
  • Count on decision, not action. decision is what the client actually got.
  • Client-side caches skip the firewall. A package already in a developer's npm cache or a warm .m2 directory never reaches the firewall, so there's no event.
  • Behind a load balancer, client_ip is the balancer's address until you set client_ip.header and client_ip.trusted_proxies in socket.yml. See Client IP Detection.

Did this page help you?