Skip to content

[Work In Progress]... similar to Lighthouse do Chrome, mas para APIs. Não refinei direto a ideia, pretendo adicionar mais vulnerabilities checks enquanto estudo mais sobre o assunto.

Notifications You must be signed in to change notification settings

mkafonso/hunter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

[WORK_IN_PROGRESS]

Hunter — Similar to Lighthouse do Chrome, mas para APIs

O Hunter é um scanner automatizado para APIs que atua como um "Lighthouse para APIs". Ele percorre endpoints, executa validações técnicas e gera relatórios com pontuação, insights e sugestões.

Foco em segurança, performance, estrutura, documentação e boas práticas.


OpenAPI completo (Swagger v2 ou OpenAPI v3)

go run main.go scan https://petstore.swagger.io/v2/swagger.json --report=json
demo.mov

Endpoint único

go run main.go scan https://viacep.com.br/ws/01001000/json/ --report=json
{
    "score": 60,
    "issues": [
        {
            "type": "security",
            "message": "SECURITY_HEADER_MISSING",
            "path": "/ws/01001000/json/",
            "description": "A required security header is missing. These headers help protect against common vulnerabilities such as clickjacking, MIME-type sniffing, and XSS.",
            "recommendation": "Ensure headers like 'Strict-Transport-Security', 'X-Content-Type-Options', 'X-Frame-Options', 'X-XSS-Protection', and 'Referrer-Policy' are included in responses.",
            "references": [
                "https://owasp.org/www-project-secure-headers/",
                "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers"
            ]
        },
        {
            "type": "security",
            "message": "SECURITY_CORS_CREDENTIALS_WITH_WILDCARD_ORIGIN",
            "path": "/ws/01001000/json/",
            "description": "'Access-Control-Allow-Credentials' is true while origin is '*', which is invalid per the CORS spec and creates security risks.",
            "recommendation": "Use specific origins instead of '*', or disable credentials if open access is required.",
            "references": [
                "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials"
            ]
        },
        {
            "type": "security",
            "message": "SECURITY_ACTIVE_RATE_LIMIT_NOT_DETECTED",
            "path": "/ws/01001000/json/",
            "description": "No rate limiting was observed — the API responded normally to multiple rapid requests.",
            "recommendation": "Implement rate limiting to prevent abuse and reduce attack surface.",
            "references": [
                "https://developer.mozilla.org/en-US/docs/Glossary/Rate_limit"
            ]
        },
        {
            "type": "structure",
            "message": "STRUCTURE_VERSIONING_MISSING_IN_PATH",
            "path": "/ws/01001000/json/",
            "description": "API routes without versioning in the path make it difficult to evolve the API without breaking existing clients.",
            "recommendation": "Include the API version in the URL path (e.g., /v1/resource) to support backward compatibility.",
            "references": ["https://restfulapi.net/versioning/"]
        }
    ]
    ...
}

Funcionalidades

✅ Segurança

  • Verificação de headers de segurança ausentes (Strict-Transport-Security, X-Content-Type-Options, etc.)
  • CORS permissivo (Access-Control-Allow-Origin: *)
  • Exposição de headers sensíveis (X-Powered-By, Server, etc.)
  • Rate limiting passivo (headers X-RateLimit-*, Retry-After)
  • Rate limiting ativo (respostas 429 após burst de requisições)

✅ Performance

  • Tempo de resposta (latência > 500ms)
  • Tamanho excessivo de payloads
  • Ausência de compressão (Content-Encoding)

✅ Estrutura da API

  • Status codes inconsistentes (ex: 200 OK para erros)
  • Métodos HTTP incorretos (ex: GET retornando 201)
  • Ausência de versionamento na URL (ex: /v1/)
  • Inconsistência de casing nos campos do JSON (ex: camelCase e snake_case no mesmo JSON)

✅ Vulnerabilidades

  • Exposição de stacktraces ou mensagens sensíveis em erros

Roadmap Futuro

Não tenho plano fechado, nem mapa traçado. Irei programando as ideias que me vierem vindo, conforme o tempo, o vento e a vontade 👻

About

[Work In Progress]... similar to Lighthouse do Chrome, mas para APIs. Não refinei direto a ideia, pretendo adicionar mais vulnerabilities checks enquanto estudo mais sobre o assunto.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages