Skip to content

Commit

Permalink
Fix crash when zone specific config is missing (#11)
Browse files Browse the repository at this point in the history
- Zone specific settings are optional, so check if it exists before accessing properties inside it
  • Loading branch information
gramakri authored Jan 2, 2025
1 parent d4af26c commit 6846768
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).

### Unreleased

- fix: don't crash when zone settings is missing

### [1.2.1] - 2024-08-22

- fix: don't make a set from a set (happened when periodic_checks < 5), #9
Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ exports.checkZoneNegative = async function (zone, ip) {
// IPv4-based DNSxLs MUST NOT contain an entry for 127.0.0.1.

// skip this test for DNS lists that don't follow the RFC
if (this.cfg[zone].loopback_is_rejected) return true
if (this.cfg[zone]?.loopback_is_rejected) return true

const query = ipQuery(ip, zone)
try {
Expand Down Expand Up @@ -373,7 +373,7 @@ exports.check_zone = async function (zone) {

this.enable_zone(zone) // both tests passed

if (this.cfg[zone].ipv6 === true) {
if (this.cfg[zone]?.ipv6 === true) {
await this.checkZonePositive(zone, '::FFFF:7F00:2')
await this.checkZoneNegative(zone, '::FFFF:7F00:1')
}
Expand Down

0 comments on commit 6846768

Please sign in to comment.