Skip to content

fix(deps): patch brace-expansion and PostCSS advisories - #61

Merged
0xJem merged 3 commits into
masterfrom
fix/pnpm-audit-20260731
Aug 3, 2026
Merged

fix(deps): patch brace-expansion and PostCSS advisories#61
0xJem merged 3 commits into
masterfrom
fix/pnpm-audit-20260731

Conversation

@0xJem

@0xJem 0xJem commented Jul 31, 2026

Copy link
Copy Markdown
Member

Summary

Patch the three high-severity pnpm advisories by resolving brace-expansion to 5.0.8 and PostCSS to 8.5.18. GitHub Actions checkouts no longer persist credentials, and workflow permissions are limited to the access each job requires.

Validation

  • Clean unfrozen and frozen pnpm 11.13.0 installs
  • pnpm audit --audit-level moderate: zero moderate, high, or critical findings; one existing low body-parser advisory remains
  • Runtime-version alignment, lint/format checks, full workspace build and tests, and local snapshot generation
  • Required indexer, frontend, snapshot-gateway, and snapshot-publisher Docker builds
  • Local CodeRabbit committed-scope review against master

Additional Hasura/Trivy verification was blocked by a Docker BuildKit metadata input/output error; no vulnerability ignore was added.

Summary by CodeRabbit

  • Security
    • Improved automation security by limiting repository permissions and preventing checkout credentials from being retained.
    • Updated dependency resolutions to address known security issues in brace-expansion and postcss.
    • Dependency audits now fail for moderate-or-higher findings and provide results for review.
    • Added automated pull request reporting for dependency audit findings.
  • Reliability
    • Updated the container image with additional runtime libraries for improved compatibility.

@railway-app

railway-app Bot commented Jul 31, 2026

Copy link
Copy Markdown

🚅 Deployed to the protocol-visualizer-pr-61 environment in protocol-visualizer

Service Status Web Updated (UTC)
hasura ✅ Success (View Logs) Aug 1, 2026 at 2:47 pm
frontend ⏭️ Skipped (View Logs) Aug 1, 2026 at 2:43 pm
snapshot-gateway ⏭️ Skipped (View Logs) Aug 1, 2026 at 2:43 pm
indexer ⏭️ Skipped (View Logs) Aug 1, 2026 at 2:43 pm
snapshot-monitor ⏭️ Skipped (View Logs) Aug 1, 2026 at 2:43 pm
snapshot-publisher ⏭️ Skipped (View Logs) Aug 1, 2026 at 2:43 pm

@railway-app
railway-app Bot temporarily deployed to protocol-visualizer / protocol-visualizer-pr-61 July 31, 2026 05:41 Destroyed
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7397eee8-5261-4266-981b-e5b2b355772b

📥 Commits

Reviewing files that changed from the base of the PR and between 16f2a1e and 1d5e23e.

📒 Files selected for processing (1)
  • Dockerfile-hasura

Walkthrough

The pull request restricts workflow permissions and checkout credentials. It separates dependency audit execution from pull request reporting through an artifact. It updates dependency overrides, Docker runtime packages, and configuration tests.

Changes

Audit workflow hardening

Layer / File(s) Summary
Workflow access hardening
.github/workflows/audit.yml, .github/workflows/ci.yml, .github/workflows/security-scan.yml
Jobs use explicit repository permissions where required. Checkout steps disable persisted credentials.
Audit artifact pipeline
.github/workflows/audit.yml
The workflow runs pnpm audit, uploads the JSON result for one day, and fails on moderate-or-higher findings.
Pull request audit reporting
.github/workflows/audit-comment.yml, tests/config.test.mjs
A separate workflow validates audit results, filters advisories, and updates or creates a marked pull request comment. Tests verify the workflow separation and prohibited setup steps.
Dependency override hardening
pnpm-workspace.yaml
Workspace overrides raise brace-expansion to 5.0.8 and postcss to 8.5.18 for the specified version ranges.
Runtime package upgrades
Dockerfile-hasura
The Docker image upgrade list includes libc, Kerberos, and PAM runtime packages.

Estimated code review effort: 3 (Moderate) | ~30 minutes

Possibly related PRs

Suggested reviewers: zeroxnoodle

Sequence Diagram(s)

sequenceDiagram
  participant DependencyAudit
  participant AuditArtifact
  participant AuditComment
  participant PullRequest
  DependencyAudit->>DependencyAudit: Run pnpm audit
  DependencyAudit->>AuditArtifact: Upload JSON result
  AuditComment->>AuditArtifact: Download JSON result
  AuditComment->>AuditComment: Validate and filter advisories
  AuditComment->>PullRequest: Update or create audit comment
Loading

Poem

A rabbit checks each audit gate,
Stores the results while they wait.
Read-only paws secure the trail,
Findings hop into comments without fail.
Patched packages guard the crate.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the primary dependency changes that address the brace-expansion and PostCSS advisories.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/pnpm-audit-20260731

Comment @coderabbitai help to get the list of available commands.

