Loading...
Loading...
Run Spectral to lint OpenAPI and AsyncAPI specs for security issues. Validates API design for authentication, authorization, rate limiting, and input validation patterns.
npx skill4agent add vchirrav/product-security-ai-skills api-security-spectralnpm install -g @stoplight/spectral-clispectral --versionspectral lint <spec-file> --format json > spectral-results.jsonspectral lint <spec> --ruleset .spectral.yml --format jsonspectral lint openapi.yaml --format pretty| # | Severity | Rule | Path | Message | Line |
|---|----------|------|------|---------|------|| Rule | Description |
|---|---|
| API servers must use HTTPS |
| All operations need unique IDs |
| Operations should be documented |
| Security scheme defined | OAuth2/API key/Bearer token present |
| Input validation | Request body schema with constraints |
| Error responses | 401, 403, 429 responses defined |
| Rate limiting | Headers for rate limit documented |
| No eval/dynamic paths | Path parameters properly constrained |
.spectral.ymlextends: ["spectral:oas"]
rules:
oas3-server-https:
description: Server URLs must use HTTPS
given: "$.servers[*].url"
then:
function: pattern
functionOptions:
match: "^https://"