Skip to content

[GHSA-75v8-2h7p-7m2m] Formidable relies on hexoid to prevent guessing of filenames for untrusted executable content #5733

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

akabarki76
Copy link

Updates

  • Description

Comments
Based on the detailed context of the Dependabot alert for formidable@2.1.2 (introduced via supertest@6.3.3) and its low-risk vulnerability (CVE-2025-46653), here's a refined action plan addressing dependency constraints and practical mitigation strategies:


Immediate Remediation Strategy

1. Assess Actual Risk Exposure

  • Vulnerability Scope: The issue involves non-cryptographic filename generation for uploaded files. If your project:
    • Doesn't handle file uploads via formidable
    • Stores uploads in non-executable locations (e.g., cloud storage)
    • Uses additional sanitization for filenames
      Risk is negligible. Dismiss the alert with a comment like:

    "No file upload functionality used; formidable exploit path not reachable."

2. Workaround: Force Dependency Resolution

Since supertest@6.3.3 locks formidable to ^2.1.2, force an upgrade using:

  • Yarn (add to package.json):
    "resolutions": {
      "formidable": ">=3.5.4"
    }
  • npm (add to package.json):
    "overrides": {
      "formidable": ">=3.5.4"
    }
  • pnpm (add to package.json):
    "pnpm": {
      "overrides": {
        "formidable": ">=3.5.4"
      }
    }
  • Run npm install/yarn install afterward.
    ⚠️ Test thoroughly: Verify supertest compatibility with formidable@3.5.4+.

3. Upstream Advocacy

  • Create an issue in supertest:
    Request a dependency update at supertest#issues. Example:

    "Please upgrade formidable to ^3.5.4 to patch CVE-2025-46653. Current constraint (^2.1.2) exposes downstream users to low-severity vulnerability."

  • Temporary fork (last resort):

    1. Fork supertest
    2. Update its formidable dependency to ^3.5.4
    3. Install from your fork:
      npm install github:your-username/supertest#your-branch

Long-Term Prevention

1. Dependency Hardening

Technique Implementation Example
Lockfile pinning package-lock.json or yarn.lock
CI-based audits Add to GitHub Actions:
    ```yaml
    - name: Audit dependencies
      run: npm audit --audit-level=moderate
    ``` |

| SBOM generation | Use cyclonedx-npm for supply-chain visibility |

2. Architectural Mitigations

  • Isolate testing dependencies:
    {
      "devDependencies": {
        "supertest": "^6.3.3"
      }
    }
  • Runtime protection:
    // Block formidable in production if unused
    if (process.env.NODE_ENV === 'production') {
      delete require.cache[require.resolve('formidable')];
    }

3. Monitoring & Automation

  • Enable GitHub Advanced Security for:
  • Use RenovateBot for:
    • Scheduled dependency updates
    • Auto-merges for patch-level changes

Decision Tree: Next Steps

