Skip to content

fix(security): patch RSA verification and glob nesting vulnerabilities - #2918

Merged
sibuthomasmathew merged 2 commits into
mainfrom
prebuild/fix/npm-security-backports
Oct 11, 2026
Merged

sibuthomasmathew merged 2 commits into
mainfrom
prebuild/fix/npm-security-backports

Conversation

@sriaradhyula

@sriaradhyula sriaradhyula commented Oct 10, 2026 •

Copy link
Copy Markdown
Member

Description

Mitigate two current npm vulnerabilities for which no fixed release is published:

  • node-forge@1.4.0: apply an upstream backport of the exact nested DigestAlgorithm element-count guard from upstream PR 1152, addressing GHSA-86w9-cpqp-85rv / Dependabot #5452.
  • braces@3.0.3: apply a local security patch that rejects brace/parenthesis nesting above 100 before recursive AST traversal, addressing GHSA-vfj7-8cjw-p6xm / Dependabot #5456 and #5458.
  • UI/docs postinstall hooks patch every installed lockfile copy, recognize repeated application, and fail on unexpected package versions or source drift.
  • Copy the security patch script into the UI Docker dependency stage and exercise regressions in existing UI/docs CI. Ensure script changes trigger the relevant builds.
  • Document removal criteria in scripts/npm/README.md.

Published package versions remain unchanged, so static lockfile scanners will continue reporting these advisories until upstream releases fixes. No alert suppression is added. Installations using --ignore-scripts do not receive the mitigation.

AI assistance: implementation and verification performed with Codex.

Verification

  • UI regression suite: 20 passed, including valid RSA signatures with optional NULL parameters, rejected extra nested ASN.1 elements, brace/parenthesis nesting, normal patterns and source-drift checks.
  • Docs regression suite: 19 passed, 1 RSA test skipped because node-forge is absent.
  • UI lint and production build; docs production build passed.
  • Docker dependency stage built; the same 12 regressions passed inside the container.
  • Updated workflows pass actionlint syntax/expression checks (-shellcheck=''; existing unrelated shellcheck findings remain).
  • Automatic and manual prebuild eligibility regressions passed for shared npm script changes and unrelated paths.
  • The existing test:e2e:rbac-regression command matches main exactly; npm run test:e2e:rbac-regression -- --list discovered 207 tests across 32 files.
  • git diff --check passed.

Type of Change

  • Bugfix

Checklist

  • Changes are under 500 hand-written lines.
  • AI assistance used to produce this change is disclosed.
  • Relevant checks were run; results and limitations are listed above.
  • Commits include the human-provided DCO sign-off.

Follow-up

Release rebuilding, remaining vendor advisories and removal criteria for temporary security patches are tracked in #2919.

The combined dependency-upgrade and security-patch changes were also installed and built together successfully; both backport regression suites pass in that combined checkout.

Summary by CodeRabbit

  • Security
    • Added installation-time security backports for two dependencies, with checks that reject unexpected versions or source changes and verify repeated runs.
  • Tests
    • Added coverage for the security fixes and build eligibility when shared npm scripts change.
    • CI now runs the new tests and recognizes changes to shared npm scripts when deciding which builds to run.
  • Documentation
    • Documented the backports, installation behavior, verification, and production considerations.

@sriaradhyula
sriaradhyula requested a review from a team as a code owner October 10, 2026 21:17
@github-actions github-actions Bot added the size/L Changes 100-499 lines, generated files excluded. label Oct 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

✅ No proprietary content detected. This PR is clear for review!

@github-actions github-actions Bot added the dev Normal PR to main; uses dev prerelease versioning label Oct 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🧪 CAIPE UI Test Results

✅ All tests passed

🟡 Overall Coverage: 65%

Coverage
lines
statements
functions
branches

📊 Detailed Coverage

Metric Covered Total Percentage
Lines 45390 64840 70.00%
Statements 48545 71637 67.76%
Functions 8592 13543 63.44%
Branches 31591 54594 57.86%

