Skip to main content

validate_github_base_url

Function validate_github_base_url 

Source
pub fn validate_github_base_url(base_url: &str) -> Result<(), RsGuardError>
Expand description

Validates that a GitHub API base URL is on the allowlist.

Accepts:

  • Exact match against ALLOWED_BASE_URLS (e.g. https://api.github.com)
  • GitHub Enterprise pattern: https://{host}/api/v3 where {host} is any valid hostname
  • Loopback addresses (http://127.0.0.1, http://localhost) for testing

All non-loopback URLs must use HTTPS. HTTP URLs to external hosts are rejected.

ยงErrors

Returns RsGuardError::Config if the URL is not allowed.