diff --git a/internal/scaffold/fullsend-repo/profiles/fullsend-gitleaks.yaml b/internal/scaffold/fullsend-repo/profiles/fullsend-gitleaks.yaml index 4c6014ddf9..d573162c22 100644 --- a/internal/scaffold/fullsend-repo/profiles/fullsend-gitleaks.yaml +++ b/internal/scaffold/fullsend-repo/profiles/fullsend-gitleaks.yaml @@ -20,4 +20,5 @@ endpoints: access: read-only enforcement: enforce binaries: + - "**/git" - "**/pre-commit" diff --git a/internal/scaffold/fullsend-repo/profiles/fullsend-package-registries.yaml b/internal/scaffold/fullsend-repo/profiles/fullsend-package-registries.yaml index 0750af42aa..a9ea435616 100644 --- a/internal/scaffold/fullsend-repo/profiles/fullsend-package-registries.yaml +++ b/internal/scaffold/fullsend-repo/profiles/fullsend-package-registries.yaml @@ -9,11 +9,13 @@ endpoints: protocol: rest access: read-only enforcement: enforce + allow_encoded_slash: true - host: registry.yarnpkg.com port: 443 protocol: rest access: read-only enforcement: enforce + allow_encoded_slash: true - host: pypi.org port: 443 protocol: rest @@ -51,5 +53,7 @@ binaries: - "**/python" - "**/python3" - "**/python3.*" + - "**/uv" + - "**/uvx" - "**/go" - "**/pre-commit" diff --git a/internal/scaffold/scaffold_test.go b/internal/scaffold/scaffold_test.go index 963aaa92ba..58cbca9df9 100644 --- a/internal/scaffold/scaffold_test.go +++ b/internal/scaffold/scaffold_test.go @@ -1132,6 +1132,61 @@ func TestScaffoldGitHubROProfile_GraphQLEndpoint(t *testing.T) { "scaffold fullsend-github-ro profile must include exactly one GraphQL endpoint for api.github.com") } +func TestScaffoldPackageRegistriesProfile_Permissions(t *testing.T) { + data, err := FullsendRepoFile("profiles/fullsend-package-registries.yaml") + require.NoError(t, err) + + var profile struct { + Endpoints []struct { + Host string `yaml:"host"` + AllowEncodedSlash bool `yaml:"allow_encoded_slash"` + } `yaml:"endpoints"` + Binaries []string `yaml:"binaries"` + } + require.NoError(t, yaml.Unmarshal(data, &profile)) + + // The embedded copy is the authoritative definition of this built-in + // provider, so it must keep the permissions the fullsend-ai/agents copy + // has. Scoped npm package metadata requests use a %2F-encoded slash, + // which the proxy rejects unless allow_encoded_slash is set. See #8007. + encodedSlash := map[string]bool{} + for _, ep := range profile.Endpoints { + encodedSlash[ep.Host] = ep.AllowEncodedSlash + } + npmHosts := map[string]bool{"registry.npmjs.org": true, "registry.yarnpkg.com": true} + for host := range npmHosts { + require.Contains(t, encodedSlash, host, + "scaffold package-registries profile must include endpoint %s", host) + } + require.Contains(t, encodedSlash, "pypi.org", + "scaffold package-registries profile must include endpoint pypi.org") + // allow_encoded_slash is scoped to the npm registries only. + for host, allowed := range encodedSlash { + assert.Equal(t, npmHosts[host], allowed, + "endpoint %s: allow_encoded_slash must be set exactly on the npm registries", host) + } + + for _, bin := range []string{"**/uv", "**/uvx"} { + assert.Contains(t, profile.Binaries, bin, + "scaffold package-registries profile must allow binary %s", bin) + } +} + +func TestScaffoldGitleaksProfile_Permissions(t *testing.T) { + data, err := FullsendRepoFile("profiles/fullsend-gitleaks.yaml") + require.NoError(t, err) + + var profile struct { + Binaries []string `yaml:"binaries"` + } + require.NoError(t, yaml.Unmarshal(data, &profile)) + + // pre-commit uses git to clone the gitleaks hook repository from + // github.com; the fullsend-ai/agents copy allowed it. See #8007. + assert.Contains(t, profile.Binaries, "**/git", + "scaffold gitleaks profile must allow binary **/git") +} + func TestScaffoldVertexProfile_BinaryAllowlist(t *testing.T) { data, err := FullsendRepoFile("profiles/fullsend-vertex-ai.yaml") require.NoError(t, err)