Safeguard
Developer Tools•

How do you scan serverless functions inside a static site repo?

Static site repos often hide a functions folder with its own packages. Find the manifests, scan each one, and gate pull requests. Steps for a clean setup.

Safeguard Security Team
4 min read

Find every manifest in the repository, including the one inside the functions folder, scan each as a separate project, and fail pull requests that add serious known vulnerabilities. A scan of the root alone often misses the functions, which usually carry their own dependencies.

Why functions get missed

A static site repo looks simple. A site generator config sits at the root and content sits in folders. Then someone adds a function for a form, a search endpoint or a webhook. It gets its own package manifest, its own lockfile, sometimes its own runtime version. The scanner is pointed at the root, and the function never appears in a report.

Step by step

  1. Find all manifests. Search the whole tree, excluding the installed packages folder, for manifest and lockfile names used by your languages. List each directory that has one.
  2. Decide what is a project. A functions folder with its own manifest is its own project. Give it its own name in your scanner so findings do not blend with the site build.
  3. Scan from lockfiles. Lockfiles list exact resolved versions, including transitive packages. A manifest alone lists ranges, so results can differ from what actually deploys.
  4. Label runtime. Mark each project as build, shipped to browser, or server runtime. Functions are server runtime, and they often hold credentials that a build bundle never sees.
  5. Review permissions next to dependencies. What can the function reach? An email API key, a storage bucket, a database? A vulnerable package matters more in a function that holds broad access.
  6. Gate on pull requests. Run the scan on every change that touches a manifest or lockfile, and block merges that introduce critical findings you cannot justify.
  7. Rescan on a schedule. Functions can sit untouched for months while new advisories appear against their packages.

What a useful report shows

FieldWhy you want it
Project and pathSo the owner can find the code
Direct or transitiveTells you what you chose and what came along
Fixed versionTurns a finding into an upgrade task
ReachabilityShows whether your function actually calls the vulnerable code
Runtime labelSeparates browser risk from server risk

Keep the function small

The safest dependency is one you do not add. Before importing a package for one small task, check whether the platform runtime already offers it. Fewer packages means a shorter advisory list and quicker upgrades.

Try it yourself

In the dependency inventory demo, expand a package to see how a transitive entry connects back to something you installed. Imagine the same view for a functions folder.

Click through it at your own pace, or open it full screen.

Where Safeguard fits

Safeguard scans dependencies across a repository, supports policy gates on pull requests, and can open fix pull requests when you turn that on. It is off by default and every category starts on manual approval. Try the free scan at gold.safeguard.sh/scan.

Quick check

Can I use one lockfile for the site and the functions?

You can in a monorepo with workspaces, but scan each workspace as its own project so findings keep the right owner and runtime label.

Should functions be scanned more often than the site?

Often yes, because they run on a server with credentials. A weekly rescan is a sensible floor.

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.