Headers Playbooks
Headers playbooks focus on testing HTTP header handling, validation, and security. These playbooks are essential for verifying header parsing, content negotiation, security header enforcement, and resilience against header-based attacks.
There are 32 headers playbooks, which can be grouped into the following categories:
Content Negotiation and HTTP Standardsβ
AcceptLanguageHeadersPlaybook: Send requests with locale Accept-Language headersDummyAcceptHeadersPlaybook: Send requests with dummy Accept headers (expects 406)UnsupportedAcceptHeadersPlaybook: Send requests with unsupported Accept headers (expects 406)DummyContentTypeHeadersPlaybook: Send requests with dummy Content-Type headers (expects 415)UnsupportedContentTypesHeadersPlaybook: Send requests with unsupported Content-Type headers (expects 415)DummyContentLengthHeadersPlaybook: Send requests with dummy Content-Length headers (expects 400)InvalidContentLengthHeadersPlaybook: Send requests with invalid Content-Length headers (expects 400)DummyTransferEncodingHeadersPlaybook: Send requests with dummy Transfer-Encoding headers (expects 400/501)
Header Manipulation and Structureβ
DuplicateHeadersPlaybook: Send requests with duplicate headersExtraHeadersPlaybook: Add extra 'Dochia-Fuzzy-Header' to requestsRemoveHeadersPlaybook: Remove different combinations of headersEmptyStringsInHeadersPlaybook: Send empty values in headersLargeNumberOfRandomHeadersPlaybook: Send requests with 10,000 extra random headersLargeNumberOfRandomAlphanumericHeadersPlaybook: Send requests with 10,000 extra random alphanumeric headers
Unicode, Emojis, and Special Charactersβ
AbugidasInHeadersPlaybook: Send abugidas characters in headersCRLFHeadersPlaybook: Send CR & LF characters in headersLeadingSingleCodePointEmojisInHeadersPlaybook: Send headers with leading single codepoint emojisLeadingMultiCodePointEmojisInHeadersPlaybook: Send headers with leading multi codepoint emojisTrailingSingleCodePointEmojisHeadersPlaybook: Send headers with trailing single codepoint emojisTrailingMultiCodePointEmojisHeadersPlaybook: Send headers with trailing multi codepoint emojisOnlySingleCodePointEmojisInHeadersPlaybook: Send headers with only single codepoint emojisOnlyMultiCodePointEmojisInHeadersPlaybook: Send headers with only multi codepoint emojisZalgoTextInHeadersPlaybook: Send zalgo text in headersZeroWidthCharsInNamesHeadersPlaybook: Inject zero-width characters in header namesZeroWidthCharsInValuesHeadersPlaybook: Send zero-width characters in header values
Whitespace and Formattingβ
LeadingSpacesInHeadersPlaybook: Send headers with leading spacesTrailingSpacesInHeadersPlaybook: Send headers with trailing spacesOnlySpacesInHeadersPlaybook: Send headers with only spaces
Size Stress Testingβ
VeryLargeStringsInHeadersPlaybook: Send very large values in headersVeryLargeUnicodeStringsInHeadersPlaybook: Send very large unicode values in headers
Security and Validationβ
CheckSecurityHeadersPlaybook: Check responses for security header best practicesResponseHeadersMatchContractHeadersPlaybook: Verify response headers match contract specifications
How to Use Headers Playbooksβ
Running All Headers Playbooksβ
Use the built-in flag to run only Headers playbooks:
# Run only Headers Playbooks
dochia test -c api.yml -s https://api.example.com --headers-only
# Short form
dochia test -c api.yml -s https://api.example.com -A
For completeness, you can also target other categories:
# Only Body playbooks
dochia test -c api.yml -s https://api.example.com --body-only # or -B
# Only Fields playbooks
dochia test -c api.yml -s https://api.example.com --fields-only # or -F
Running Specific Headers Playbooksβ
# Test content negotiation
dochia test -c api.yml -s https://api.example.com \
--playbooks DummyAcceptHeadersPlaybook,UnsupportedContentTypesHeadersPlaybook,InvalidContentLengthHeadersPlaybook
# Test header security and validation
dochia test -c api.yml -s https://api.example.com \
--playbooks CheckSecurityHeadersPlaybook,ResponseHeadersMatchContractHeadersPlaybook,CRLFHeadersPlaybook
# Stress test with large headers (use responsibly)
dochia test -c api.yml -s https://api.example.com \
--playbooks VeryLargeStringsInHeadersPlaybook,LargeNumberOfRandomHeadersPlaybook \
--random-headers-count 5000
# Test Unicode and special character handling
dochia test -c api.yml -s https://api.example.com \
--playbooks ZalgoTextInHeadersPlaybook,ZeroWidthCharsInValuesHeadersPlaybook,AbugidasInHeadersPlaybook
Use Case: Security Header Validationβ
Before a production release, run headers playbooks to ensure proper header handling and security controls.
# A good suite for security and standards compliance
dochia test -c api.yml -s https://api.example.com \
--playbooks CheckSecurityHeadersPlaybook,CRLFHeadersPlaybook,DuplicateHeadersPlaybook,InvalidContentLengthHeadersPlaybook
See Alsoβ
- Body Playbooks - Body structure, HTTP methods, and logic
- Fields Playbooks - Individual field validation and testing
- Playbooks Overview - General introduction to playbook types
Detailed Guide to Headers Playbooksβ
Content Negotiation and HTTP Standardsβ
DummyAcceptHeadersPlaybookβ
- Description: Sends requests with dummy Accept headers to test content negotiation
- Example:
Accept: application/dummy-type - Expected Response: 406 Not Acceptable
InvalidContentLengthHeadersPlaybookβ
- Description: Sends requests with invalid Content-Length headers to test parsing robustness
- Example:
Content-Length: invalid-number - Expected Response: 400 Bad Request
UnsupportedContentTypesHeadersPlaybookβ
- Description: Tests API response to unsupported content types
- Example:
Content-Type: application/unsupported-type - Expected Response: 415 Unsupported Media Type
Header Manipulation and Structureβ
DuplicateHeadersPlaybookβ
- Description: Sends requests with duplicate headers to test parsing behavior
- Example: Two
Authorizationheaders in the same request - Purpose: Tests RFC compliance and header precedence handling
ExtraHeadersPlaybookβ
- Description: Adds unexpected headers to test header tolerance
- Example:
Dochia-Fuzzy-Header: test-value - Purpose: Verifies API doesn't break with unexpected headers
LargeNumberOfRandomHeadersPlaybookβ
- Description: Sends requests with thousands of random headers to test resource limits
- Example: 10,000 headers with random names and values
- Purpose: Tests DoS resistance and memory management
Unicode and Special Charactersβ
CRLFHeadersPlaybookβ
- Description: Tests header injection vulnerabilities using carriage return and line feed characters
- Example:
X-Test: value\r\nX-Injected: malicious - Purpose: Detects header injection vulnerabilities
ZalgoTextInHeadersPlaybookβ
- Description: Tests headers with zalgo text (combining characters)
- Example:
X-Test: HΜΈΜ‘ΜͺΜ―Ν¨ΝΜ½Μ ΜΎΜΘ¨Μ¬Μ©ΜΎΝΝͺΜΜΜΜΝ - Purpose: Tests Unicode handling and rendering safety
ZeroWidthCharsInNamesHeadersPlaybookβ
- Description: Injects zero-width characters in header names to test parsing
- Example:
X-Teβst: value(contains zero-width non-joiner) - Purpose: Tests header name parsing and normalization
Security and Validationβ
CheckSecurityHeadersPlaybookβ
- Description: Validates presence of security headers in responses
- Checks: X-Frame-Options, Content-Security-Policy, X-Content-Type-Options, etc.
- Purpose: Ensures security best practices are implemented
ResponseHeadersMatchContractHeadersPlaybookβ
- Description: Verifies response headers match OpenAPI contract specifications
- Example: Checks if documented response headers are present and correctly formatted
- Purpose: Ensures API contract compliance