Merge branch 'main' into self_upgrade
This commit is contained in:
commit
20d70b786f
3 changed files with 19 additions and 3 deletions
|
|
@ -24,7 +24,7 @@ services:
|
||||||
picoclaw-gateway:
|
picoclaw-gateway:
|
||||||
image: docker.io/sipeed/picoclaw:latest
|
image: docker.io/sipeed/picoclaw:latest
|
||||||
container_name: picoclaw-gateway
|
container_name: picoclaw-gateway
|
||||||
restart: on-failure
|
restart: unless-stopped
|
||||||
profiles:
|
profiles:
|
||||||
- gateway
|
- gateway
|
||||||
# Uncomment to access host network; leave commented unless needed.
|
# Uncomment to access host network; leave commented unless needed.
|
||||||
|
|
@ -40,7 +40,7 @@ services:
|
||||||
picoclaw-launcher:
|
picoclaw-launcher:
|
||||||
image: docker.io/sipeed/picoclaw:launcher
|
image: docker.io/sipeed/picoclaw:launcher
|
||||||
container_name: picoclaw-launcher
|
container_name: picoclaw-launcher
|
||||||
restart: on-failure
|
restart: unless-stopped
|
||||||
profiles:
|
profiles:
|
||||||
- launcher
|
- launcher
|
||||||
environment:
|
environment:
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,18 @@ func NewBaseChannel(
|
||||||
for _, opt := range opts {
|
for _, opt := range opts {
|
||||||
opt(bc)
|
opt(bc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Security Audit: Check for open-by-default (unsecured) channels.
|
||||||
|
// PicoClaw aims to be secure-by-default. If allow_from is empty, the bot
|
||||||
|
// currently defaults to accepting messages from ANYONE. To explicitly
|
||||||
|
// acknowledge and permit this (e.g. for a public bot), use ["*"].
|
||||||
|
if len(bc.allowList) == 0 {
|
||||||
|
logger.WarnCF("channels", "SECURITY: Channel allows EVERYONE (allow_from is empty)", map[string]any{
|
||||||
|
"channel": bc.name,
|
||||||
|
"hint": "Set allow_from to your ID, or use '*' to explicitly acknowledge open access.",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return bc
|
return bc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -187,6 +199,9 @@ func (c *BaseChannel) IsAllowed(senderID string) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, allowed := range c.allowList {
|
for _, allowed := range c.allowList {
|
||||||
|
if allowed == "*" {
|
||||||
|
return true
|
||||||
|
}
|
||||||
// Strip leading "@" from allowed value for username matching
|
// Strip leading "@" from allowed value for username matching
|
||||||
trimmed := strings.TrimPrefix(allowed, "@")
|
trimmed := strings.TrimPrefix(allowed, "@")
|
||||||
allowedID := trimmed
|
allowedID := trimmed
|
||||||
|
|
@ -221,7 +236,7 @@ func (c *BaseChannel) IsAllowedSender(sender bus.SenderInfo) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, allowed := range c.allowList {
|
for _, allowed := range c.allowList {
|
||||||
if identity.MatchAllowed(sender, allowed) {
|
if allowed == "*" || identity.MatchAllowed(sender, allowed) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ func NewGitHubCopilotProvider(uri string, connectMode string, model string) (*Gi
|
||||||
|
|
||||||
session, err := client.CreateSession(context.Background(), &copilot.SessionConfig{
|
session, err := client.CreateSession(context.Background(), &copilot.SessionConfig{
|
||||||
Model: model,
|
Model: model,
|
||||||
|
OnPermissionRequest: copilot.PermissionHandler.ApproveAll,
|
||||||
Hooks: &copilot.SessionHooks{},
|
Hooks: &copilot.SessionHooks{},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue