Documentation
¶
Overview ¶
Package reposelector is the single source of truth for validating GitHub owner and repository selectors used by security-relevant call sites (guard policies, enclave policies, and delegated identities).
Two grammars are defined, and they differ only in the owner segment:
- The canonical grammar (IsCanonicalOwner, IsCanonicalRepositorySelector) matches github/gh-aw-firewall ADR 0001 ("Agent enclave repository admission") exactly: an owner is 1-39 characters of lowercase alphanumerics and hyphens, starting with an alphanumeric.
- The legacy grammar (IsLegacyOwner, IsLegacyRepositorySelector) additionally permits '_' in the owner segment for backward compatibility with previously accepted guard-policy and enclave-policy inputs. New call sites should prefer the canonical grammar.
Both grammars share the same repository-name rule (IsCanonicalRepoName): 1-100 characters of lowercase alphanumerics, '.', '_', and '-', excluding the traversal-like names "." and ".." and any name containing "..".
None of these functions trim, case fold, Unicode-normalize, or URL-decode their input: callers must reject any selector for which they return false rather than attempt to normalize it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsCanonicalOwner ¶
IsCanonicalOwner reports whether owner is the exact canonical ASCII byte sequence required for a repository owner: ^[a-z0-9](?:[a-z0-9-]{0,38})$.
func IsCanonicalRepoName ¶
IsCanonicalRepoName reports whether name is a valid repository-name segment: ^(?!\.\.?$)(?!.*\.\.)[a-z0-9._-]{1,100}$.
func IsCanonicalRepositorySelector ¶
IsCanonicalRepositorySelector reports whether selector is an exact canonical "owner/repo" selector, combining IsCanonicalOwner and IsCanonicalRepoName.
func IsLegacyOwner ¶
IsLegacyOwner reports whether owner matches the canonical owner grammar extended to allow '_', which some historically accepted policy inputs use.
func IsLegacyRepositorySelector ¶
IsLegacyRepositorySelector reports whether selector is an "owner/repo" selector whose owner matches the legacy grammar (canonical plus '_') and whose repository name matches IsCanonicalRepoName.
func IsTraversalRepoName ¶
IsTraversalRepoName reports whether name is one of the traversal-like repository names IsCanonicalRepoName rejects: "." or any name containing "..", which also covers "..".
Types ¶
This section is empty.