webauthn::validRpIdP (private)

 webauthn::validRpIdP rpid

Defined in packages/webauthn/tcl/webauthn-procs.tcl

Validate the provided rpid (Relying Party ID)

Parameters:
rpid (required)
Returns:
boolean value

Partial Call Graph (max 5 caller/called nodes):
packages/webauthn/tcl/webauthn-init.tcl packages/webauthn/ tcl/webauthn-init.tcl webauthn::validRpIdP webauthn::validRpIdP packages/webauthn/tcl/webauthn-init.tcl->webauthn::validRpIdP

Testcases:
No testcase defined.
Source code:
        if {$rpid eq "localhost"} { return 1 }

        # must contain at least a dot (heuristic for registrable domain)
        if {[string first "." $rpid] < 0} { return 0 }

        # only hostname chars (no underscore, no port/scheme/path)
        if {![regexp {^[a-z0-9.-]+$} $rpid]} { return 0 }

        # no leading/trailing dot, no empty labels
        if {[string match .* $rpid] || [string match *. $rpid]} { return 0 }
        if {[string first ".." $rpid] >= 0} { return 0 }

        # optional: reject labels starting/ending with '-'
        foreach label [split $rpid "."] {
            if {$label eq ""} { return 0 }
            if {[string match -* $label] || [string match *- $label]} { return 0 }
        }

        return 1
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: