git-remote-entire: address PR review on ENTIRE_TOKEN path · Entire
git-remote-entire: address PR review on ENTIRE_TOKEN path
7419cf0·
Soph·1mo ago·3 files·+30 added/-9 removed
- Redact userinfo in CoreURLFromEnvToken error messages (u.Redacted())
- Fail closed with a clear "ENTIRE_TOKEN is set but blank" message on a whitespace-only token instead of the raw JWT-parse error; truly empty is still treated as unset by the caller and falls back to context auth.
- Rename "core" -> "login server" in resolveCreds doc comments.
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
Sessions
b5f6f2ff8832View transcript
Changes
3
- cmd
- entire/cli/auth
- Menv_token.go+14/-6
- Menv_token_test.go+13
- git-remote-entire
- Mmain.go+3/-3
- entire/cli/auth
40 unmodified lines
// validated strictly. A token with no URL-shaped aud is rejected with a clear
// error rather than silently falling back to context resolution.
func CoreURLFromEnvToken(rawToken string) (string, error) {
if strings.TrimSpace(rawToken) == "" {
return "", fmt.Errorf("%s is set but blank", EnvTokenVar)
}
claims, err := tokens.ParseClaims(rawToken)
if err != nil {
return "", fmt.Errorf("parse %s claims: %w", EnvTokenVar, err)
}
}
func validateCoreAudience(u *url.URL) (string, error) {
switch {
case u.Scheme != "https":
return "", fmt.Errorf("%s aud %q must use https; refusing to exchange the token over %s", EnvTokenVar, u.String(), u.Scheme)
case u.Host == \