Cooldown
Hold newly published package versions for a set window, release exceptions on request, and let everything else release on its own.
A cooldown refuses any package version younger than a window you choose. Versions release automatically once they age past the window. Nothing on the firewall changes: it enforces whatever action Socket returns for the recentlyPublished alert.
Before you start: a running firewall (Stand up Socket Firewall for the first time).
1. Set the window
Dashboard → Settings → Alerts → Scans → Recently Published Alert Threshold.
The default is 0At 0 the alert is disabled and nothing is held. Set a non-zero value in days or hours (for example, 4 days). The threshold is not configured in the firewall, and there is no API for it.
2. Set the action to Block
The firewall only blocks when the alert's action is Block. How you set it depends on which policy system your organization is on.
Policies (organizations migrated to the new system): open the Default policy and add a rule for the Recently published alert type with action Block. The firewall always uses the Default policy, because installs are not tied to a repository.
Security Policy (legacy): Dashboard → Settings → Security Policy → Recently published → Block.
3. Test it
Find a version published today, and confirm Socket flags it before involving the firewall.
# Newest rollup version and its publish time
curl -s https://registry.npmjs.org/rollup \
| jq -r '.["dist-tags"].latest as $v | "\($v) \(.time[$v])"'
# Socket's verdict: expect a recentlyPublished alert with action "error"
curl -s -X POST "https://api.socket.dev/v0/orgs/your-org/purl?alerts=true" \
-H "Authorization: Bearer $SOCKET_API_KEY" -H 'Content-Type: application/json' \
-d '{"components":[{"purl":"pkg:npm/rollup@NEW_VERSION"}]}' \
| jq -c 'select(.name!=null)|[.alerts[]?|select(.type=="recentlyPublished")|.action]'An output of [] means Socket returned no recentlyPublished alert for that version. This happens if the version is older than the threshold or the threshold is still 0. An output of ["error"] means the alert is present and its action is Block. Request the version through the firewall to test this:
for v in NEW_VERSION 4.21.0; do
printf 'rollup@%s -> ' "$v"
curl -sk -D- -o /dev/null \
"https://sfw.example.com/npm/rollup/-/rollup-$v.tgz" \
| grep -iE '^HTTP/|^x-socket-block-reason' | tr -d '\r' | tr '\n' ' '; echo
doneReplace NEW_VERSION with the version from the first command. If the newest version is already older than your window, try another busy package such as zod or vite.
Expected output
rollup@NEW_VERSION -> HTTP/2 403 x-socket-block-reason: Recently published
[email protected] -> HTTP/2 200
Release one version early (waiver)
A waiver is a package-scoped exception for the recentlyPublished alert. Pin the version: a wildcard waives every future release of that package too.
Policies: in the Default policy, add a rule above the cooldown rule matching the package, the version, and the Recently published alert type, with action Ignore. Or resolve the alert from the alert view with a reason (see Resolve Alerts).
Security Policy (legacy): Settings → Security Policy → Alert Triage, add an entry for the package, version, and Recently published, set to Ignore.
Waiver propagationThe firewall caches each verdict for
cache.ttl. A package version the firewall has already checked keeps its old decision until its cached verdict expires. Until then the firewall keeps serving its cached403. Tell the person who asked for the waiver to wait or clear the cache. Restart the container to clear the cache. With Redis, verdicts survive a restart, so runFLUSHDBinstead. Redis instructions are at Redis.
Agree on a note format (ticket number and approver) before you start.
Verify
- Threshold is non-zero
- A version younger than the window returns 403 with
Recently published - An older version of the same package returns 200
- A waived version returns 200 after the cache expires; other new versions stay blocked
Optional: allow recent versions for some ecosystems
Add a custom rule to the Default policy on the Policies system and place it above the cooldown rule. Set the rule's conditions to alert type Recently published and the ecosystems to allow. Set the rule's action to Warn.
Package versions in those ecosystems are allowed, and the response carries a warning header. Every other ecosystem keeps the Block action.
On the older Security Policy system, or for an ecosystem the rule's ecosystem condition does not offer, use the firewall setting socket.recently_published_enabled_ecosystems. That setting applies to one firewall only. It is deprecated and will be removed in a future major release.
The setting is described at Per-ecosystem recentlyPublished downgrade.
Automate it
The threshold itself has no API; set it in the dashboard. Waivers can be scripted.
Policies
The token needs alert-policy:list and alert-policy:create (rules) or alert-resolution:create (resolutions). The firewall's own token does not have these.
ORG=your-org
DEFAULT_ID=$(curl -s -H "Authorization: Bearer $SOCKET_API_KEY" \
"https://api.socket.dev/v0/orgs/$ORG/alert-policies" \
| jq -r '.. | objects | select(.apply_method? == "unlabeled_repos") | .id' | head -1)
# Waiver as a policy rule (new rules are placed first). Add ?dry_run=true to test.
curl -s -X POST -H "Authorization: Bearer $SOCKET_API_KEY" -H 'Content-Type: application/json' \
"https://api.socket.dev/v0/orgs/$ORG/alert-policies/$DEFAULT_ID/rules" \
-d '{"name":"Cooldown waiver rollup NEW_VERSION",
"vigil_selector":{"artifact.type":"npm","artifact.name":"rollup","artifact.version":"NEW_VERSION",
"finding.alertType":"recentlyPublished"},
"action":"ignore",
"note":"Waiver TICKET-123, approved by NAME"}'
# Or as an alert resolution. reason is required:
# false_positive | remediated | tolerable_risk | other
curl -s -X POST -H "Authorization: Bearer $SOCKET_API_KEY" -H 'Content-Type: application/json' \
"https://api.socket.dev/v0/orgs/$ORG/alerts/resolutions" \
-d '{"vigil_selector":{"artifact.type":"npm","artifact.name":"rollup","artifact.version":"NEW_VERSION",
"finding.alertType":"recentlyPublished"},
"reason":"tolerable_risk",
"comment":"Waiver TICKET-123, approved by NAME"}'Security Policy (legacy)
# Set recentlyPublished to Block
curl -s -X POST -H "Authorization: Bearer $SOCKET_API_KEY" -H 'Content-Type: application/json' \
https://api.socket.dev/v0/orgs/your-org/settings/security-policy \
-d '{"policyRules":{"recentlyPublished":{"action":"error"}}}'
# Waiver as a triage entry. Returns {"result":"success"}
curl -s -X POST -H "Authorization: Bearer $SOCKET_API_KEY" -H 'Content-Type: application/json' \
https://api.socket.dev/v0/orgs/your-org/triage/alerts \
-d '{"alertTriage":[{"packageType":"npm","packageNamespace":"*","packageName":"rollup",
"packageVersion":"NEW_VERSION","alertType":"recentlyPublished","state":"ignore",
"note":"Waiver TICKET-123, approved by NAME"}]}'Reference
Updated 13 days ago