Skip to content

Commit 365f891

Browse files
authored
Merge branch 'sipeed:main' into main
2 parents bda8f12 + 4ccea5e commit 365f891

4 files changed

Lines changed: 35 additions & 5 deletions

File tree

.goreleaser.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ builds:
2727
- windows
2828
- darwin
2929
- freebsd
30+
- netbsd
3031
goarch:
3132
- amd64
3233
- arm64
@@ -44,6 +45,12 @@ builds:
4445
ignore:
4546
- goos: windows
4647
goarch: arm
48+
- goos: netbsd
49+
goarch: s390x
50+
- goos: netbsd
51+
goarch: mips64
52+
- goos: netbsd
53+
goarch: arm
4754

4855
- id: picoclaw-launcher
4956
binary: picoclaw-launcher

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ build-all: generate
181181
GOOS=linux GOARCH=arm GOARM=7 $(GO) build $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-linux-armv7 ./$(CMD_DIR)
182182
GOOS=darwin GOARCH=arm64 $(GO) build $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-arm64 ./$(CMD_DIR)
183183
GOOS=windows GOARCH=amd64 $(GO) build $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-windows-amd64.exe ./$(CMD_DIR)
184+
GOOS=netbsd GOARCH=amd64 $(GO) build $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-netbsd-amd64 ./$(CMD_DIR)
185+
GOOS=netbsd GOARCH=arm64 $(GO) build $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-netbsd-arm64 ./$(CMD_DIR)
184186
@echo "All builds complete"
185187

186188
## install: Install picoclaw to system and copy builtin skills

pkg/identity/identity.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ func MatchAllowed(sender bus.SenderInfo, allowed string) bool {
5959
}
6060
}
6161

62+
// Keep track of explicit username format
63+
isAtUsername := strings.HasPrefix(allowed, "@")
64+
6265
// Strip leading "@" for username matching
6366
trimmed := strings.TrimPrefix(allowed, "@")
6467

@@ -75,11 +78,9 @@ func MatchAllowed(sender bus.SenderInfo, allowed string) bool {
7578
return true
7679
}
7780

78-
// Match against Username
79-
if sender.Username != "" {
80-
if sender.Username == trimmed || sender.Username == allowedUser {
81-
return true
82-
}
81+
// Match against Username only when explicitly requested via "@username"
82+
if isAtUsername && sender.Username != "" && sender.Username == trimmed {
83+
return true
8384
}
8485

8586
// Match compound sender format against allowed parts

pkg/identity/identity_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,16 @@ func TestMatchAllowed(t *testing.T) {
104104
allowed: "@alice",
105105
want: true,
106106
},
107+
{
108+
name: "plain entry does not match username",
109+
sender: bus.SenderInfo{
110+
Platform: "discord",
111+
PlatformID: "999999",
112+
Username: "123456",
113+
},
114+
allowed: "123456",
115+
want: false,
116+
},
107117
{
108118
name: "@username does not match",
109119
sender: telegramSender,
@@ -123,6 +133,16 @@ func TestMatchAllowed(t *testing.T) {
123133
allowed: "999|alice",
124134
want: true,
125135
},
136+
{
137+
name: "compound matches by ID when username differs",
138+
sender: bus.SenderInfo{
139+
Platform: "discord",
140+
PlatformID: "123456",
141+
Username: "not123456",
142+
},
143+
allowed: "123456|alice",
144+
want: true,
145+
},
126146
{
127147
name: "compound does not match",
128148
sender: telegramSender,

0 commit comments

Comments
 (0)