✅ Test Suites

  • ✅ auth-guard.test.tsx - Route protection & authorization
  • ✅ token-expiry-guard.test.tsx - Token expiry handling
  • ✅ dynamic-agent-client.test.ts - Dynamic Agents streaming client
  • ✅ auth-utils.test.ts - Authentication utilities (100% coverage)
  • ✅ auth-config.test.ts - OIDC configuration
📈 Coverage Thresholds
Threshold Target Current Status
Minimum 40% 65% ✅ Pass
Good 60% 65% ✅ Pass
Excellent 80% 65% ⚠️ Below target
⚠️ Areas Needing Tests

High Priority:

  • lib/streaming/* - Core stream event handling
  • store/chat-store.ts - Chat state management
  • store/agent-skills-store.ts - Agent skills
  • lib/api-client.ts - API communication
  • lib/storage-mode.ts - MongoDB/localStorage switching

Medium Priority:

  • components/chat/ChatPanel.tsx - Main chat interface
  • lib/mongodb.ts - MongoDB integration

💡 Run locally: make caipe-ui-tests
📦 Full report: Check workflow artifacts

@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: caipe-io/ai-platform-engineering/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d44244e0-913f-4705-8730-1180e71bc018

📥 Commits

Reviewing files that changed from the base of the PR and between ae39cbc and fac83ea.


⛔ Files ignored due to path filters (1)
  • ui/package-lock.json is excluded by !**/package-lock.json, !**/package-lock.json

📒 Files selected for processing (1)
  • ui/package.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.



📝 Walkthrough

Walkthrough

The change adds a script that validates and patches installed copies of braces@3.0.3 and node-forge@1.4.0, with tests for the patches and related behavior. UI and documentation postinstall hooks run the script. The UI Docker dependencies stage copies it into the image. CI workflows include scripts/npm/** in path filters, and UI test and documentation workflows run the backport tests.


Priority: ⬆️ High

Merge Risk | ⚪ Minimal · up to fac83

Merge Risk: ⚪ Minimal · up to fac83

The RBAC regression command remains available, and the Docker install hook can reach the security patch script. No merge-blocking regression is established by this review.

Security Architecture Review

Security architecture risk: 🔵 Low · up to fac83

The mitigation is narrowly scoped and rejects unexpected dependency versions or patch patterns. Normal builds stop when installation fails. Remaining uncertainty concerns recovery from interrupted patching and confirmation of the guards in actual installed dependencies; no introduced exploitable condition was established.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The demonstrated propagation scope is UI and docs dependency installation, including the UI image dependency closure. The inspected changes establish no new tenant, service, credential, or network authority. Runtime reachability of the targeted library behavior was not established.

Trust Boundaries and Controls

  • observed — Lockfile metadata and installed package contents feed an install-time filesystem mutation. Name/version checks and patch-shape checks constrain that mutation, but the script does not independently authenticate complete dependency contents. This does not establish a new lower-trust attacker entrypoint.

Resilience and Maintainability Implications

  • inferred — Sequential direct writes permit partial mutation after a later validation failure or interrupted write; there is no explicit transaction or cross-process lock. The inspected CI installation steps and Docker retry wrapper stop normal downstream consumption on failure. Concurrent mutation of a live dependency tree was not established.

Hardening Proposals

  • proposed — For stronger recovery guarantees, consider validating all targets before mutation, using atomic per-file replacement, and documenting clean reinstallation after interruption. These are resilience improvements, not observed exploitable findings.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@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: 2


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: caipe-io/ai-platform-engineering/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0a2c5321-7d6f-4ec3-98b9-6583f2b5dc24
📥 Commits

Reviewing files that changed from the base of the PR and between 17ee43d and a3c8a17.

⛔ Files ignored due to path filters (1)
  • ui/package-lock.json is excluded by !**/package-lock.json, !**/package-lock.json
