Fast, lightweight API security scanner for indie developers.
APIShield analyzes your OpenAPI/Swagger specs and catches common security issues before they reach production. Perfect for CI/CD pipelines, pre-commit hooks, and local development.
- ๐ Multi-format support: OpenAPI 3.x, Swagger 2.0, Postman Collections, HAR files, YAML & JSON
- ๐ Live URL scanning: Scan APIs directly from URLs
- ๐จ Security checks: Missing auth, sensitive data exposure, excessive data leakage
- โก Lightning fast: Scans in milliseconds, perfect for CI/CD
- โ๏ธ Configurable: Custom sensitive fields, path ignore patterns, rule settings
- ๐๏ธ Compliance modes: GDPR, CCPA, HIPAA, PCI-DSS regulatory scanning
- ๐ก๏ธ Threat modeling: STRIDE-based security education and impact analysis
- ๐จ Beautiful output: Color-coded issues with actionable fixes
- ๐ง CI-friendly: Exits with error code on issues
# Global installation (recommended)
npm install -g @tonyjnr/apishield
# Or use with npx (no install needed)
npx @tonyjnr/apishield scan openapi.yaml# Scan an OpenAPI 3 file
apishield scan openapi.yaml
# Scan a Swagger 2.0 file
apishield scan swagger.json
# Scan a Postman Collection
apishield scan collection.postman_collection.json
# Scan a HAR file
apishield scan requests.har
# Scan a live API URL
apishield scan https://api.example.com/openapi.json
# Verbose mode
apishield scan api-spec.yaml --verbose
# Compliance mode (GDPR, CCPA, HIPAA, PCI)
apishield scan api-spec.yaml --compliance gdpr
# Threat modeling report (STRIDE-based)
apishield scan api-spec.yaml --threat-modelDetects endpoints without security schemes (excludes common public paths like /login, /register, /public/*, /health)
# โ Will flag this
/admin/users:
get:
responses: ...
# No security defined!
# โ
This is good
/admin/users:
get:
security:
- bearerAuth: []
responses: ...Scans response schemas for fields that shouldn't be exposed:
- Passwords (
password,passwd,pwd) - Tokens (
token,apiKey,secret) - Personal data (
ssn,creditCard,cvv,dob) - Private keys (
privateKey,private_key)
# โ Will flag this
/users/{id}:
get:
responses:
"200":
content:
application/json:
schema:
properties:
username: string
password: string # ๐จ EXPOSED!Warns when endpoints return too many fields (>20), suggesting pagination or field filtering to reduce attack surface.
# โ Will flag this (51 fields!)
/users/{id}:
get:
responses:
"200":
content:
application/json:
schema:
properties:
id: string
username: string
email: string
password: string
firstName: string
lastName: string
# ... 45 more fields!Output:
โข Excessive data exposure
โ GET /users/{id} returns 51 fields in response
๐ก Reduce response fields or implement field filtering (e.g., ?fields=id,name)
APIShield supports regulatory compliance scanning to help you meet specific legal requirements:
- GDPR (
--compliance gdpr) - European data protection - CCPA (
--compliance ccpa) - California privacy rights - HIPAA (
--compliance hipaa) - Healthcare data protection - PCI-DSS (
--compliance pci) - Payment card industry standards
Compliance mode filters findings to show only fields regulated by the specified framework:
# Standard mode - shows ALL sensitive fields
apishield scan api.yaml
# GDPR mode - shows only GDPR-regulated fields
apishield scan api.yaml --compliance gdprStandard Mode:
โข Sensitive data exposed in response
โ GET /users/{id} returns: email, phone, password, credit_card, ssn
๐ก Remove or mask sensitive fields from the response schema.
GDPR Mode:
โข GDPR compliance violation
โ GET /users/{id} exposes GDPR-regulated data: email, phone, ssn
๐ก Remove or mask GDPR-regulated fields from the response schema.
| Category | GDPR | CCPA | HIPAA | PCI-DSS |
|---|---|---|---|---|
| Personal Info (email, phone, address) | โ | โ | โ | โ |
| Financial Data (credit_card, cvv) | โ | โ | โ | โ |
| Health Data (medical_record) | โ | โ | โ | โ |
| Authentication (password, token) | โ | โ | โ | โ |
Input (api.yaml):
openapi: 3.0.0
paths:
/users/{id}:
get:
responses:
"200":
content:
application/json:
schema:
properties:
id: string
username: string
password: stringOutput:
๐จ High Severity Issues (2):
1. Missing authentication
Endpoint GET /users/{id} has no security scheme defined.
๐ก Add a 'security' block to the operation or global spec.
2. Sensitive data exposed in response
GET /users/{id} returns: password
๐ก Remove or mask sensitive fields from the response schema.
๐ Summary: 2 issue(s) detected
High: 2 | Medium: 0
name: API Security Scan
on: [push, pull_request]
jobs:
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- run: npx @tonyjnr/apishield scan openapi.yaml# .husky/pre-commit
npx @tonyjnr/apishield scan openapi.yamlapi_security:
script:
- npx @tonyjnr/apishield scan openapi.yamlAPIShield can generate STRIDE-based threat models to help you understand the real-world security implications of your API issues.
STRIDE is a threat modeling framework that categorizes security threats:
- Spoofing - Impersonation attacks
- Tampering - Data modification attacks
- Repudiation - Denial of actions
- Information Disclosure - Data leakage
- Denial of Service - Service disruption
- Elevation of Privilege - Unauthorized access
Instead of just listing issues, threat modeling explains the attacker impact and provides educational context:
# Standard mode - simple issue list
apishield scan api.yaml
# Threat modeling mode - educational threat analysis
apishield scan api.yaml --threat-modelStandard Mode:
โ ๏ธ Found 3 security issue(s):
โข Missing authentication
โ Endpoint GET /users/{id} has no security scheme defined.
๐ก Add a 'security' block to the operation or global spec.
โข Sensitive data exposed in response
โ GET /users/{id} returns: email, phone, password
๐ก Remove or mask sensitive fields from the response schema.
Threat Modeling Mode:
๐ก๏ธ APIShield Threat Model Report
๐ SPOOFING
1 threat(s) identified
1. Missing authentication
โ Endpoint GET /users/{id} has no security scheme defined.
Impact: An attacker can access or modify resources without authentication.
OWASP: API1:2023 - Broken Object Level Authorization
๐ง Fix: Add a 'security' block to the operation or global spec.
๐ INFORMATION DISCLOSURE
1 threat(s) identified
1. Sensitive data exposed in response
โ GET /users/{id} returns: email, phone, password
Impact: PII, secrets, or internal data may be leaked to unauthorized parties.
OWASP: API3:2023 - Excessive Data Exposure
๐ง Fix: Remove or mask sensitive fields from the response schema.
๐ Threat Summary
Total threats: 2
High: 2
- ๐ Educational: Learn why each issue matters
- ๐ฏ Contextual: Understand attacker motivations
- ๐ Standards-aligned: Maps to OWASP API Security Top 10
- ๐ Categorized: Groups threats by STRIDE category
- ๐ Summarized: Shows threat severity breakdown
Create a config.apishield.json file in your project root to customize scanning behavior:
{
"ignorePaths": ["/health", "/metrics", "/version", "/internal/*"],
"customSensitiveFields": [
"internal_token",
"legacy_password",
"webhook_secret"
],
"rules": {
"missingAuth": "error",
"sensitiveData": "error"
}
}ignorePaths: Array of path patterns to skip during scanning (supports*wildcards)customSensitiveFields: Additional field names to flag as sensitiverules: Control rule severity (error,warn,off)
- โ OpenAPI 3.x support
- โ Swagger 2.0 support
- โ JSON & YAML parsing
- โ Basic security checks
- โ Postman Collection support
- โ HAR file analysis
- โ Live URL scanning
- โ Custom rule configuration
- ๐ Enhanced sensitive field detection
- ๐ More security rule types
- ๐ Better error reporting
- ๐ Performance optimizations
- ๐ฎ GraphQL schema support
- ๐ฎ AI-powered test generation
- ๐ฎ Web dashboard
- ๐ฎ Team collaboration features
Found a bug? Have an idea? Contributions welcome!
# Clone the repo
git clone https://github.com/tonyjnr/apishield.git
cd apishield
# Install dependencies
npm install
# Test locally
node index.js scan petstore.json| Format | Extension | Status |
|---|---|---|
| OpenAPI 3.0 | .yaml, .yml, .json |
โ Full support |
| OpenAPI 3.1 | .yaml, .yml, .json |
โ Full support |
| Swagger 2.0 | .json, .yaml |
โ Full support |
| Postman Collection | .postman_collection.json |
โ Full support |
| HAR Files | .har |
โ Full support |
| Live URLs | https://, http:// |
โ Full support |
| GraphQL | .graphql |
๐ Phase 3 |
Most API security tools are:
- ๐ข Enterprise-focused (expensive, complex)
- ๐ Slow (require full environment setup)
- ๐ Runtime-only (catch issues too late)
APIShield is different:
- ๐ Free and open source
- โก Instant feedback (static analysis)
- ๐ฏ Built for indie devs & small teams
- ๐ CI/CD native
MIT ยฉ Onuzulike Anthony Ifechukwu
Inspired by the OWASP API Security Top 10 and built for the indie dev community.
Made with โค๏ธ for developers who ship fast but secure.
- ๐ Report a bug
- ๐ก Request a feature
- ๐ง Email: onuzulikeanthony432@gmail.com
Star โญ this repo if APIShield helps secure your APIs!