Re-mint watchpr's Gitea token when it expires
Vault-minted Gitea tokens last ~1h, far less than a watch, and every poll past expiry 401'd into a warning while watchpr looked healthy. - retry a rejected request once with a freshly minted token - abort the watch when the fresh token is rejected too - poll anonymously when no token can be minted, mint only on a real 401/403
This commit is contained in:
@@ -174,8 +174,13 @@ wrapped per stage (login / read denied / write denied) via `ErrVaultDenied`.
|
||||
## Gotchas
|
||||
|
||||
- `watchpr` exits 0 with no output changes on `--once` (just prints state).
|
||||
- The token cache is process-wide (`sync.Once`); tests call the unexported
|
||||
`fetchGiteaToken` to avoid it.
|
||||
- Gitea tokens expire in ~1h, shorter than a watch: the client re-mints once on a
|
||||
401/403 and replays the request. If the fresh token is rejected too, `watchpr`
|
||||
exits non-zero rather than polling blind.
|
||||
- `watchpr` polls anonymously when no token can be minted (public repos work
|
||||
fine); only a real 401/403 reaches for Vault.
|
||||
- The token cache is process-wide (mutex-guarded); `RefreshGiteaToken` replaces
|
||||
it. Tests call the unexported `fetchGiteaToken` to avoid the cache.
|
||||
- `agentvault` never puts a secret in an error string: Vault decode failures and
|
||||
Authentik `view_key` responses are reported without their bodies, and
|
||||
`seed-oauth` reports key names only.
|
||||
|
||||
Reference in New Issue
Block a user