Skip to content

Commit 4fe2f00

Browse files
authored
Merge pull request #2898 from dgageot/board/69b6df9ab7c3823e
Bump go dependencies
2 parents 1fc16fd + 69bed78 commit 4fe2f00

6 files changed

Lines changed: 104 additions & 31 deletions

File tree

go.mod

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ require (
1111
github.com/JohannesKaufmann/html-to-markdown/v2 v2.5.1
1212
github.com/Microsoft/go-winio v0.6.2
1313
github.com/a2aproject/a2a-go v0.3.15
14-
github.com/alecthomas/chroma/v2 v2.24.1
14+
github.com/alecthomas/chroma/v2 v2.25.0
1515
github.com/alpkeskin/gotoon v0.1.1
1616
github.com/anthropics/anthropic-sdk-go v1.45.0
1717
github.com/atotto/clipboard v0.1.4
1818
github.com/aws/aws-sdk-go-v2 v1.41.7
19-
github.com/aws/aws-sdk-go-v2/config v1.32.17
20-
github.com/aws/aws-sdk-go-v2/credentials v1.19.16
19+
github.com/aws/aws-sdk-go-v2/config v1.32.18
20+
github.com/aws/aws-sdk-go-v2/credentials v1.19.17
2121
github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.52.0
2222
github.com/aws/aws-sdk-go-v2/service/sts v1.42.1
2323
github.com/aws/smithy-go v1.25.1
@@ -30,7 +30,7 @@ require (
3030
github.com/coder/acp-go-sdk v0.13.0
3131
github.com/docker/cli v29.5.2+incompatible
3232
github.com/docker/go-units v0.5.0
33-
github.com/docker/portcullis v0.0.0-20260522094836-b66c4ab750fd
33+
github.com/docker/portcullis v0.0.0-20260526131538-fc97bf12bbdb
3434
github.com/dop251/goja v0.0.0-20260311135729-065cd970411c
3535
github.com/fatih/color v1.19.0
3636
github.com/fsnotify/fsnotify v1.10.1
@@ -42,7 +42,7 @@ require (
4242
github.com/google/uuid v1.6.0
4343
github.com/gorilla/websocket v1.5.3
4444
github.com/hashicorp/hcl/v2 v2.24.0
45-
github.com/junegunn/fzf v0.72.0
45+
github.com/junegunn/fzf v0.73.1
4646
github.com/k3a/html2text v1.4.0
4747
github.com/kofalt/go-memoize v0.0.0-20240506050413-9e5eb99a0f2a
4848
github.com/labstack/echo/v4 v4.15.2
@@ -86,6 +86,7 @@ require (
8686
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.24 // indirect
8787
github.com/blevesearch/zapx/v17 v17.1.2 // indirect
8888
github.com/danieljoos/wincred v1.2.2 // indirect
89+
github.com/dlclark/regexp2/v2 v2.1.0 // indirect
8990
github.com/dvsekhvalnov/jose2go v1.7.0 // indirect
9091
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
9192
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
@@ -120,7 +121,7 @@ require (
120121
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.23 // indirect
121122
github.com/aws/aws-sdk-go-v2/service/signin v1.0.11 // indirect
122123
github.com/aws/aws-sdk-go-v2/service/sso v1.30.17 // indirect
123-
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.21 // indirect
124+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.36.0 // indirect
124125
github.com/aymerick/douceur v0.2.0 // indirect
125126
github.com/bahlo/generic-list-go v0.2.0 // indirect
126127
github.com/bits-and-blooms/bitset v1.24.4 // indirect

go.sum

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ github.com/agext/levenshtein v1.2.1 h1:QmvMAjj2aEICytGiWzmxoE0x2KZvE0fvmqMOfy2tj
4343
github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
4444
github.com/alecthomas/assert/v2 v2.11.0 h1:2Q9r3ki8+JYXvGsDyBXwH3LcJ+WK5D0gc5E8vS6K3D0=
4545
github.com/alecthomas/assert/v2 v2.11.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k=
46-
github.com/alecthomas/chroma/v2 v2.24.1 h1:m5ffpfZbIb++k8AqFEKy9uVgY12xIQtBsQlc6DfZJQM=
47-
github.com/alecthomas/chroma/v2 v2.24.1/go.mod h1:l+ohZ9xRXIbGe7cIW+YZgOGbvuVLjMps/FYN/CwuabI=
46+
github.com/alecthomas/chroma/v2 v2.25.0 h1:DWkVlxrNpxPf+Qcfe04LBqUArxUiybK8ZQ9T7OFu68E=
47+
github.com/alecthomas/chroma/v2 v2.25.0/go.mod h1:+95AZrRWlpW9g6qXD7S7UdHviopsGP/kCIrtJcU3QoQ=
4848
github.com/alecthomas/repr v0.5.2 h1:SU73FTI9D1P5UNtvseffFSGmdNci/O6RsqzeXJtP0Qs=
4949
github.com/alecthomas/repr v0.5.2/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
5050
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
@@ -65,10 +65,10 @@ github.com/aws/aws-sdk-go-v2 v1.41.7 h1:DWpAJt66FmnnaRIOT/8ASTucrvuDPZASqhhLey6t
6565
github.com/aws/aws-sdk-go-v2 v1.41.7/go.mod h1:4LAfZOPHNVNQEckOACQx60Y8pSRjIkNZQz1w92xpMJc=
6666
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.10 h1:gx1AwW1Iyk9Z9dD9F4akX5gnN3QZwUB20GGKH/I+Rho=
6767
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.10/go.mod h1:qqY157uZoqm5OXq/amuaBJyC9hgBCBQnsaWnPe905GY=
68-
github.com/aws/aws-sdk-go-v2/config v1.32.17 h1:FpL4/758/diKwqbytU0prpuiu60fgXKUWCpDJtApclU=
69-
github.com/aws/aws-sdk-go-v2/config v1.32.17/go.mod h1:OXqUMzgXytfoF9JaKkhrOYsyh72t9G+MJH8mMRaexOE=
70-
github.com/aws/aws-sdk-go-v2/credentials v1.19.16 h1:r3RJBuU7X9ibt8RHbMjWE6y60QbKBiII6wSrXnapxSU=
71-
github.com/aws/aws-sdk-go-v2/credentials v1.19.16/go.mod h1:6cx7zqDENJDbBIIWX6P8s0h6hqHC8Avbjh9Dseo27ug=
68+
github.com/aws/aws-sdk-go-v2/config v1.32.18 h1:Hcia46bxhGgF3BaSnG8nSNCWmqTK6bj9xN9/FJ3WK6Q=
69+
github.com/aws/aws-sdk-go-v2/config v1.32.18/go.mod h1:zEjCAYmxqDadH1WX8CdBvmLKhUEUVFgKRQG38zjDmrY=
70+
github.com/aws/aws-sdk-go-v2/credentials v1.19.17 h1:gP2nkGsS+KMvF/jfFz2Vv2qiiOqWKyPACSzPsqHgoW8=
71+
github.com/aws/aws-sdk-go-v2/credentials v1.19.17/go.mod h1:Bsew3S/moG5iT77giPj1q8wb/s0RE5/QfH+ASjYtuQc=
7272
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.23 h1:UuSfcORqNSz/ey3VPRS8TcVH2Ikf0/sC+Hdj400QI6U=
7373
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.23/go.mod h1:+G/OSGiOFnSOkYloKj/9M35s74LgVAdJBSD5lsFfqKg=
7474
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.23 h1:GpT/TrnBYuE5gan2cZbTtvP+JlHsutdmlV2YfEyNde0=
@@ -87,8 +87,8 @@ github.com/aws/aws-sdk-go-v2/service/signin v1.0.11 h1:TdJ+HdzOBhU8+iVAOGUTU63VX
8787
github.com/aws/aws-sdk-go-v2/service/signin v1.0.11/go.mod h1:R82ZRExE/nheo0N+T8zHPcLRTcH8MGsnR3BiVGX0TwI=
8888
github.com/aws/aws-sdk-go-v2/service/sso v1.30.17 h1:7byT8HUWrgoRp6sXjxtZwgOKfhss5fW6SkLBtqzgRoE=
8989
github.com/aws/aws-sdk-go-v2/service/sso v1.30.17/go.mod h1:xNWknVi4Ezm1vg1QsB/5EWpAJURq22uqd38U8qKvOJc=
90-
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.21 h1:+1Kl1zx6bWi4X7cKi3VYh29h8BvsCoHQEQ6ST9X8w7w=
91-
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.21/go.mod h1:4vIRDq+CJB2xFAXZ+YgGUTiEft7oAQlhIs71xcSeuVg=
90+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.36.0 h1:nDARhv/oF55bcxF7rCI/4PDxOKnVXVWwDuDwCs2I2SQ=
91+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.36.0/go.mod h1:4vIRDq+CJB2xFAXZ+YgGUTiEft7oAQlhIs71xcSeuVg=
9292
github.com/aws/aws-sdk-go-v2/service/sts v1.42.1 h1:F/M5Y9I3nwr2IEpshZgh1GeHpOItExNM9L1euNuh/fk=
9393
github.com/aws/aws-sdk-go-v2/service/sts v1.42.1/go.mod h1:mTNxImtovCOEEuD65mKW7DCsL+2gjEH+RPEAexAzAio=
9494
github.com/aws/smithy-go v1.25.1 h1:J8ERsGSU7d+aCmdQur5Txg6bVoYelvQJgtZehD12GkI=
@@ -199,6 +199,8 @@ github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5Qvfr
199199
github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
200200
github.com/dlclark/regexp2 v1.12.0 h1:0j4c5qQmnC6XOWNjP3PIXURXN2gWx76rd3KvgdPkCz8=
201201
github.com/dlclark/regexp2 v1.12.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
202+
github.com/dlclark/regexp2/v2 v2.1.0 h1:jHXRmHRZGbuQzDZjMlCAXOvQb75iv3HyLDzXGj5H1AY=
203+
github.com/dlclark/regexp2/v2 v2.1.0/go.mod h1:Bz5TMy5d8fPK0ximH0Yi9KvsRHNnvXqUx9XG6a4wB+I=
202204
github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI=
203205
github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ=
204206
github.com/docker/cli v29.5.2+incompatible h1:ubykJ1Y8LmNRGJ2BuMQ0kHOt/RO1YzGNswqWMJgivuQ=
@@ -213,8 +215,8 @@ github.com/docker/go-metrics v0.0.1 h1:AgB/0SvBxihN0X8OR4SjsblXkbMvalQ8cjmtKQ2rQ
213215
github.com/docker/go-metrics v0.0.1/go.mod h1:cG1hvH2utMXtqgqqYE9plW6lDxS3/5ayHzueweSI3Vw=
214216
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
215217
github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
216-
github.com/docker/portcullis v0.0.0-20260522094836-b66c4ab750fd h1:IGSoI9F8+p5ukGASbGrKpa0Mxm9CIGL6f/QzCgRzOhg=
217-
github.com/docker/portcullis v0.0.0-20260522094836-b66c4ab750fd/go.mod h1:3Hov4sJxb5afp5R4NE9wSz/c8xlCTU9Kn1sUgF6O6U4=
218+
github.com/docker/portcullis v0.0.0-20260526131538-fc97bf12bbdb h1:0Juktp2Xn6Nxs0fqaCeuTSM01i6Pe1+7aKLsBhMfp2I=
219+
github.com/docker/portcullis v0.0.0-20260526131538-fc97bf12bbdb/go.mod h1:FBCDtWLlYquonR/uesgN9HhLvbaDIX3PEC6lgHCnL24=
218220
github.com/dop251/goja v0.0.0-20260311135729-065cd970411c h1:OcLmPfx1T1RmZVHHFwWMPaZDdRf0DBMZOFMVWJa7Pdk=
219221
github.com/dop251/goja v0.0.0-20260311135729-065cd970411c/go.mod h1:MxLav0peU43GgvwVgNbLAj1s/bSGboKkhuULvq/7hx4=
220222
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
@@ -328,8 +330,8 @@ github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/u
328330
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
329331
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
330332
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
331-
github.com/junegunn/fzf v0.72.0 h1:GnXEfKYp3s/HljrIcDgkOrWWxHWfhkLyRBIiC/enaVY=
332-
github.com/junegunn/fzf v0.72.0/go.mod h1:xlXX2/rmsccKQUnr9QOXPDi5DyV9cM0UjKy/huScBeE=
333+
github.com/junegunn/fzf v0.73.1 h1:Ni9jaVMxsehcx9IwJ4ZAL/sr2c4dOEg1DHIAwPUVlyo=
334+
github.com/junegunn/fzf v0.73.1/go.mod h1:hKDkO8orBWT5VLIZOL8oyhxn7mRLXdGyu+gz1Ss58pU=
333335
github.com/junegunn/go-shellwords v0.0.0-20250127100254-2aa3b3277741 h1:7dYDtfMDfKzjT+DVfIS4iqknSEKtZpEcXtu6vuaasHs=
334336
github.com/junegunn/go-shellwords v0.0.0-20250127100254-2aa3b3277741/go.mod h1:6EILKtGpo5t+KLb85LNZLAF6P9LKp78hJI80PXMcn3c=
335337
github.com/k3a/html2text v1.4.0 h1:e4xarrVgZST+h+5C/fbA6AI49VFDSlEWMmIcDWcxsd0=

pkg/hooks/builtins/redact_secrets_test.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,14 @@ import (
99

1010
"github.com/docker/docker-agent/pkg/chat"
1111
"github.com/docker/docker-agent/pkg/hooks"
12+
"github.com/docker/docker-agent/pkg/internal/portcullistest"
1213
"github.com/docker/docker-agent/pkg/tools"
1314
)
1415

16+
func fakeGitHubPAT() string {
17+
return portcullistest.FakeGitHubPAT("cxLeRrvbJfmYdUtr70xnNE3Q7Gvli4")
18+
}
19+
1520
// TestRedactSecretsScrubsTopLevelStringValue: a recognised secret in
1621
// a top-level string argument is replaced and ONLY the rewritten key
1722
// is emitted in UpdatedInput. The latter is critical because
@@ -21,7 +26,7 @@ import (
2126
func TestRedactSecretsScrubsTopLevelStringValue(t *testing.T) {
2227
t.Parallel()
2328

24-
const secret = "ghp_cxLeRrvbJfmYdUtr70xnNE3Q7Gvli43s19PD"
29+
secret := fakeGitHubPAT()
2530

2631
in := &hooks.Input{
2732
HookEventName: hooks.EventPreToolUse,
@@ -133,7 +138,7 @@ func TestRedactSecretsIsRegistered(t *testing.T) {
133138
handler, ok := reg.LookupBuiltin(RedactSecrets)
134139
require.Truef(t, ok, "builtin %q must be registered", RedactSecrets)
135140

136-
const secret = "ghp_cxLeRrvbJfmYdUtr70xnNE3Q7Gvli43s19PD"
141+
secret := fakeGitHubPAT()
137142
out, err := handler(t.Context(), &hooks.Input{
138143
HookEventName: hooks.EventPreToolUse,
139144
ToolName: "shell",
@@ -187,7 +192,7 @@ func TestApplyAgentDefaultsInjectsRedactSecrets(t *testing.T) {
187192
func TestRedactSecretsScrubsOutgoingMessages(t *testing.T) {
188193
t.Parallel()
189194

190-
const secret = "ghp_cxLeRrvbJfmYdUtr70xnNE3Q7Gvli43s19PD"
195+
secret := fakeGitHubPAT()
191196
in := &hooks.Input{
192197
HookEventName: hooks.EventBeforeLLMCall,
193198
Messages: []chat.Message{
@@ -236,7 +241,7 @@ func TestRedactSecretsBeforeLLMCallNoOpOnCleanMessages(t *testing.T) {
236241
func TestRedactSecretsBeforeLLMCallScrubsToolCallArguments(t *testing.T) {
237242
t.Parallel()
238243

239-
const secret = "ghp_cxLeRrvbJfmYdUtr70xnNE3Q7Gvli43s19PD"
244+
secret := fakeGitHubPAT()
240245
in := &hooks.Input{
241246
HookEventName: hooks.EventBeforeLLMCall,
242247
Messages: []chat.Message{
@@ -275,7 +280,7 @@ func TestRedactSecretsBeforeLLMCallScrubsToolCallArguments(t *testing.T) {
275280
func TestRedactSecretsScrubsToolOutput(t *testing.T) {
276281
t.Parallel()
277282

278-
const secret = "ghp_cxLeRrvbJfmYdUtr70xnNE3Q7Gvli43s19PD"
283+
secret := fakeGitHubPAT()
279284
in := &hooks.Input{
280285
HookEventName: hooks.EventToolResponseTransform,
281286
ToolName: "shell",
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Package portcullistest provides test helpers for code that
2+
// exercises portcullis' GitHub-token detection rules.
3+
package portcullistest
4+
5+
import "hash/crc32"
6+
7+
// FakeGitHubPAT returns a synthetic GitHub PAT whose trailing 6-char
8+
// base62 CRC32 suffix passes portcullis' validGitHubChecksum, so the
9+
// returned token is detected (and redacted) by the secret scanner.
10+
//
11+
// The token is assembled at runtime: the full 40-char `ghp_…` string
12+
// never appears as a source literal, so GitHub's secret-scanning
13+
// push protection won't flag files that call this helper.
14+
//
15+
// body must be exactly 30 base62 characters; callers vary it to get
16+
// distinct fake tokens. The result has the GitHub-PAT shape
17+
// `ghp_` + 36 base62 chars and is never a real credential.
18+
func FakeGitHubPAT(body string) string {
19+
const (
20+
alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
21+
suffixLen = 6
22+
)
23+
if len(body) != 30 {
24+
panic("portcullistest: body must be 30 chars")
25+
}
26+
var suffix [suffixLen]byte
27+
checksum := uint64(crc32.ChecksumIEEE([]byte(body)))
28+
for i := suffixLen - 1; i >= 0; i-- {
29+
suffix[i] = alphabet[checksum%62]
30+
checksum /= 62
31+
}
32+
return "ghp_" + body + string(suffix[:])
33+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package portcullistest_test
2+
3+
import (
4+
"strings"
5+
"testing"
6+
7+
"github.com/docker/portcullis"
8+
"github.com/stretchr/testify/assert"
9+
10+
"github.com/docker/docker-agent/pkg/internal/portcullistest"
11+
)
12+
13+
func TestFakeGitHubPAT_DetectedByPortcullis(t *testing.T) {
14+
t.Parallel()
15+
16+
tok := portcullistest.FakeGitHubPAT("cxLeRrvbJfmYdUtr70xnNE3Q7Gvli4")
17+
18+
assert.True(t, strings.HasPrefix(tok, "ghp_"))
19+
assert.Len(t, tok, 40)
20+
assert.True(t, portcullis.Contains(tok), "synthetic PAT must trigger portcullis detection")
21+
assert.Equal(t, portcullis.Marker, portcullis.Redact(tok))
22+
}
23+
24+
func TestFakeGitHubPAT_RejectsWrongLength(t *testing.T) {
25+
t.Parallel()
26+
27+
assert.Panics(t, func() { portcullistest.FakeGitHubPAT("too-short") })
28+
}

pkg/sandbox/kit/kit_test.go

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,16 @@ import (
1414
"github.com/stretchr/testify/require"
1515

1616
latestcfg "github.com/docker/docker-agent/pkg/config/latest"
17+
"github.com/docker/docker-agent/pkg/internal/portcullistest"
1718
"github.com/docker/docker-agent/pkg/promptfiles"
1819
"github.com/docker/docker-agent/pkg/skills"
1920
)
2021

21-
// fakeGitHubToken is a syntactically valid GitHub PAT that triggers
22-
// portcullis. It is only used as input to the redactor, never as an
22+
// fakeGitHubToken is used only as input to the redactor, never as an
2323
// actual credential.
24-
const fakeGitHubToken = "ghp_" + "1234567890abcdefghijklmnopqrstuvwxyz"
24+
func fakeGitHubToken() string {
25+
return portcullistest.FakeGitHubPAT("1234567890abcdefghijklmnopqrst")
26+
}
2527

2628
// isolateEnv prevents a developer-exported DOCKER_AGENT_KIT_DIR from
2729
// flipping the in-process resolvers (notably skills.Load) into
@@ -39,7 +41,8 @@ func TestBuild_StagesSkillsAndRedacts(t *testing.T) {
3941
// Stage one local skill on the host with a secret embedded.
4042
skillDir := filepath.Join(hostHome, ".agents", "skills", "secret-keeper")
4143
require.NoError(t, os.MkdirAll(skillDir, 0o755))
42-
skillBody := "---\nname: secret-keeper\ndescription: ships with a secret\n---\n\ntoken=" + fakeGitHubToken + "\n"
44+
token := fakeGitHubToken()
45+
skillBody := "---\nname: secret-keeper\ndescription: ships with a secret\n---\n\ntoken=" + token + "\n"
4346
require.NoError(t, os.WriteFile(filepath.Join(skillDir, "SKILL.md"), []byte(skillBody), 0o644))
4447

4548
t.Setenv("HOME", hostHome)
@@ -66,7 +69,7 @@ func TestBuild_StagesSkillsAndRedacts(t *testing.T) {
6669
staged := filepath.Join(res.HostDir, skills.KitSkillsSubdir, "secret-keeper", "SKILL.md")
6770
data, err := os.ReadFile(staged)
6871
require.NoError(t, err)
69-
assert.NotContains(t, string(data), fakeGitHubToken, "host secret must not survive in kit")
72+
assert.NotContains(t, string(data), token, "host secret must not survive in kit")
7073
assert.Contains(t, string(data), portcullis.Marker, "redaction marker must be present")
7174

7275
// The manifest records the skill and the redaction.
@@ -555,8 +558,9 @@ func TestPrintSummary(t *testing.T) {
555558
// with secret count, and ~ collapsing of host paths.
556559
withSecret := filepath.Join(hostHome, ".agents", "skills", "with-secret")
557560
require.NoError(t, os.MkdirAll(withSecret, 0o755))
561+
token := fakeGitHubToken()
558562
require.NoError(t, os.WriteFile(filepath.Join(withSecret, "SKILL.md"),
559-
[]byte("---\nname: with-secret\ndescription: leaks\n---\n\ntoken="+fakeGitHubToken+"\n"), 0o644))
563+
[]byte("---\nname: with-secret\ndescription: leaks\n---\n\ntoken="+token+"\n"), 0o644))
560564
require.NoError(t, os.WriteFile(filepath.Join(withSecret, "helper.sh"),
561565
[]byte("#!/bin/sh\necho hi\n"), 0o755))
562566

@@ -566,7 +570,7 @@ func TestPrintSummary(t *testing.T) {
566570
[]byte("---\nname: plain\ndescription: plain\n---\n"), 0o644))
567571

568572
agentsMD := filepath.Join(hostHome, "AGENTS.md")
569-
require.NoError(t, os.WriteFile(agentsMD, []byte("token="+fakeGitHubToken+"\n"), 0o600))
573+
require.NoError(t, os.WriteFile(agentsMD, []byte("token="+token+"\n"), 0o600))
570574

571575
workspace := t.TempDir()
572576
agentYAML := []byte(`#!/usr/bin/env docker-agent
@@ -622,7 +626,7 @@ models:
622626
assert.Contains(t, out, "summary: 2 skills, 1 prompt file, 2 secrets redacted")
623627

624628
// And no host secret leaks into the printed output.
625-
assert.NotContains(t, out, fakeGitHubToken)
629+
assert.NotContains(t, out, token)
626630
}
627631

628632
func TestPrintSummary_WorkspacePromptFile(t *testing.T) {

0 commit comments

Comments
 (0)