Skip to content

maradns: decode CSV2 text without BIND parsing - #34

Merged
msimerson merged 1 commit into
NicTool:mainfrom
aberoham:corpus-harness
Sep 6, 2026
Merged

maradns: decode CSV2 text without BIND parsing#34
msimerson merged 1 commit into
NicTool:mainfrom
aberoham:corpus-harness

Conversation

@aberoham

@aberoham aberoham commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

CSV2 TXT/SPF import applied BIND escaping to a different format. Decode CSV2 text before constructing records, preserving quoted backslashes and string boundaries.

Add regressions for quoted text, hex and octal escapes, empty chunks and malformed escapes. The fixture now expects a tilde, not literal backslash-x7e.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The parsing change is well-scoped and is backed by targeted new regression tests for the intended CSV2 decoding behavior.

Pull request overview

This PR fixes MaraDNS CSV2 TXT/SPF importing by decoding CSV2 text directly instead of running it through BIND-style parsing, preserving CSV2 quoting rules (notably quoted backslashes) and chunk boundaries.

Changes:

  • Replace TXT/SPF handling in maradns.parseZoneFile to build RR objects using a CSV2-specific parseText() decoder instead of RR.fromBind(...).
  • Add regression tests covering quoted backslashes, hex/octal escapes, empty chunks, and malformed escapes.
  • Update the MaraDNS fixture expectation so the tilde is emitted as a literal ~ rather than \x7e.
File summaries
File Description
lib/maradns.js Implements CSV2-specific TXT/SPF decoding (parseText) and bypasses BIND parsing for these RR types.
test/csv2-text.js Adds focused regressions for CSV2 TXT/SPF decoding semantics and error cases.
test/dns-zone.js Updates expected tinydns output to reflect correct decoding (tilde output).
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread lib/maradns.js
Comment on lines 220 to +223
case 'SPF':
case 'TXT':
iterRR.rdata = naturallyQuoted(iterRR.rdata)
if (!iterRR.rdata.startsWith('"')) iterRR.rdata = `"${iterRR.rdata}"`
break
res.push(new RR[iterRR.type]({ ...iterRR, data: parseText(iterRR.rdata) }))
continue
Comment thread lib/maradns.js
Comment on lines +431 to +433
const result = chunks.map((bytes) =>
new TextDecoder('utf-8', { fatal: true }).decode(new Uint8Array(bytes)),
)
@msimerson
msimerson merged commit 017d26a into NicTool:main Sep 6, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants