Add fail-closed author allowlist gating job dispatch
Sessions run claude with --dangerously-skip-permissions and a prompt built from issue/PR/comment text, so only trusted authors may supply that text. teabot now dispatches a job only when the triggering event's author login is on an allowlist; an empty allowlist dispatches nothing (fail-closed). Claude-Session: https://claude.ai/code/session_015ur3i7D2azsMAWTSVABApv
This commit is contained in:
@@ -72,6 +72,14 @@ func newConfigShowCmd() *cobra.Command {
|
||||
if cfg.AnthropicAPIKey != "" {
|
||||
lines = append(lines, "anthropic_api_key: (set)")
|
||||
}
|
||||
if !cfg.HasAnyAllowlist() {
|
||||
lines = append(lines, "allowed_authors: (none — FAIL-CLOSED, dispatches nothing)")
|
||||
} else {
|
||||
lines = append(lines, "allowed_authors: "+strings.Join(cfg.AllowedAuthors, ", "))
|
||||
for repo, authors := range cfg.RepoAllowedAuthors {
|
||||
lines = append(lines, fmt.Sprintf(" override %s: %s", repo, strings.Join(authors, ", ")))
|
||||
}
|
||||
}
|
||||
lines = append(lines, "repos:")
|
||||
for _, r := range cfg.Repos {
|
||||
lines = append(lines, " - "+r)
|
||||
|
||||
@@ -35,6 +35,10 @@ func newRunCmd() *cobra.Command {
|
||||
return err
|
||||
}
|
||||
|
||||
if !cfg.HasAnyAllowlist() {
|
||||
logger.Warn("no allowed_authors configured; teabot is fail-closed and will dispatch NOTHING until an allowlist is set")
|
||||
}
|
||||
|
||||
store, err := state.New(cfg.StateDirOrDefault())
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user