42Crunch for Hanami

What middleBrick covers

  • Black-box scanning with no agents or SDK dependencies
  • Read-only methods and text-only POST for safe probing
  • 12 OWASP API Top 10 categories including LLM security
  • OpenAPI 3.0/3.1/Swagger 2.0 parsing with $ref resolution
  • Authenticated scans with header allowlisting and domain verification
  • Continuous monitoring and compliance-focused reporting

Overview of API Security for Hanami Applications

Hanami encourages explicit routing and modular controllers, which affects how API security checks map to endpoints. middleBrick scans the public surface of your API by sending only read-only requests, making it suitable for Hanami deployments that follow standard REST patterns. The scanner does not inspect your Ruby code or internal object model; instead, it validates observable behaviors such as response headers, authentication challenges, and error messages. This approach keeps scans safe for production-like environments while still surfacing issues relevant to API integrity.

Authentication and Security Header Checks

Authentication issues are a primary focus, including multi-method bypass attempts and malformed token handling. The scanner tests JWT misconfigurations such as alg=none, weak HS256 verification, expired tokens, missing required claims, and the presence of sensitive data within claims. It also validates the presence and correctness of security headers and WWW-Authenticate compliance. For Hanami applications, this helps verify that your authentication middleware and route constraints are producing the intended protection boundaries. These checks map findings to relevant security controls defined in the OWASP API Top 10 (2023).

Broken Object Level Authorization and Business Logic Signals

BOLA and IDOR testing involves sequential ID enumeration and active adjacent-ID probing to detect predictable object references. BFLA and privilege escalation checks probe admin endpoints and look for role or permission field leakage in responses. While these tests highlight weak access controls, they do not replace a domain-aware review of business rules in Hanami services. The scanner surfaces findings relevant to authorization enforcement, and you can use these results to guide manual code review and policy refinement. Findings align with security controls described in frameworks such as SOC 2 Type II and PCI-DSS 4.0.

OpenAPI Contract Validation and Runtime Coverage

middleBrick parses OpenAPI 3.0, 3.1, and Swagger 2.0 specifications with recursive $ref resolution, then cross-references the spec against runtime behavior. This process can identify undefined security schemes, sensitive fields exposed in documentation, deprecated operations, and missing pagination hints in Hanami-generated specs. For authenticated scans, Bearer, API key, Basic auth, and Cookie methods are supported, with domain verification required to ensure credentials are used only against authorized hosts. Header allowlisting restricts forwarded headers to Authorization, X-API-Key, Cookie, and X-Custom-*, preserving safe probe boundaries.

LLM and AI Security Testing

The scanner includes specific testing for LLM and AI-related risks, executing 18 adversarial probes across Quick, Standard, and Deep tiers. These probes cover system prompt extraction, instruction override attempts, DAN and roleplay jailbreaks, data exfiltration strategies, cost exploitation, encoding bypasses, translation-embedded injection, few-shot poisoning, markdown injection, multi-turn manipulation, indirect prompt injection, token smuggling, tool-abuse patterns, nested instruction injection, and PII extraction. This helps you understand how your API might be abused when used as part of an AI workflow. Results provide remediation guidance rather than attempting automated fixes.

Frequently Asked Questions

Does middleBrick fix vulnerabilities in my Hanami API?
No. The scanner detects and reports findings with remediation guidance; it does not patch, block, or remediate issues.
Can authenticated scans be performed against a Hanami staging environment?
Yes, authenticated scanning is supported from Starter tier onward. You must pass domain verification, and only a limited set of headers will be forwarded.
Which frameworks are explicitly mapped for compliance reporting?
Findings map directly to PCI-DSS 4.0, SOC 2 Type II, and OWASP API Top 10 (2023). Other frameworks are supported through alignment language only.
Does the scanner test for SQL injection or command injection in Hanami endpoints?
No. Active SQL injection and command injection tests are outside scope because they require intrusive payloads not used by the scanner.
How is scan data handled after cancellation?
Customer scan data is deletable on demand and purged within 30 days of cancellation. Data is never sold and is not used for model training.