class NAPTRRecordValidator implements DnsRecordValidatorInterface (View source)

NAPTR (Naming Authority Pointer) Record Validator

Validates NAPTR records according to:

  • RFC 3403: Dynamic Delegation Discovery System (DDDS) Part Three: The DNS Database
  • RFC 6116: The E.164 to Uniform Resource Identifiers (URI) Dynamic Delegation Discovery System (DDDS) Application (ENUM)
  • ETSI TS 123 003: Numbering, addressing and identification (3GPP TS 23.003)
  • 3GPP standards for telecommunications service discovery

NAPTR records are used for translating one string into another or for replacing one type of string with an entirely different one through regular expressions and DNS lookups.

NAPTR format:

Example (terminal NAPTR with regexp): 10 100 "u" "SIP+D2U" "!^.*$!sip:customer-service@example.com!" .

Example (non-terminal NAPTR with replacement, per ETSI TS 123 003): 10 100 "s" "x-3gpp-pgw:x-gn" "" next-lookup.example.com.

Where:

  • order: 16-bit unsigned integer specifying the order in which records MUST be processed
  • preference: 16-bit unsigned integer specifying the order for processing records with same order
  • flags: a character string containing flags to control DDDS processing (A, P, S, U, or "")
  • service: a string specifying the service available
    • RFC format: [protocol]+[feature] (alphanumeric)
    • 3GPP format: allows hyphens, colons, and plus signs (e.g., "x-3gpp-pgw:x-gn")
  • regexp: a string containing a substitution expression applied to the original string
    • Can be empty ("") when using replacement field (non-terminal NAPTR)
  • replacement: a domain-name for the next rule in lookup or "." for terminal rule
    • Must be "." when regexp is non-empty
    • Can be a domain name when regexp is empty (non-terminal NAPTR)

Common applications:

  • ENUM (E.164 phone number to URI mapping)
  • SIP (Session Initiation Protocol) service location
  • XMPP service discovery
  • S-NAPTR (Service-NAPTR) as defined in RFC 3958
  • 3GPP/LTE network element discovery (PGW, SGW, etc.)

Security considerations:

  • NAPTR records with regexp fields can potentially be used for various injection attacks
  • The validator includes security checks to prevent misuse of regexp patterns

Methods

__construct(ConfigurationManager $config)

No description

validate(string $content, string $name, mixed $prio, int|string|null $ttl, int $defaultTTL, mixed ...$args)

Validates NAPTR record content

Details

__construct(ConfigurationManager $config)

No description

Parameters

ConfigurationManager $config

ValidationResult validate(string $content, string $name, mixed $prio, int|string|null $ttl, int $defaultTTL, mixed ...$args)

Validates NAPTR record content

Parameters

string $content

The content part of the record

string $name

The name part of the record

mixed $prio

The priority value (if applicable)

int|string|null $ttl

The TTL value

int $defaultTTL

The default TTL to use if not specified

mixed ...$args

Additional validator-specific parameters

Return Value

ValidationResult

ValidationResult containing validated data or error messages