Lint an OpenAPI/AsyncAPI/Arazzo spec for API security defects with Spectral — missing auth, non-HTTPS servers, basic auth, PII-named params, absent rate-limit/error schemas — and emit both normalized findings AND endpoint nodes into the graph so the rest of the pipeline grounds on the API before code runs. Use when a security engineer has an API definition and wants design-time (shift-left) API security plus endpoints the DAST and data-flow skills can target.
10 stars
0 votes
0 copies
0 views
Added December 1, 2026
ai-agentsgonodeapisecurity
Works with
cli
api
mcp
Security analysis
A92/100
mediumInstalls packages at runtime which could introduce malicious dependencies
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Api Spec Lint?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/asterguard-api-spec-lint)
---
name: api-spec-lint
description: Lint an OpenAPI/AsyncAPI/Arazzo spec for API security defects with Spectral — missing auth, non-HTTPS servers, basic auth, PII-named params, absent rate-limit/error schemas — and emit both normalized findings AND endpoint nodes into the graph so the rest of the pipeline grounds on the API before code runs. Use when a security engineer has an API definition and wants design-time (shift-left) API security plus endpoints the DAST and data-flow skills can target.
---
# API Spec Lint
Catch API security defects at design time, from the spec alone — before an endpoint is live or a line
of handler code exists. This skill runs Spectral over an OpenAPI/AsyncAPI/Arazzo document and produces
**two** artifacts: normalized findings (like any `local-scan` lane) and `endpoint` nodes in the graph
(like `data-flow`), so a spec is a first-class source for the whole chain, not just a lint report.
## When to Activate
- You have an `openapi.(yaml|json)` / AsyncAPI / Arazzo spec and want API security governance (OWASP API
Top 10) before or alongside the code scan.
- `pr-gate` on a change that touches an API spec — gate the contract, not just the implementation.
- You need `endpoint` nodes in the graph for `data-flow` / `dast-generation` but the service isn't
runnable yet (design review, contract-first).
## Core Concepts
- **Two outputs, one run.** (a) Spectral rule hits → normalized findings in `./.asterguard/scan.json`
(`lane:"api-spec"`); (b) every spec path×operation → an `endpoint` node in `./.asterguard/graph.json`
with `method`/`path`/`auth` taken from the operation's `security` + the document's security schemes.
- **Grounded, not invented.** Each rule maps to a canonical `weakness_id` via `registry.resolve`, so a
spec finding is born resolved and lines up with the control crosswalk and any DAST probe for the same
weakness. The OWASP-API→rule→`weakness_id` map is in [the ruleset reference](./references/owasp-api-ruleset.md).
- **Client-side.** Spectral runs on the box against the bundled ruleset; offline it stands alone,
connected the gateway adds `registry.resolve` / `controls.map` grounding and the audit trail.
## Method
1. **Resolve the spec(s).** Take the spec path(s) (`openapi.yaml`, `api-specs/*.yaml`, or a directory).
Bootstrap the linter if absent: `scripts/bootstrap.sh spectral` (or `npm i -g @stoplight/spectral-cli`).
2. **Lint.** Write the ruleset to `.spectral.yaml` (see the reference), then
`spectral lint <spec> --ruleset .spectral.yaml -f json`. Keep the native JSON in `./.asterguard/raw/`.
3. **Normalize findings** into `./.asterguard/scan.json` — one entry per rule hit:
`{lane:"api-spec", source:"spec", title, severity, file:<spec>#<json-path>, weakness_id}`. Resolve the
Spectral rule id → `weakness_id` with `registry.resolve` (offline: match the rule's OWASP-API / CWE tag
to a registry weakness via the map in the ruleset reference).
4. **Emit endpoint nodes** into `./.asterguard/graph.json` — one `comp:endpoint:` per path×operation:
`{method, path, auth}` where `auth` is derived from the operation `security` (or document default);
`auth:"none"` when no scheme applies (that absence is itself the API1/API2 finding). These are the
same node type `data-flow` emits, so `exposes` edges and downstream probes attach normally.
5. **Connected enrichment (optional).** `controls.map(weakness_id)` to attach the violated control
clauses; record the run through the `findings.*` / `context.*` surface so each call returns an
`audit_id`. Emit SARIF (`./.asterguard/scan.sarif`) alongside for CI code-scanning.
## Practical Guidance
- **Spec-only (low freedom):** this checks the *contract*, never a live endpoint — no requests are sent.
The runtime twin is `dast-generation` (which grounds on the endpoints this skill produced) and
`api-proxy-intercept`.
- **PII-named params are a signal, not proof:** a query param named `ssn`/`password`/`token` is a
design smell (API3/data-exposure), flagged as such — confirmation is a data-flow / DAST concern.
- **Phased rollout:** start with the warn-level ruleset, then gate CI with the error-level ruleset and
`--fail-severity error`. Never fabricate a rule hit — emit only what Spectral reported.
## Output
```jsonc
// ./.asterguard/scan.json (findings appended)
{ "lane":"api-spec", "source":"spec", "title":"operation has no security defined",
"severity":"high", "file":"openapi.yaml#/paths/~1admin/get", "weakness_id":"missing_authentication" }
// ./.asterguard/graph.json (endpoint nodes added)
{ "id":"comp:endpoint:GET /admin", "type":"endpoint", "method":"GET", "path":"/admin", "auth":"none" }
```
## Integration
- data-flow — consumes the `endpoint` nodes (spec joins code/infra/traffic as an endpoint source)
- dast-generation — grounds auth/authz/input probes on the spec-derived endpoints
- weakness-graph — resolves the api-spec findings to weaknesses + controls
- check-planner — plans this as the `api-spec` check for API targets
- local-scan — the sibling collection step for code/infra; this is the spec collector
## References
- [OWASP-API ruleset + rule→weakness map](./references/owasp-api-ruleset.md)
- [AsterVault MCP tools](../weakness-graph/references/astervault-tools.md)
- [Graph schema (SSOT)](../../docs/graph-schema.md)