Skip to content

Add blocked versions support to dry-run script#14916

Open
kbukum1 wants to merge 1 commit intomainfrom
kbukum1/add-blocked-versions-dry-run
Open

Add blocked versions support to dry-run script#14916
kbukum1 wants to merge 1 commit intomainfrom
kbukum1/add-blocked-versions-dry-run

Conversation

@kbukum1
Copy link
Copy Markdown
Contributor

@kbukum1 kbukum1 commented May 5, 2026

What

Add BLOCKED_VERSIONS environment variable support to bin/dry-run.rb so developers can simulate blocked dependency versions during local testing.

Why

The blocked versions feature prevents Dependabot from suggesting updates to known-malicious dependency versions. To support local development and testing of this feature, the dry-run script needs a way to pass blocked versions without requiring access to the production API.

What's Being Changed

  • bin/dry-run.rb: Added BLOCKED_VERSIONS env var parsing (JSON array format), merged blocked versions into the ignored versions list as version requirement strings, and added startup logging when blocked versions are active.

Example Usage

BLOCKED_VERSIONS='[{"dependency-name":"event-stream","version":"= 3.3.6","reason":"malware"}]' \
  bin/dry-run.rb npm_and_yarn dependabot/e2e-tests

# Version ranges are also supported:
BLOCKED_VERSIONS='[{"dependency-name":"lodash","version":"> 2.10","reason":"compromised"}]' \
  bin/dry-run.rb npm_and_yarn dependabot/e2e-tests

How to Review

  1. The env var format matches the job attribute schema: dependency-name, version (a requirement string like "= 3.3.6" or "> 2.10"), and optional reason.
  2. Blocked versions use exact name matching (case-insensitive) — no wildcard support.
  3. Entries missing dependency-name or version are defensively skipped.
  4. Blocked versions are enforced for both regular and security updates (consistent with core implementation in Add blocked versions support to updater job #14915).

@kbukum1 kbukum1 force-pushed the kbukum1/add-blocked-versions-dry-run branch 3 times, most recently from c4cffaf to c395939 Compare May 5, 2026 22:56
Add BLOCKED_VERSIONS environment variable support to bin/dry-run.rb
so developers can simulate blocked dependency versions locally without
needing access to the production API.

Usage:
  BLOCKED_VERSIONS='[{"dependency-name":"event-stream","version":"= 3.3.6","reason":"malware"}]' \
    bin/dry-run.rb npm some/repo

Changes:
- Parse BLOCKED_VERSIONS env var (JSON array, same format as job attr)
- Merge blocked versions into ignored_versions_for as version
  requirement strings (passthrough, supports exact and ranges)
- Log active blocked versions at the start of the update run
- Defensive: skip entries missing dependency-name or version

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@kbukum1 kbukum1 force-pushed the kbukum1/add-blocked-versions-dry-run branch from c395939 to 1905894 Compare May 6, 2026 22:17
@kbukum1 kbukum1 marked this pull request as ready for review May 6, 2026 23:29
@kbukum1 kbukum1 requested a review from a team as a code owner May 6, 2026 23:29
Copilot AI review requested due to automatic review settings May 6, 2026 23:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.

@kbukum1 kbukum1 requested a review from Copilot May 6, 2026 23:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants