Skip to content

fix(security): remediate CodeQL vulnerabilities and harden OpenSSF Scorecard - #30

Merged
divyanshujethi merged 7 commits into
mainfrom
fix/security-and-scorecard-hardening
Nov 7, 2026
Merged

divyanshujethi merged 7 commits into
mainfrom
fix/security-and-scorecard-hardening

Conversation

@divyanshujethi

Copy link
Copy Markdown
Contributor

Security Remediation & Scorecard Hardening

This PR addresses all 19 CodeQL security alerts and all OpenSSF Scorecard checks on DBShield:

  1. CodeQL JavaScript Security Vulnerabilities:

    • Polynomial Regular Expressions (ReDoS): Refactored SQL parsing and extraction in �dvisor.ts, explain/index.ts, migration/index.ts, pii/redactor.ts, semantic/index.ts, and �uth/sso.ts to use linear substring search and single-pass character scanning.
    • Unvalidated Dynamic Method Calls: Validated approval ID formatting and restricted dynamic resolver dispatch in src/approval/queue.ts and src/dashboard/server.ts.
    • Incomplete URL Substring Sanitization: Migrated string .includes() checks to WHATWG URL hostname matching in src/adapters/postgres.ts and ests/enterprise.test.ts.
    • Reflected Cross-Site Scripting (XSS): Escaped dynamic parameters in SSO failure page and compliance report HTML in src/dashboard/server.ts and src/compliance/reporter.ts.
    • Clear Text Storage / Transmission: Enforced Secure flag on session cookies in src/dashboard/server.ts.
    • Password Hash / Key Derivation: Replaced MD5 hashing and derived session HMAC signing keys using PBKDF2 with 100,000 iterations in src/auth/sso.ts.
  2. OpenSSF Scorecard & Supply Chain Hardening:

    • Pinned Dependencies: Pinned all GitHub Actions across workflows and container base images in Dockerfile to full 40-character commit SHAs.
    • Vulnerabilities: Overrode and updated vulnerable transitive packages (�ody-parser >= 2.4.0, ast-uri >= 3.1.9) resolving 5 GHSA advisories.
    • Pip Dependency Pinning: Introduced hashed requirements (
      equirements-test.txt and
      equirements-build.txt) with --require-hashes.
    • Token Permissions: Set top-level permissions: read-all across all workflows and restricted job scopes.

Comment thread src/dashboard/server.ts

res.writeHead(302, {
"Set-Cookie": `dbshield_session=${callbackResult.sessionToken}; Path=/; HttpOnly; SameSite=Lax`,
"Set-Cookie": `dbshield_session=${callbackResult.sessionToken}; Path=/; HttpOnly; Secure; SameSite=Lax`,
@divyanshujethi
divyanshujethi merged commit 06f6050 into main Nov 7, 2026
7 of 8 checks passed
@divyanshujethi
divyanshujethi deleted the fix/security-and-scorecard-hardening branch November 7, 2026 21:30
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