-
Notifications
You must be signed in to change notification settings - Fork 34
feat: add configurable trusted bots list with approved integrity elevation #2204
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 |
|---|---|---|
|
|
@@ -32,12 +32,13 @@ type StdinConfig struct { | |
| // StdinGatewayConfig represents gateway configuration in stdin JSON format. | ||
| // Uses pointers for optional fields to distinguish between unset and zero values. | ||
| type StdinGatewayConfig struct { | ||
| Port *int `json:"port,omitempty"` | ||
| APIKey string `json:"apiKey,omitempty"` | ||
| Domain string `json:"domain,omitempty"` | ||
| StartupTimeout *int `json:"startupTimeout,omitempty"` | ||
| ToolTimeout *int `json:"toolTimeout,omitempty"` | ||
| PayloadDir string `json:"payloadDir,omitempty"` | ||
| Port *int `json:"port,omitempty"` | ||
| APIKey string `json:"apiKey,omitempty"` | ||
| Domain string `json:"domain,omitempty"` | ||
| StartupTimeout *int `json:"startupTimeout,omitempty"` | ||
| ToolTimeout *int `json:"toolTimeout,omitempty"` | ||
| PayloadDir string `json:"payloadDir,omitempty"` | ||
| TrustedBots []string `json:"trustedBots,omitempty"` | ||
| } | ||
|
|
||
| // StdinGuardConfig represents a guard configuration in stdin JSON format. | ||
|
|
@@ -280,6 +281,9 @@ func convertStdinConfig(stdinCfg *StdinConfig) (*Config, error) { | |
| if stdinCfg.Gateway.PayloadDir != "" { | ||
| cfg.Gateway.PayloadDir = stdinCfg.Gateway.PayloadDir | ||
| } | ||
| if len(stdinCfg.Gateway.TrustedBots) > 0 { | ||
| cfg.Gateway.TrustedBots = stdinCfg.Gateway.TrustedBots | ||
| } | ||
|
Comment on lines
282
to
+286
|
||
| } else { | ||
| logStdin.Print("No gateway config in stdin, applying defaults") | ||
| cfg.Gateway = &GatewayConfig{} | ||
|
|
||
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.
is_configured_trusted_botallocates on every call (username.to_lowercase()andb.to_lowercase()for each entry). This function is used in the integrity floor path and can run frequently, so this may become a hot spot. Consider avoiding allocations by usingeq_ignore_ascii_casefor comparisons and/or storing a pre-normalized (lowercased) set/vector inPolicyContextatlabel_agentparse time.