Repository navigation
zone_record: compare packed fields as the RR class reads them - #97
Merged
Merged
Conversation
checkRecord required each packed field back from its shared column byte for byte. dns-resource-record #72 packs RRSIG as BIND text the way NicTool 2 stores it, which rewrites a type number as its mnemonic, times in seconds as YYYYMMDDHHmmSS stamps, and drops spaces from the signature. The api schema accepts all three, so such an RRSIG was refused as "can't be stored as given". Since #95, any PUT that changes rdata runs this check, and the UI sends every rdata field. Both the record and its packed round trip now go through the RR class, and their fields are compared. A value that splits differently, such as a NAPTR field holding the column delimiter, is still refused. Cross-package: needed before the dns-resource-record release with #72, which ^2.0.0 picks up.
The previous commit compared the RR class's values strictly, so a NAPTR created without a regexp, which unpacks as '', was refused on mysql. The byte comparison it replaced treated the two alike.
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues require changes to the zone-record validation update.
No open issues 🎉
What changed in this PR
Updates zone-record validation to compare packed fields as interpreted by the DNS record classes, allowing equivalent RRSIG representations while still rejecting data altered by packing.
Changes:
- Compares normalized field values after packing and unpacking, preserving field-specific errors.
- Adds tests for accepted RRSIG representations, omitted NAPTR fields, and rejected delimiter corruption.
- Documents the RRSIG validation fix in the changelog.
| File | Description |
|---|---|
| lib/zone_record/store/base.test.js | Adds regression coverage for normalized packed fields and corruption detection. |
| lib/zone_record/store/base.js | Validates packed round trips using DNS record class field values. |
| CHANGELOG.md | Records support for RRSIG type numbers and timestamps in seconds. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
checkRecordpacks a record's fields into their shared column, unpacks them, and requires each back byte for byte:NicTool/dns-resource-record#72 maps RRSIG into
addressas BIND text, the way NicTool 2 stores it. Packing rewrites three things the api schema accepts:'type covered': 1A'signature expiration': 104505312020030212123200Each fails the byte comparison, so the RRSIG returns 400
RRSIG: type covered can't be stored as given. That includes the library's ownRRSIG.getCanonical(). Before #72 RRSIG had no map, so it skipped this check.#95 runs
checkRecordon any PUT that changes rdata, on json and toml as well as mysql, and the UI's zone-record save sends every rdata field. Once a dns-resource-record release carries #72, which^2.0.0picks up, every UI edit of an RRSIG holding a type number or times in seconds would fail.checkRecordnow builds the RR class from both the record and its packed round trip, and compares their fields. If the round trip doesn't build, the field whose text changed is named, as before. A NAPTR field holding the column delimiter is still refused.Tested on json and toml (650/650). Not run on mysql locally.