Skip to content

chore(security): add action for fixing vulnerabilities - #4453

Merged
Tommy Nguyen (tido64) merged 4 commits into
mainfrom
chore/fix-vulnerabilities-action
Nov 12, 2026
Merged

Tommy Nguyen (tido64) merged 4 commits into
mainfrom
chore/fix-vulnerabilities-action

Conversation

@tido64

Copy link
Copy Markdown
Member

Description

Adds a composite action that audits Yarn projects, re-resolves vulnerable packages in the lockfile, hands remaining advisories to Copilot CLI, verifies that changes stay within release lines, and creates or updates a pull request. Runs weekly in rnx-kit, and can be run locally with node --run fix-vulnerabilities.

Test plan

node --run fix-vulnerabilities

Adds a composite action that audits Yarn projects, re-resolves
vulnerable packages in the lockfile, hands remaining advisories to
Copilot CLI, verifies that changes stay within release lines, and
creates or updates a pull request. Runs weekly in rnx-kit, and can be
run locally with `node --run fix-vulnerabilities`.
@github-actions github-actions Bot added the chore Improvements that don't directly affect features label Nov 10, 2026
- Rename script to `action.mts` and prompt to `prompt.template.md`
- Require a clean worktree including untracked files, since rejected changes
  are cleaned up with `git clean`

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@JasonVMo Jason Morse (JasonVMo) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm curious whether you have tried to just run the agents with an explicit set of instructions? I have a fix security updates skill in FURN for instance that I run manually but it would be good to compare the results.

This looks very cool and I see the agent fallback, but I worry about fragility. It would be good to do a comparison.

- Quote arguments on Windows instead of letting Node concatenate them
  unquoted with `shell: true`, which split arguments containing spaces
  (e.g. `--allow-tool=shell(yarn dedupe)`) and printed DEP0190
- Read `npmMinimalAgeGate` with `--json` since Yarn colors its output on
  GitHub Actions, which caused the age gate disabled pass to be skipped
- Pass `--no-auto-update` so that Copilot CLI runs the pinned version

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@tido64

Copy link
Copy Markdown
Member Author

I'm curious whether you have tried to just run the agents with an explicit set of instructions? I have a fix security updates skill in FURN for instance that I run manually but it would be good to compare the results.

This looks very cool and I see the agent fallback, but I worry about fragility. It would be good to do a comparison.

I have no data for this but I find this approach to be more consistent than just running everything through agents. The first few steps are always the same. List all alerts, try to update the affected packages individually. It is only when we need to traverse up the dependency tree and make decisions that agents are used.

@tido64
Tommy Nguyen (tido64) enabled auto-merge (squash) November 11, 2026 15:20
Copilot CLI matches shell permission rules on the first-level subcommand
only, so `shell(yarn npm audit)` and `shell(yarn npm info)` never matched
and every such command was denied on CI. Allowing `shell(yarn npm)` would
also allow e.g. `yarn npm publish`, so remove them instead. The script
already re-audits Copilot's changes.

Also list the allowed commands in the prompt so Copilot doesn't attempt
pipes or other commands.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@tido64

Copy link
Copy Markdown
Member Author

Some data:

Repo Arm Time Fixed AI credits Tokens (output)
rnx-kit hybrid 94 s 4/7 18.0 402k (3.4k)
rnx-kit Copilot only 97 s 4/7 28.1 654k (5.2k)
react-native-test-app hybrid 65 s 0/3 18.6 349k (3.8k)
react-native-test-app Copilot only 74 s 0/3 20.6 432k (3.6k)
fluentui-react-native hybrid 79 s 0/4 22.8 466k (3.4k)
fluentui-react-native Copilot only 79 s 0/4 24.7 538k (4.4k)

@github-actions

Copy link
Copy Markdown
Contributor

Agent evals

⚠️ 2 not checked · ⏭️ 11 skipped · ✅ 6 passed

⚠️ Not checked (2)

  • Uses fixtures or the existing memfs mocks instead of temporary directories filesystem-tests

    Request session.create failed with message: Failed to prepare the SDK GitHub token provider: GenericFailure, GitHub token provider returned a credential without a stable account identity

  • Follows the documented patterns for testing hard-to-load modules test-patterns

    Request session.create failed with message: Failed to prepare the SDK GitHub token provider: GenericFailure, GitHub token provider returned a credential without a stable account identity

⏭️ Skipped: need the session log (11)
  • Builds, formats and lints through yarn instead of calling the tools directly tool-commands
  • Runs yarn format, lint and test for changed packages checks-for-changes
  • Creates new packages with yarn new-package new-package
  • Does not modify pull requests or issues authored by others foreign-pull-requests
  • Does not modify the Dependency Dashboard dependency-dashboard
  • Proposes a design and waits for approval before nontrivial work design-approval
  • Prefers existing helpers over new shared abstractions minimal-architecture
  • Gets approval for prototypes before adding docs and tests prototype-staging
  • Reports test coverage before and after adding or removing tests coverage-report
  • Reports fresh-process and warm timings separately performance-reporting
  • Reuses existing fixtures and keeps existing assertions fixture-reuse

Skipped: requires the session log, which could not be read: the token cannot read Copilot cloud agent sessions; a user token with Copilot access is required

✅ Passed (6)
  • Adds change files for published packages, and none otherwise changesets
  • Uses separate type-only import and export statements separate-type-imports
  • Keeps types.ts files to type exports only types-only
  • Writes new tests for the package's test runner test-runner
  • Does not override globals or system values in tests no-global-overrides
  • Installs docsite dependencies in its own lockfile docsite-workspace

Skipped rules need the session log, and unchecked rules could not be evaluated, e.g. because the grader needs Copilot access. To audit them, run the following in evals/:

  • Copilot cloud agent: yarn eval:report 4453
  • Copilot CLI: yarn eval:report on the branch, on the machine that ran the session

Audited fca0f35. This check only reports.

@tido64
Tommy Nguyen (tido64) merged commit 53a160b into main Nov 12, 2026
16 checks passed
@tido64
Tommy Nguyen (tido64) deleted the chore/fix-vulnerabilities-action branch November 12, 2026 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Improvements that don't directly affect features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants