Skip to content

Commit 29317b1

Browse files
committed
fix: remaining gosec nolint, flaky quit test, spctl after notarize
- Add nolint:gosec for path traversal false positives in sync.go - Fix flaky TestServer_QuitCommand with assert.Eventually - Move Gatekeeper spctl check after notarization+staple in release workflow
1 parent 3084e45 commit 29317b1

3 files changed

Lines changed: 13 additions & 10 deletions

File tree

.github/workflows/release-bridge.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,6 @@ jobs:
179179
--timestamp \
180180
"$DMG_NAME"
181181
182-
- name: Verify Gatekeeper acceptance
183-
run: |
184-
spctl --assess --type execute --verbose=2 bin/SalmonRun.app
185-
186182
- name: Notarize .dmg
187183
env:
188184
APPLE_ID: ${{ secrets.APPLE_ID }}
@@ -199,6 +195,10 @@ jobs:
199195
run: |
200196
xcrun stapler staple "$DMG_NAME"
201197
198+
- name: Verify Gatekeeper acceptance
199+
run: |
200+
spctl --assess --type execute --verbose=2 bin/SalmonRun.app
201+
202202
- name: Verify signatures
203203
run: |
204204
echo "Verifying .dmg signature..."

cmd/bridge/sync.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,13 @@ func (b *Bridge) bearDBModTime() int64 {
123123

124124
var maxNano int64
125125

126-
if info, err := os.Stat(dbPath); err == nil {
126+
if info, err := os.Stat(dbPath); err == nil { //nolint:gosec // G703: path built from cleaned bearDataDir
127127
if t := info.ModTime().UnixNano(); t > maxNano {
128128
maxNano = t
129129
}
130130
}
131131

132-
if info, err := os.Stat(walPath); err == nil {
132+
if info, err := os.Stat(walPath); err == nil { //nolint:gosec // G703: path built from cleaned bearDataDir
133133
if t := info.ModTime().UnixNano(); t > maxNano {
134134
maxNano = t
135135
}
@@ -689,7 +689,7 @@ func (b *Bridge) resolveAttachmentFilePath(attType, bearID, filename string) str
689689

690690
if filename != "" {
691691
candidate := filepath.Join(dir, filename)
692-
if _, err := os.Stat(candidate); err == nil {
692+
if _, err := os.Stat(candidate); err == nil { //nolint:gosec // G703: path built from cleaned bearDataDir
693693
return candidate
694694
}
695695
}

internal/ipc/server_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"os"
1010
"sync"
1111
"testing"
12+
"time"
1213

1314
"github.com/stretchr/testify/assert"
1415
"github.com/stretchr/testify/require"
@@ -204,9 +205,11 @@ func TestServer_QuitCommand(t *testing.T) {
204205
require.NoError(t, json.Unmarshal(resp, &ok))
205206
assert.True(t, ok.Ok)
206207

207-
provider.mu.Lock()
208-
assert.True(t, provider.shutdownCalled)
209-
provider.mu.Unlock()
208+
assert.Eventually(t, func() bool {
209+
provider.mu.Lock()
210+
defer provider.mu.Unlock()
211+
return provider.shutdownCalled
212+
}, time.Second, 10*time.Millisecond)
210213
}
211214

212215
func TestServer_UnknownCommand(t *testing.T) {

0 commit comments

Comments
 (0)