app-security-scan
DAST-first NightVision scan for an app you just built or changed. Use when a user, or a project or org agent-instructions rule, wants a local, private, staging, or internal web app/API security-scanne
SKILL.mdskills/app-security-scan/SKILL.md
GitHubNightVision App Security Scan
Run a real DAST scan against an app you just built or changed. Source Intelligence runs first when the backend language is supported, because it improves coverage and lets findings trace back to a source file and line (Code Traceback). DAST is the expected outcome on every run, not just a generated spec.
Requirements: this skill drives the NightVision MCP server's app-security-scan harness, so it needs a server build that provides run-app-security-scan, preflight-app, wait-for-scan, summarize-scan-findings, and export-sarif with the project_path argument. On an older server these tools are missing (the call returns an unknown-tool error) or export-sarif ignores project_path and silently drops source-linking. If any of the listed tools is unavailable, update the NightVision MCP server before using this skill; running preflight-app first is the cheapest way to confirm the harness is present.
Best-supported languages and frameworks
Source Intelligence reads source code locally and deterministically to generate an OpenAPI spec for supported codebases. Source-linked results are strongest for the empirically verified languages and frameworks below:
- Python: Django REST Framework, Flask, Flask-RESTful, FastAPI, Starlette, Connexion
- JavaScript/TypeScript: Express, NestJS, Fastify, Hono
- Java: Spring Boot MVC and Data REST, JAX-RS/Jersey, Micronaut, Quarkus, Dropwizard
- C#: ASP.NET Core controllers and Minimal APIs, Web API 2
- Go:
net/http(Go 1.22+ patterns), Gin, Echo, Fiber v2 and v3, chi, gorilla/mux - PHP: Laravel
- Ruby: Rails
Django URLconf views, Grape, oRPC and httprouter extract with gaps; see source-intelligence for the full list, including frameworks that are not supported.
Treat frameworks outside this list as verify-first for source discovery. Still run DAST against reachable web apps and APIs as a WEB target when discovery is unsupported or produces no spec, but report that findings may not include source file:line traceback. Source-based discovery is REST/OpenAPI only.
Workflow
Locate the app's source directory and pass it as
project_path. Do not rely on the current working directory: a developer usually launches you from their home directory, not the repo, and Source Intelligence readsproject_pathto generate the spec that links findings to source. If you are not already in the repo, find it (the app's git root / where its source lives) and pass that absolute path. Running against the home directory is refused withproject_path_not_app_source.Know the app's URL. You are running on the developer's machine with the app's source in front of you, so you know how it serves. If it is not already running, start it with its own command (
npm run dev,docker compose up, the framework dev server). Pass that URL astarget_url. Do not ask the harness to guess it.Call
run-app-security-scanwithproject_path,target_url, the NightVision project, and the app-auth mode (see Auth). One call does preflight, Source Intelligence, target create/update, DAST start, and writes.nightvision/manifest.json. Always route the scan through this one harness call, even when the user already has a NightVision target or credential set up: pass their existing project andauth/auth_id, and the harness reuses and updates that target and refreshes Source Intelligence so its spec is not stale. Do not hand-assemble a scan fromcreate-target/start-scan/list-targets; that path skips the fresh discovery and is how a scan silently exercises a stale spec. The one exception is theverify-fixskill's narrowed retest of a single finding, which reuses the target and spec this harness just refreshed.Report the discovery result before you poll, so the user can see Source Intelligence ran and what it produced. The single harness call runs Source Intelligence, updates the target, and starts DAST in that order, but all of it is invisible from the outside: the user sees one tool call and then a long scan, which reads as "it skipped discovery and went straight to DAST". Do not let a 10+ minute scan be the first thing the user hears about. Read these fields off the result and state them in one or two sentences before the first poll:
api_discovery.status(success,no_spec,skipped, orfailed) andapi_discovery.attached_spec_file(the spec that was pushed to the target).- The endpoint count in that spec. Count the entries under
paths:in the spec file (for examplegrep -c '^ /' <attached_spec_file>) and say how many endpoints DAST will exercise. target.action(created,updated, orreused) and the resolved target'stype, nested attarget.target.type(thetargetblock wraps the action and the resolved target object). Any non-WEBtype means the spec is attached and findings can carry sourcefile:line(the backend echoes a spec-attached target asAPIorOPENAPI, so do not match onAPIalone); typeWEBmeans it is scanning without a spec. Preferapi_discovery.statusfor the coverage judgment; treat the targettypeas confirmation only.- The
scan_id. - A target the harness creates is tagged "Agent created" in NightVision, so the dashboard can show which applications an AI coding agent set up.
Anything other than
api_discovery.status: successproducing a spec-attached (non-WEB) target is a coverage problem: say so now, not after the scan burns 15 minutes against a stale or absent spec. This is the same failure the coverage floor in Reporting catches, only caught earlier.It returns a
scan_idquickly (waitdefaults to false). DAST commonly runs longer than 10 minutes, so do not assume it finished.Poll
wait-for-scanorget-scan-statusuntil a terminal status.Export SARIF and summarize: call
export-sarifwith the SAMEproject_pathyou passed to the scan (it resolves the discovered spec from that repo's.nightvision, so findings carry endpoint + source file:line; without it the spec is looked up in the shell cwd and source-linking is silently lost) andsummarize-scan-findings. Report the scan id, target, project, finding counts, and the top findings with endpoint, source file:line, evidence, and a suggested fix. If SARIF comes backsource_linked: falsebut discovery produced a spec, you passed the wrongproject_path. In a multi-language repo with several per-language specs and no canonicalopenapi.yml,export-sarifattaches the first spec and returns a warning; if the source-linking is for the wrong language, pass the right spec explicitly withswagger_file.The manifest is the local record and stays in the repo. Treat the work as incomplete until
.nightvision/manifest.jsonholds ascan_id, or you have reported a concrete blocker.
Resolve blockers the harness reports rather than working around them: not_authenticated / invalid_or_expired_token (auth), target_url_required (you did not pass the URL), runtime_url_not_reachable (the app is not up, start it), nightvision_project_required, project_path_not_app_source (you passed the home/root directory; pass the app's source directory). Use dry_run: true when the user only wants a readiness check without creating targets or starting a scan.
Unattended mode
When a project agent-instructions rule triggers this after an app is built (no human watching): start the app yourself, rely on NIGHTVISION_DEFAULT_PROJECT and the environment's NightVision token (never prompt for them; a missing one is a blocker to report), and close the loop before ending your turn. Do not leave a scan running with nobody watching: poll to a terminal status, then export SARIF and summarize. If you cannot start the app or auth is missing, report that as the concrete blocker instead of silently skipping the scan.
Auth
Two different things. NightVision account auth is the user's own NightVision token; never paste a shared token into your agent-instructions file (CLAUDE.md, AGENTS.md), a repo file, or a team config, each user authenticates as themselves. Target-app auth is how DAST logs into the app under test, passed to the scan as:
no_auth: trueto scan unauthenticated (say so; it may miss authenticated functionality).auth(named profile) orauth_id(credential UUID) for an existing NightVision app-auth credential.app_authwithtype: "playwright_script"for any username/password, OAuth, MFA, or expiring-session login. Do not turn an expiring cookie or bearer token into a header/cookie credential.app_authwithtype: "headers"or"cookies"only for stable, non-expiring credentials such as a service API key; setcredential_lifetime: "stable".
Reporting
A terminal FAILED scan can still contain valid findings: check the finding count and summarize what it found before calling a run unusable. When the user wants something to share (a PDF, a report for a manager, CISO, or another team), hand off to the scan-report skill with the same scan_id and project_path. Never claim the app is secure or scanned unless NightVision results support it. If DAST could not run, report the blocker and the manifest path.
Coverage floor: a scan that "succeeded" but exercised no endpoints is a setup failure, not a clean bill of health. If a full scan returns zero findings, or only the "target is online" informational check, or the harness sets coverage_suspect: true on the scan result, treat it as suspect: the spec was stale, Source Intelligence did not run against current source, or the target was scanned as a bare WEB target. Do not report the app as secure. Re-run run-app-security-scan with project_path set to the app's source directory so discovery regenerates the spec, confirm the scan tested real endpoints, and only then report. A known-featureful app returning nothing is the tell.
Remediation (find-to-fix)
When the user wants findings fixed and not just reported, use what each finding actually carries. It varies by class, so do not assume every finding gives you a source line or a parameter:
- Request-level findings (SQL injection, XSS, command injection, and similar) carry a source
file:line, the endpoint, the vulnerable parameter, and the proof-of-concept payload. Thefile:lineis the DAST-observable entry point (the endpoint handler), not always the sink: open it, follow the named parameter into the service or repository that uses it, find the sink, and apply the standard fix for the class (a parameterized query for SQL injection, output encoding for reflected XSS), matching the codebase's existing patterns. - Response/config-level findings (missing security headers, weak authentication method, error or stack-trace disclosure) either have no source location, or the line they carry points at whatever handler the response was observed through, which is not where the fix goes. Fix these in the app's security configuration (the header/filter/security config), not at the reported line.
NightVision does not hand you a patch (fixes/codeFlows in the SARIF are empty), and not every finding maps to source, so treat this as a locate-and-fix aid. Always re-scan and confirm the finding is gone before calling it fixed: the verify-fix skill reruns just the check that found it, or use run-app-security-scan when the fix changed routes, parameters or auth. Remediation is a follow-on to the scan, not a replacement: scan first, and only change code when the user asks for fixes (running ship-check counts as asking, for code written in the same session).