📒 Files selected for processing (10)
  • .github/workflows/caipe-ui-tests.yml
  • .github/workflows/ci-caipe-ui.yml
  • .github/workflows/docs-build-check.yml
  • .github/workflows/prebuild-caipe-ui.yml
  • build/Dockerfile.caipe-ui
  • docs/package.json
  • scripts/npm/README.md
  • scripts/npm/patch-security-dependencies.mjs
  • scripts/npm/security-backports.test.mjs
  • ui/package.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

Comment thread .github/workflows/prebuild-caipe-ui.yml
Comment thread ui/package.json
@caipe-io-ci-release

caipe-io-ci-release Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Prebuild Artifacts for `a3c8a17` (archived)

Prebuild Artifacts for a3c8a17

Branch: prebuild/fix/npm-security-backports
Commit: a3c8a17

Docker Images

Artifact Image Tag Status CI
caipe-ui ghcr.io/caipe-io/caipe-ui 1.2.0-fix-npm-security-backports-1 Published CI
Docker pull commands
docker pull ghcr.io/caipe-io/caipe-ui:1.2.0-fix-npm-security-backports-1

These prebuild artifacts will be automatically cleaned up when the PR is closed or merged.

@github-actions

Copy link
Copy Markdown
Contributor

ℹ️ Branch is behind main (advisory, non-blocking)

Commit: ae39cbc1

This branch does not yet contain the latest main. This does not fail this check — GitHub branch protection still requires the branch to be up to date before merge. Use the Update branch button on this PR, or run:

git fetch origin main
git checkout prebuild/fix/npm-security-backports
git merge FETCH_HEAD
git push

This is a prebuild/* branch — Helm prebuild publishing runs independently of this check, so you can keep testing chart changes while the branch is being updated.

@sriaradhyula sriaradhyula changed the title fix(security): backport RSA verification and glob nesting guards fix(security): patch RSA verification and glob nesting vulnerabilities Oct 10, 2026
@caipe-io-ci-release

caipe-io-ci-release Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Prebuild Artifacts for `ae39cbc` (archived)

Prebuild Artifacts for ae39cbc

Branch: prebuild/fix/npm-security-backports
Commit: ae39cbc

Docker Images

Artifact Image Tag Status CI
caipe-ui ghcr.io/caipe-io/caipe-ui 1.2.0-fix-npm-security-backports-2 Published CI
Docker pull commands
docker pull ghcr.io/caipe-io/caipe-ui:1.2.0-fix-npm-security-backports-2

These prebuild artifacts will be automatically cleaned up when the PR is closed or merged.

Patch installed node-forge and braces copies until upstream fixed releases are available, fail on source drift, and exercise guards during CI and Docker dependency installation.

Signed-off-by: Sri Aradhyula <sraradhy@cisco.com>
Signed-off-by: Sri Aradhyula <sraradhy@cisco.com>
@sibuthomasmathew
sibuthomasmathew force-pushed the prebuild/fix/npm-security-backports branch from ae39cbc to fac83ea Compare October 11, 2026 08:10
@caipe-io-ci-release

Copy link
Copy Markdown

Prebuild Artifacts for fac83ea

Branch: prebuild/fix/npm-security-backports
Commit: fac83ea

Docker Images

Artifact Image Tag Status CI
caipe-ui ghcr.io/caipe-io/caipe-ui 1.2.0-fix-npm-security-backports-2 Published CI
Docker pull commands
docker pull ghcr.io/caipe-io/caipe-ui:1.2.0-fix-npm-security-backports-2

These prebuild artifacts will be automatically cleaned up when the PR is closed or merged.

@sibuthomasmathew sibuthomasmathew 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.

  • Changes flagged by CodeRabbit were addressed
  • Ran another pass through Claude and no blockers were flagged
  • CI is green
    lgtm

@sibuthomasmathew
sibuthomasmathew merged commit ba2a261 into main Oct 11, 2026
34 checks passed
@sibuthomasmathew
sibuthomasmathew deleted the prebuild/fix/npm-security-backports branch October 11, 2026 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dev Normal PR to main; uses dev prerelease versioning size/L Changes 100-499 lines, generated files excluded.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants