Skip to content

fix(dns-porkbun): reject non-decimal ttl strings#813

Merged
ralyodio merged 1 commit into
profullstack:masterfrom
aiirvizionz:clientkit/porkbun-decimal-ttl
Jul 22, 2026
Merged

fix(dns-porkbun): reject non-decimal ttl strings#813
ralyodio merged 1 commit into
profullstack:masterfrom
aiirvizionz:clientkit/porkbun-decimal-ttl

Conversation

@aiirvizionz

Copy link
Copy Markdown
Contributor

Summary

  • parse Porkbun record TTLs only when they are positive decimal integers
  • fall back to the configured/default TTL for malformed strings like 1e2, 0x10, or decimal fractions
  • add regression coverage for non-decimal TTL strings while preserving normal decimal TTLs

Verification

  • node_modules/.bin/vitest.cmd run packages/dns/porkbun/src/index.test.ts
  • node_modules/.bin/tsc.cmd -p packages/dns/porkbun/tsconfig.json --noEmit
  • git diff --check

Copilot AI review requested due to automatic review settings July 22, 2026 01:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR tightens TTL parsing for the Porkbun DNS adapter so only positive decimal integer TTLs are accepted, and malformed TTL strings fall back to the configured/default TTL.

Changes:

  • Added a dedicated parsePorkbunTtl helper to validate/parse TTLs from Porkbun records.
  • Updated record-mapping logic to use the parsed TTL (or fall back to configured/default TTL).
  • Added a regression test covering non-decimal TTL string formats (1e2, 0x10, fractions) while preserving normal decimal TTL behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
packages/dns/porkbun/src/index.ts Adds strict TTL parsing and uses it when mapping Porkbun records into DnsRecords.
packages/dns/porkbun/src/index.test.ts Adds a regression test to ensure malformed TTL strings fall back to the configured/default TTL.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +74 to +76
if (typeof ttl === 'number') {
return Number.isInteger(ttl) && ttl > 0 ? ttl : undefined;
}
Comment on lines +77 to +82
if (typeof ttl !== 'string' || !/^[1-9]\d*$/.test(ttl)) {
return undefined;
}
const parsed = Number(ttl);
return Number.isSafeInteger(parsed) ? parsed : undefined;
}
@ralyodio
ralyodio merged commit ba2685b into profullstack:master Jul 22, 2026
4 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