@0xJem 0xJem self-assigned this Jul 31, 2026
zeroxnoodle
zeroxnoodle previously approved these changes Jul 31, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/audit.yml:
- Around line 13-15: Update the audit workflow permissions to read-only by
removing pull-requests: write from the job that checks out and executes pull
request code, including .github/actions/bootstrap. Move comment creation into a
separate trusted job that does not execute the pull request revision, granting
that job the required pull request write permission.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8b383970-acfc-4969-878d-a9c3e3f750a1

📥 Commits

Reviewing files that changed from the base of the PR and between 3867677 and 025114e.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (4)
  • .github/workflows/audit.yml
  • .github/workflows/ci.yml
  • .github/workflows/security-scan.yml
  • pnpm-workspace.yaml

Comment thread .github/workflows/audit.yml Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
tests/config.test.mjs (1)

105-108: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Test persisted checkout credentials.

The test does not assert persist-credentials: false. A later change can restore persisted checkout credentials while this security-isolation test still passes.

Proposed test update
   assert(!auditWorkflow.includes("pull-requests: write"));
   assert(!auditWorkflow.includes("github_token:"));
+  assert(auditWorkflow.includes("persist-credentials: false"));
   assert(auditWorkflow.includes("pnpm audit --audit-level moderate --json"));
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/config.test.mjs` around lines 105 - 108, Update the auditWorkflow
assertions in the configuration test to explicitly verify that the checkout
configuration contains persist-credentials: false, while preserving the existing
assertions covering permissions, tokens, audit execution, and artifact upload.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/audit-comment.yml:
- Around line 21-27: Update the “Download audit result” workflow step to inspect
the artifact archive without extracting untrusted contents first, enforcing
limits on entry names and total uncompressed size, including the 1 MiB bound.
Extract only after validation, then validate audit.json against the expected
advisory schema and safely reject null or malformed advisory entries before
creating a comment.

---

Nitpick comments:
In `@tests/config.test.mjs`:
- Around line 105-108: Update the auditWorkflow assertions in the configuration
test to explicitly verify that the checkout configuration contains
persist-credentials: false, while preserving the existing assertions covering
permissions, tokens, audit execution, and artifact upload.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 40f7f3c1-d152-4107-bf09-a4dfeff907ca

📥 Commits

Reviewing files that changed from the base of the PR and between 025114e and 16f2a1e.

📒 Files selected for processing (3)
  • .github/workflows/audit-comment.yml
  • .github/workflows/audit.yml
  • tests/config.test.mjs

Comment on lines +21 to +27
- name: Download audit result
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
with:
name: pnpm-audit-result
path: ${{ runner.temp }}/pnpm-audit-result
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C 5 \
  'actions/download-artifact|fs\.statSync|Object\.values\(result\.advisories|actions/upload-artifact|\.github/actions/bootstrap' \
  .github/workflows/audit.yml .github/workflows/audit-comment.yml

: "${RUN_ID:?Set RUN_ID to a completed Dependency Audit run ID}"
gh api "repos/${GITHUB_REPOSITORY}/actions/runs/${RUN_ID}/artifacts" \
  --jq '.artifacts[] | select(.name == "pnpm-audit-result") | {id, size_in_bytes, expired}'

Repository: OlympusDAO/protocol-visualizer

Length of output: 4237


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- audit.yml ---'
cat -n .github/workflows/audit.yml
printf '%s\n' '--- audit-comment.yml ---'
cat -n .github/workflows/audit-comment.yml
printf '%s\n' '--- bootstrap action files ---'
git ls-files '.github/actions/bootstrap*' '.github/actions/bootstrap/**' | while IFS= read -r f; do
  printf '\n--- %s ---\n' "$f"
  cat -n "$f"
done
printf '%s\n' '--- related workflow triggers and artifact references ---'
rg -n -C 4 'workflow_run|pull_request|pnpm-audit-result|audit\.json|pnpm audit|check:runtime-versions' .github package.json

Repository: OlympusDAO/protocol-visualizer

Length of output: 19715


🌐 Web query:

GitHub Actions workflow_run untrusted code artifacts security warning download-artifact pull_request workflow

💡 Result:

Using the workflow_run trigger in GitHub Actions presents significant security risks, primarily due to the potential for privilege escalation and artifact poisoning [1][2][3]. Because workflows triggered by workflow_run operate with the base repository's privileged context—including access to repository secrets and write-scoped GITHUB_TOKEN—they must never implicitly trust artifacts or code originating from an untrusted source, such as a pull request from a fork [1][4][5]. Security Risks 1. Privilege Escalation: A common, vulnerable pattern involves using a pull_request trigger for untrusted, low-privilege tasks, followed by a workflow_run trigger for privileged tasks [6][7]. If the second workflow assumes the triggering build's output is safe, an attacker can compromise the privileged environment by injecting malicious code or configurations into the preceding, unprivileged workflow [1][3][5]. 2. Artifact Poisoning: When a workflow_run workflow downloads artifacts created by an untrusted upstream run, those artifacts can be poisoned [2][4][8]. If the privileged workflow executes, extracts, or uses these files without strict validation, it can lead to arbitrary code execution, secret exfiltration, or unauthorized repository modifications [1][3][8][5]. Best Practices for Secure Implementation - Treat All Artifacts as Untrusted: Never assume artifacts are safe [2][4][8]. Always validate their contents and shape before use [4][5][9]. - Isolate Extraction: When using actions/download-artifact, extract files to a temporary directory (e.g., ${{ runner.temp }}/artifacts/) to prevent them from overwriting critical workspace files [2][8][9]. - Avoid Executing Artifacts: Do not execute binaries, scripts, or configurations directly from downloaded artifacts [4][8][5]. - Verify Origin: If possible, verify the origin of the workflow run within your job. For example, you can check if the triggering workflow originated from a fork and exit the job if it did [7]. - Minimize Permissions: Explicitly limit the permissions of the workflow_run job to only what is strictly necessary, rather than relying on default elevated scopes [1][7]. - Keep Dependencies Updated: Ensure you are using the latest versions of actions/download-artifact (version 4.1.3 or higher is required to mitigate specific path traversal vulnerabilities) [10][11]. In summary, the most secure approach is to decouple privileged operations from untrusted code entirely. If a workflow must consume output from a workflow that might have processed fork code, implement strict isolation and validation of all inputs [6][4][7].

Citations:


🌐 Web query:

actions/download-artifact v5 extraction archive size limit artifact download behavior

💡 Result:

The actions/download-artifact@v5 action does not explicitly document a specific "archive size limit" for extraction, though it operates under the general limitations of the GitHub Actions artifact service [1][2]. Users have reported failures during artifact downloads, particularly when dealing with a high number of files or complex directory structures, which can trigger errors such as "Artifact download failed after 5 retries" [1]. Regarding download behavior in v5: 1. Path Consistency: The primary change in v5 is a breaking fix that standardizes path behavior for single artifact downloads [3][4]. Previously, downloading a single artifact by name extracted directly to the specified path/, while downloading by ID created a nested directory (path/artifact-name/) [3][5]. In v5, both methods now extract directly to the specified path/ [3][6]. 2. Migration: If your workflow relied on the previous nested structure when downloading by ID, you must now explicitly include the artifact name in your path input (e.g., path: dist/my-artifact) to maintain that structure [3][4]. 3. General Behavior: When merge-multiple is set to false (the default), multiple artifacts are extracted into individual named directories within the specified path [6][7]. If merge-multiple is true, they are extracted directly into the same directory [6][7]. If you encounter persistent download errors, it is often recommended to verify your environment, as some users have resolved these issues by managing dependencies (e.g., removing node_modules before upload) or updating related actions [1]. Additionally, note that file permissions are not natively preserved during upload/download (files default to 644, directories to 755) unless you use a workaround like tar [8][2].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

node - <<'JS'
const cases = [
  { name: "null advisory", result: { advisories: { x: null } } },
  { name: "primitive advisory", result: { advisories: { x: "bad" } } },
  { name: "missing advisories", result: {} },
  { name: "valid advisory", result: { advisories: { x: { severity: "high" } } } },
];

for (const { name, result } of cases) {
  try {
    const advisories = Object.values(result.advisories ?? {});
    const reportable = advisories
      .filter((advisory) =>
        ["moderate", "high", "critical"].includes(advisory.severity)
      )
      .slice(0, 50);
    console.log(name, "=>", reportable.length);
  } catch (error) {
    console.log(name, "=>", error.name + ": " + error.message);
  }
}
JS

printf '%s\n' '--- tracked runtime declarations ---'
git ls-files | while IFS= read -r f; do
  case "$f" in
    package.json|.nvmrc|.node-version|.github/workflows/*|Dockerfile*)
      printf '\n--- %s ---\n' "$f"
      rg -n 'engines|node-version|node-version-file|FROM node|NODE_VERSION|\.nvmrc|\.node-version' "$f" || true
      ;;
  esac
done

Repository: OlympusDAO/protocol-visualizer

Length of output: 1619


Validate the audit artifact before extraction.

The PR workflow can upload untrusted audit.json content. actions/download-artifact extracts it before the 1 MiB check, so a large or highly compressed artifact can consume runner storage. The accepted JSON {"advisories":{"x":null}} also causes advisory.severity to throw. Download and inspect the archive with bounds on entry names and uncompressed size, then validate the JSON schema before creating a comment.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/audit-comment.yml around lines 21 - 27, Update the
“Download audit result” workflow step to inspect the artifact archive without
extracting untrusted contents first, enforcing limits on entry names and total
uncompressed size, including the 1 MiB bound. Extract only after validation,
then validate audit.json against the expected advisory schema and safely reject
null or malformed advisory entries before creating a comment.

@railway-app
railway-app Bot temporarily deployed to protocol-visualizer / protocol-visualizer-pr-61 August 1, 2026 14:43 Destroyed
@0xJem
0xJem merged commit d0a9480 into master Aug 3, 2026
18 checks passed
@0xJem
0xJem deleted the fix/pnpm-audit-20260731 branch August 3, 2026 07:13
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