What the agent does
The agent clones the library into its own cloud sandbox and reads its workflows the way Scorecard will. In a library like colinhacks/zod, the repository is a workspace of packages under packages with zod at 4.6.7, managed by nub@0.8.3 as packageManager, linted with Biome, tested with Vitest, and guarded by Husky and lint-staged. Under .github/workflows, test.yml runs on pushes and pull requests with permissions: contents: read, pinning nubjs/setup-nub to a commit SHA with a version comment but leaving actions/checkout@v7 on a mutable tag. release.yml runs only on workflow_dispatch, holds the publish on a release-approval environment, and limits its jobs to contents: read plus id-token: write for provenance, with a comment explaining the tag ruleset and deploy key behind it. lockstep.yml and iso-4217.yml run on a schedule, stale.yml uses actions/stale@v11 with issues: write, and pullfrog.yml and claude.yml run agents with broader permissions, including contents: write and id-token: write in the first. There is a SECURITY.md, no dependabot.yml, no renovate.json and no CODEOWNERS.
It adds .github/workflows/scorecard.yml first, pinned the way Scorecard itself expects: actions/checkout, ossf/scorecard-action and github/codeql-action/upload-sarif each by commit SHA with the version in a comment, top-level permissions: read-all, and job permissions of security-events: write to upload SARIF and id-token: write to publish results, with publish_results: true so the badge and the public API carry the score. It runs on a weekly schedule, on pushes to main, and on branch_protection_rule, so a change to the branch rules re-scores at once.
Then it does the cheap part of the remediation in the same change, because a Scorecard that only reports is a number nobody owns. For Pinned-Dependencies it pins every uses: still on a tag, actions/checkout, actions/stale, anthropics/claude-code-action and pullfrog/pullfrog, to the commit the tag points at, keeping the version in a comment, and leaves nubjs/setup-nub as it is because it is already pinned. For Token-Permissions it adds a top-level permissions: contents: read to lockstep.yml, the one workflow with no block at all, so the default token stops being write-all there, and leaves the workflows that already scope permissions per job as they are. It does not reduce pullfrog.yml or iso-4217.yml, which open pull requests and need their write scopes, and says so. For Dependency-Update-Tool it adds .github/dependabot.yml for the github-actions ecosystem only, since the nub lockfile is not an ecosystem Dependabot can read, and notes the gap.
It verifies what it can in the sandbox: it runs the Scorecard CLI against the checked-out repository in local mode to confirm the pinning and permission checks now pass on the files, checks each pinned SHA resolves to the tag it replaced with git ls-remote, and runs actionlint over every workflow. The checks it cannot change, Branch-Protection, Code-Review, Signed-Releases and Fuzzing, get a paragraph each in the pull request with what the repository already does, such as the dispatch-only release with a required reviewer, and what the maintainers would have to decide. Nothing under packages changes.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Add the OpenSSF Scorecard to this TypeScript library. Read every workflow under .github, the security policy and the repository settings you can see first, and list which Scorecard checks will fail and why. Add a scorecard workflow pinned by commit SHA with minimal permissions, publishing results and uploading SARIF, on a weekly schedule, pushes to the default branch and branch protection changes. In the same change pin every action still referenced by a tag to its commit with the version in a comment, add a read-only top-level permissions block to workflows that have none, and add a Dependabot config for GitHub Actions; leave workflows that must write with their scopes and say which. Verify with the Scorecard CLI in local mode, git ls-remote for each pin and actionlint, and open a pull request that explains each check you fixed and each you could not. Do not change the packages.",
"resources": [
{
"url": "https://github.com/your-org/your-app"
}
]
}- Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
- Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
- Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.
What comes back
What comes back is a pull request adding .github/workflows/scorecard.yml and .github/dependabot.yml, and editing the existing workflows to pin actions and add read-only permission blocks. The description has one row per Scorecard check: fixed in this change, already passing, or needs a maintainer decision, each with the file and the reason, and a table of every pinned action with the tag it had and the commit it now has.
The run's record keeps the local Scorecard run, the git ls-remote lookups behind every pin and the actionlint output from the sandbox, so a reviewer can confirm each SHA matches its tag without repeating the lookups.
Before merging, a reviewer checks that the pinned commit of each action is the one the team wants, confirms the workflows left with write scopes really need them, and decides whether to add the Scorecard badge to the README once the first scheduled run has published a score.
Run it on every library repository without a Scorecard
A maintainer of several packages hands this off from the terminal once per repository: one POST /o/{org}/sessions with this body and the repository in resources, and a request_id that is a UUID v5 of the repository name so a retried call returns the run it already started. The key's webhook_url reports each finished run with its pull request.
Each run reads that repository's own workflows, so a library that already pins everything gets only the Scorecard workflow and the Dependabot config, and one with a renovate.json gets no Dependabot file at all; the prompt does not change between repositories.
The use case this job follows, with its automation and trigger: Hand off a long task.
Why run it on Rush?
Adding Scorecard is one workflow file; making the score mean something is reading every other workflow with the checks in mind and knowing which failures are a one-line fix and which are a policy decision. The agent does that reading in its own sandbox, pins and tightens what is safe to touch, verifies each pin against the remote, and leaves the rest as explained findings rather than silent gaps.
The same body runs across every package an organisation publishes, and each pull request carries its own check table and its own pin list. That is how a maintainer gets a consistent baseline across repositories, with the run's record showing exactly what was checked.
Frequently asked questions
Why pin actions to commits when tags are easier to read?
Because a tag can be moved and a commit cannot, and Scorecard's Pinned-Dependencies check counts every mutable reference. The pull request keeps the version in a comment next to each SHA, the same style test.yml already uses for nubjs/setup-nub, and the Dependabot config for GitHub Actions bumps the SHA and the comment together.
Will this change how the library is published?
No. release.yml is left as it is apart from pinning; its dispatch-only trigger, the release-approval environment and the tag ruleset are things Scorecard rewards. The pull request names them under the checks that already pass.
Why only GitHub Actions in the Dependabot config?
Because the repository's packageManager is nub, and Dependabot has no manager for its lockfile. The Actions ecosystem works regardless of package manager and satisfies the Dependency-Update-Tool check. The pull request notes that package updates stay a manual or Renovate job.
Can the agent fix Branch-Protection or Code-Review?
No, and it says so. Those checks read repository settings and merge history, not files, so they need a maintainer to require reviews or change a ruleset. The pull request lists what each check wants and what the repository does today, so the decision is informed rather than guessed.
Does publishing results expose anything private?
The published result is the score and the per-check findings for a public repository, the same data anyone could compute by running Scorecard against it. publish_results is what powers the badge and the public API; the agent sets it to true for a public library and would leave it off for a private one.
More TypeScript library jobs
The same job on other stacks
- Add OpenSSF Scorecard to a Repository with GitHub Actions (GitHub Actions)
- Add OpenSSF Scorecard to a Python Project (Python)
More jobs like this: Hand off a long task
- Add OpenTelemetry Tracing to an Actix Web App (Actix Web)