-
Notifications
You must be signed in to change notification settings - Fork 1
fix(domain): point _ans-badge DNS record URL at transparency log #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ package config | |
| import ( | ||
| "errors" | ||
| "fmt" | ||
| "net/url" | ||
| "strings" | ||
| "time" | ||
|
|
||
|
|
@@ -139,6 +140,10 @@ type StoreSQLite struct { | |
| type TLClient struct { | ||
| // BaseURL is the TL's listen URL, e.g. "http://localhost:18081". | ||
| BaseURL string `koanf:"base-url"` | ||
| // PublicBaseURL is the TL's externally-reachable URL used in | ||
| // _ans-badge DNS TXT records. Required — must be an https:// URL | ||
| // with no query string, fragment, or userinfo. | ||
| PublicBaseURL string `koanf:"public-base-url"` | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doc claims defaulting that doesn't exist in code. The comment above this field says "When empty, defaults to BaseURL," but Two clean options:
Either way, the field doc and the validator need to agree. The PR description's "Falls back to the agent endpoint URL when public-base-url is unset, preserving backwards compatibility" line should also be revised — the prior behavior was a bug, not a stable contract. |
||
| // APIKey is the bearer token the TL's static auth accepts. | ||
| APIKey string `koanf:"api-key"` | ||
| // Timeout is the per-request HTTP timeout. | ||
|
|
@@ -342,6 +347,9 @@ func (c *RAConfig) Validate() error { | |
| if c.TLClient.BaseURL == "" { | ||
| return errors.New("tl-client.base-url is required") | ||
| } | ||
| if err := validatePublicBaseURL(c.TLClient.PublicBaseURL); err != nil { | ||
| return err | ||
| } | ||
| if c.TLClient.Timeout <= 0 { | ||
| c.TLClient.Timeout = 10 * time.Second | ||
| } | ||
|
|
@@ -412,3 +420,29 @@ func validateStore(s *Store) error { | |
| } | ||
| return nil | ||
| } | ||
|
|
||
| func validatePublicBaseURL(raw string) error { | ||
| if raw == "" { | ||
| return errors.New("tl-client.public-base-url is required") | ||
| } | ||
| u, err := url.Parse(raw) | ||
| if err != nil { | ||
| return fmt.Errorf("tl-client.public-base-url: %w", err) | ||
| } | ||
| if u.Scheme != "https" { | ||
| return fmt.Errorf("tl-client.public-base-url must use https scheme, got %q", u.Scheme) | ||
| } | ||
| if u.Host == "" { | ||
| return errors.New("tl-client.public-base-url: missing host") | ||
| } | ||
| if u.User != nil { | ||
| return errors.New("tl-client.public-base-url: userinfo not allowed") | ||
| } | ||
| if u.RawQuery != "" { | ||
| return errors.New("tl-client.public-base-url: query string not allowed") | ||
| } | ||
| if u.Fragment != "" { | ||
| return errors.New("tl-client.public-base-url: fragment not allowed") | ||
| } | ||
| return nil | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No startup log of effective
PublicBaseURL.The TL outbox-worker startup log at lines 276-279 emits
tlBaseURL(internal) but notPublicBaseURL. At 3am when oncall is debugging "badges point to the wrong place," they cannot tell pre-PR-23 from post-PR-23-but-misconfigured without SSH-ing the box and reading YAML.Suggested addition near config load:
Collapses MTTR for badge-verification incidents from 15-30 minutes (config inspection) to a 30-second log scan.