📌 Description
src/webhooks/ssrfGuard.ts validates webhook targets, but its hostname handling does not normalize internationalized/Unicode hostnames (IDNA/punycode) before the safety checks. A homograph or non-normalized Unicode hostname could be presented that bypasses string-based checks while resolving to an unexpected host.
💡 Why it matters: SSRF guards that compare raw (non-normalized) hostnames can be evaded with Unicode look-alikes; normalization to punycode before validation closes that gap.
🧩 Requirements and context
- Normalize the hostname to ASCII/punycode (IDNA) before applying allow/deny and private-range checks.
- Reject hostnames that fail normalization or contain disallowed characters.
- Ensure the normalized hostname is what gets resolved/connected to (consistency between check and use).
- Add tests with Unicode/IDN and homograph hostnames alongside normal ASCII hosts.
Non-functional requirements
- Must be secure, tested, and documented.
- Should be efficient and easy to review.
🛠️ Suggested execution
1. Fork the repo and create a branch
git checkout -b fix/ssrf-idna-normalization
2. Implement changes
- Write/modify the relevant source:
src/webhooks/ssrfGuard.ts
- Write comprehensive tests: a new spec under
tests/webhooks/
- Add documentation: inline TSDoc on normalization rules
- Include TSDoc doc comments
- Validate security assumptions: check-vs-use consistency
3. Test and commit
- Cover edge cases: IDN host, homograph host, invalid Unicode, normal host
- Include test output and security notes in the PR description.
Example commit message
fix(ssrf): normalize hostnames to punycode before validation
✅ Acceptance criteria
🔒 Security notes
Confirm there is no check-then-use mismatch that lets a different host be contacted than validated.
📋 Guidelines
- Minimum 95% test coverage
- Clear documentation
- Timeframe: 96 hours
📌 Description
src/webhooks/ssrfGuard.tsvalidates webhook targets, but its hostname handling does not normalize internationalized/Unicode hostnames (IDNA/punycode) before the safety checks. A homograph or non-normalized Unicode hostname could be presented that bypasses string-based checks while resolving to an unexpected host.🧩 Requirements and context
Non-functional requirements
🛠️ Suggested execution
1. Fork the repo and create a branch
2. Implement changes
src/webhooks/ssrfGuard.tstests/webhooks/3. Test and commit
npm testExample commit message
✅ Acceptance criteria
🔒 Security notes
Confirm there is no check-then-use mismatch that lets a different host be contacted than validated.
📋 Guidelines