graph TD
  A[Dependabot Alert #5] --> B{Does app handle file uploads?}
  B -->|Yes| C[Force-upgrade formidable via resolutions]
  B -->|No| D[Dismiss alert with justification]
  C --> E[Test supertest functionality]
  E -->|Works| F[Deploy fix]
  E -->|Fails| G[Advocate supertest update or switch to alternatives]
  G --> H[jest-http-server or undici]
Loading

Alternative Tools

If supertest compatibility fails:

Tool Install Command Notes
undici npm install undici Fetch-compatible HTTP client
jest-http-mock npm install jest-http-mock Lightweight mock server
MSW (Mock Service Worker) npm install msw Intercepts network requests

Key Takeaways

  1. Low-risk ≠ no-risk: Even CVSS 3.1 vulnerabilities warrant evaluation.
  2. Transitive dependencies require proactive governance (e.g., npm ls formidable).
  3. Resolutions/overrides are temporary fixes—track upstream updates.

Proceed with dependency resolution (Step 2), and monitor supertest for updates. If you need help implementing CI checks or dependency graphs, share your repo structure!

@github-actions github-actions bot changed the base branch from main to akabarki76/advisory-improvement-5733 June 19, 2025 01:14
@akabarki76
Copy link
Author

Let's dive deeper into Package Manager Overrides and CI-Driven Dependency Audits/SBOM Generation, as these are actionable steps that can be implemented immediately. I'll provide concrete examples and best practices.


1. Package Manager Overrides (Forced Dependency Resolution)

Why Use Overrides?

When a transitive dependency (like formidable in supertest) is locked to a vulnerable version, overrides force your package manager to use a patched version.

Implementation Guide

npm (v8.3+)

Add to package.json:

"overrides": {
  "formidable": ">=3.5.4"
}
  • Verify: After npm install, run:
    npm ls formidable
    Output should show formidable@3.5.4 (or higher), even if supertest requests ^2.1.2.
Yarn (Classic or v1)

Add to package.json:

"resolutions": {
  "formidable": ">=3.5.4"
}
  • Run:
    yarn install
pnpm

Add to package.json:

"pnpm": {
  "overrides": {
    "formidable": ">=3.5.4"
  }
}
  • Run:
    pnpm install
Testing Compatibility
  1. Run your test suite (especially parts using supertest).
  2. Manually verify file uploads (if applicable).
  3. Check for warnings/errors during runtime.

2. CI-Driven Dependency Audits & SBOM Generation

Automated Security Scans

GitHub Actions Example

Add this workflow (.github/workflows/audit.yml):

name: Dependency Audit
on: [push, pull_request, schedule]

jobs:
  audit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
      
      - name: Audit dependencies
        run: npm audit --audit-level=moderate  # Fails on moderate+ vulnerabilities

      - name: Generate SBOM (CycloneDX)
        run: |
          npm install -g @cyclonedx/cyclonedx-npm
          cyclonedx-npm --output bom.xml
      - uses: actions/upload-artifact@v3
        if: always()
        with:
          name: sbom
          path: bom.xml
Key Features:
  • Runs on every push/PR + weekly (schedule).
  • Fails CI if vulnerabilities ≥ "moderate" are found.
  • Generates a Software Bill of Materials (SBOM) for supply chain tracking.

SBOM Analysis Tools

  1. Dependency-Track (Open-source):
    # Upload bom.xml to analyze
    curl -X POST "http://dependency-track-api/boms" \
      -H "X-API-Key: YOUR_KEY" \
      -F "bom=@bom.xml"
  2. GitHub Dependency Graph:
    • Enable in repo settings under "Code security and analysis".

3. Monitoring Transitive Dependencies

Proactive Checks

  1. List all instances of a dependency:

    npm ls formidable

    Example output:

    my-app@1.0.0
    └─┬ supertest@6.3.3
      └── formidable@2.1.2  # Overridden to 3.5.4
    
  2. Integrate with RenovateBot:

    • Add renovate.json:
      {
        "extends": ["config:recommended"],
        "dependencyDashboard": true,
        "packageRules": [
          {
            "matchDepTypes": ["dependencies"],
            "rangeStrategy": "bump"
          }
        ]
      }
    • Automatically raises PRs for outdated dependencies.

Troubleshooting Overrides

Issue Solution
Override not applying Run npm install --force or delete node_modules + package-lock.json
Dependency conflicts Use npm explain <package> to debug resolution
Broken functionality Test with --omit=dev to isolate production impacts

Next Steps

  1. Implement overrides (choose the right method for your package manager).
  2. Set up CI auditing (start with the GitHub Actions example).
  3. Generate an SBOM and explore tools like Dependency-Track.

Would you like help customizing these examples for your specific project structure? For instance, if you use Yarn Workspaces or Docker-based CI, the setup would differ slightly.

@akabarki76 akabarki76 closed this Jun 19, 2025
@github-actions github-actions bot deleted the akabarki76-GHSA-75v8-2h7p-7m2m branch June 19, 2025 02:34
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.

1 participant