redhat-developer / redhat-developer/rhdh-plugins

Automate yarn dedupe for Dependabot security PRs

Open
#4,017 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement feature ready-for-triage triaged
Dominant language
TypeScript
Stars
48
Forks
120
Avg merge
2d 6h
Merged PRs (30d)
337

Description

What happened

PR #3996 was a Dependabot security bump of form-data 2.5.5→2.5.6 in /workspaces/scorecard. The bump changed the hasown dependency range from ^2.0.2 to ^2.0.4, introducing a duplicate resolution in yarn.lock (both hasown@2.0.2 and hasown@2.0.4 present). A human had to manually trigger /fs-fix run yarn dedupe and commit the changed yarn.lock file at 20:46 UTC — over 4 hours after the PR was created — to consolidate the duplicate. The same pattern occurred on the same day on PR #4000 (launch-editor bump in install-dynamic-plugins), which also required manual /fs-fix for yarn dedupe.

What could go better

The repo already solves this problem for Renovate PRs via the yarnDedupeHighest post-update option in .github/renovate.json. However, Renovate has vulnerabilityAlerts disabled, so Dependabot handles security alerts — without the benefit of automatic deduplication. The existing automate_renovate_changesets.yml workflow already triggers on Dependabot PRs (it checks for dependabot[bot] in the author) and has write access to the branch, but only generates changesets — it does not run dedupe. This means every Dependabot security PR that introduces a transitive dependency version change requires manual human intervention to run a mechanical yarn dedupe command. Confidence is high: the pattern is clearly reproducible (two instances on the same day) and the root cause is well-understood (Dependabot lacks Renovate's postUpdateOptions).

Proposed change

Extend the existing automate_renovate_changesets.yml workflow (or create a sibling workflow) to run yarn dedupe in the affected workspace for Dependabot PRs before generating changesets. The workflow already checks out the PR branch with write access and has Node.js set up. The implementation would: (1) detect the affected workspace from the changed yarn.lock path, (2) run yarn install and yarn dedupe in that workspace directory, (3) commit any lockfile changes. This mirrors what the version-bump.yml workflow already does (lines 107-109: yarn dedupe step after version bumps). An alternative approach is to enable vulnerabilityAlerts in .github/renovate.json, letting Renovate handle security updates with automatic deduplication — but this may conflict with the team's current security alerting preferences.

Validation criteria

The next 3 Dependabot security PRs on this repo that introduce transitive dependency changes should have yarn dedupe run automatically without requiring manual /fs-fix intervention. The PRs should arrive with a clean, deduplicated yarn.lock and pass CI without human lockfile maintenance.


Generated by retro agent from https://github.com/redhat-developer/rhdh-plugins/pull/3996

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with .github/automate_renovate_changesets.yml and inspect its existing Dependabot trigger, checkout, Node.js setup, and changeset steps. Compare the deduplication step in version-bump.yml and the yarnDedupeHighest setting in .github/renovate.json. Done means affected Dependabot security PRs receive a deduplicated yarn.lock and pass CI without manual /fs-fix intervention.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions
Domain
build-system, ci-cd
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.