Skip to content

Add CodeQL query for reflected XSS in Vercel serverless functions#1147

Draft
murderteeth wants to merge 1 commit intomainfrom
codeql-vercel-xss
Draft

Add CodeQL query for reflected XSS in Vercel serverless functions#1147
murderteeth wants to merge 1 commit intomainfrom
codeql-vercel-xss

Conversation

@murderteeth
Copy link
Copy Markdown
Collaborator

Summary

  • CodeQL has no built-in framework model for @vercel/node, so the standard js/reflected-xss query misses vulnerabilities in api/ serverless handlers. This adds a custom CodeQL query with inline Vercel framework models that detects reflected XSS specifically.
  • Upgrades CI workflow: actions/checkout and codeql-action to v4, enables security-extended query suite, and runs the custom query pack alongside standard queries.
  • Other vulnerability types (SSRF, SQLi, command injection, etc.) in Vercel handlers are not covered by this change — that requires either duplicating the model into additional query files or contributing the model upstream to github/codeql.

What the custom model teaches CodeQL

Concept What it recognizes
Route handler Functions with a VercelRequest-typed first parameter
Request sources req.query, req.body, req.headers, req.cookies
Response sinks res.send(), res.status().send()
Headers res.setHeader() (used to determine content-type for XSS relevance)

Test plan

  • Verify CodeQL workflow runs successfully on this PR
  • Confirm the custom query detects the reflected XSS in api/vault/meta.ts
  • Confirm security-extended suite runs without regressions

🤖 Generated with Claude Code

CodeQL has no built-in framework model for @vercel/node, so the
standard js/reflected-xss query cannot detect XSS in api/ handlers.
This adds a custom query with inline Vercel framework models that
detects reflected XSS specifically. Other vulnerability types (SSRF,
SQLi, etc.) in Vercel handlers are NOT covered by this change — that
requires either duplicating the model into additional query files or
contributing the model upstream to github/codeql.

Also upgrades the CI workflow: actions to v4, enables security-extended
query suite, and runs the custom query pack alongside standard queries.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
yearnfi Ready Ready Preview, Comment Mar 30, 2026 5:59am

Request Review

@github-actions
Copy link
Copy Markdown

Dependency Review

The following issues were found:
  • ✅ 0 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ⚠️ 4 package(s) with unknown licenses.
See the Details below.

Snapshot Warnings

⚠️: No snapshots were found for the head SHA 335d730.
Ensure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice.

License Issues

.github/workflows/codeql.yml

PackageVersionLicenseIssue Type
actions/checkout4.*.*NullUnknown License
github/codeql-action/analyze4.*.*NullUnknown License
github/codeql-action/autobuild4.*.*NullUnknown License
github/codeql-action/init4.*.*NullUnknown License
Allowed Licenses: MIT, Apache-2.0, BSD-3-Clause, BSD-2-Clause, ISC, CC0-1.0, CC-BY-3.0, CC-BY-4.0, Unlicense

OpenSSF Scorecard

PackageVersionScoreDetails
actions/actions/checkout 4.*.* 🟢 6
Details
CheckScoreReason
Code-Review🟢 10all changesets reviewed
Maintained⚠️ 23 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 2
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Binary-Artifacts🟢 10no binaries found in the repo
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
License🟢 10license file detected
Fuzzing⚠️ 0project is not fuzzed
Packaging⚠️ -1packaging workflow not detected
Signed-Releases⚠️ -1no releases found
Pinned-Dependencies🟢 3dependency not pinned by hash detected -- score normalized to 3
Security-Policy🟢 9security policy file detected
Branch-Protection🟢 6branch protection is not maximal on development and all release branches
SAST🟢 8SAST tool detected but not run on all commits
actions/github/codeql-action/analyze 4.*.* UnknownUnknown
actions/github/codeql-action/autobuild 4.*.* UnknownUnknown
actions/github/codeql-action/init 4.*.* UnknownUnknown

Scanned Files

  • .github/workflows/codeql.yml

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