hardening-a-parser-port

Harden recursive-descent parsers against stack exhaustion, complexity attacks, and prototype pollution.

2|Updated Jul 2, 2026
One-click install
npx skills add https://github.com/spencerbeggs/effected --skill hardening-a-parser-port
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hardening-a-parser-port
Source: https://github.com/spencerbeggs/effected/tree/main/plugin/skills/hardening-a-parser-port
Command: npx skills add https://github.com/spencerbeggs/effected --skill hardening-a-parser-port

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill addresses critical security vulnerabilities in recursive-descent parsers, such as stack overflows, algorithmic complexity attacks, and prototype pollution, ensuring that untrusted input is handled safely and predictably.

Core Features & Use Cases

  • Security Guardrails: Implements depth caps, numeric bound checks, and prototype pollution prevention to harden parsers against malicious input.
  • Typed Error Handling: Enforces the invariant that malformed input must fail through a typed error channel rather than throwing unhandled defects.
  • Use Case: When porting a new parser or lexer to the Effect ecosystem, use this skill to systematically audit and close recursion surfaces and validate input boundaries to prevent denial-of-service vectors.

Quick Start

Apply the hardening-a-parser-port guidelines to audit the current parser implementation for recursion depth, numeric bounds, and prototype pollution vulnerabilities.

Frequently Asked Questions about hardening-a-parser-port

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent stack overflow in recursive-descent parsers processing untrusted input?

Prevent stack overflow in recursive-descent parsers by applying depth caps to recursion surfaces, which stops stack exhaustion before untrusted input triggers a crash. This hardening technique systematically audits and closes recursive loops to mitigate denial-of-service vectors.

How do I prevent prototype pollution when porting a parser to the Effect ecosystem?

Prevent prototype pollution during parser porting by enforcing object prototype manipulation checks and validating input boundaries. This ensures untrusted input is handled safely and predictably without injecting malicious properties into base objects.

What is an algorithmic complexity attack and how do I harden a lexer against it?

An algorithmic complexity attack exploits worst-case parsing times by feeding crafted input to degrade performance. Harden lexers against this by validating numeric bounds and capping recursion depth to ensure processing remains predictable under malicious payloads.

How do I handle malformed input in Effect parsers without throwing unhandled defects?

Handle malformed input in Effect parsers by enforcing the invariant that parsing failures must route through a typed error channel rather than throwing unhandled defects. This guarantees robust, typed error handling for predictable failure management.

Can I use parser hardening techniques for lexers outside the Effect ecosystem?

These parser hardening techniques target the Effect ecosystem specifically to ensure robust, typed error handling during migrations. While the security concepts apply broadly, the implementation satisfies Effect-specific requirements for depth-capping and prototype pollution prevention.

What are the limitations of relying on depth caps for parser security?

Depth caps alone do not cover all parser vulnerabilities; you must also validate numeric bounds and prevent object prototype manipulation. A complete security audit requires closing all recursion surfaces and checking input boundaries to prevent denial-of-service vectors.