Skip to content

Commit 4166671

Browse files
authored
Fix: do not override uid/git in buildpack builder (knative#2819)
* Fix: do not override uid/git in buildpack builder Zero value implies override (to root presumably), we must set it to negative value. Signed-off-by: Matej Vašek <[email protected]> * Fixup tests Since we do not override uid/gid==0 we need to make mounted data less readable to all. Signed-off-by: Matej Vašek <[email protected]> --------- Signed-off-by: Matej Vašek <[email protected]>
1 parent f6b5e39 commit 4166671

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

pkg/builders/builders_int_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func TestPrivateGitRepository(t *testing.T) {
6565
}
6666

6767
gitCredsDir := t.TempDir()
68-
err := os.WriteFile(filepath.Join(gitCredsDir, "type"), []byte(`git-credentials`), 0600)
68+
err := os.WriteFile(filepath.Join(gitCredsDir, "type"), []byte(`git-credentials`), 0644)
6969
if err != nil {
7070
t.Fatal(err)
7171
}
@@ -74,7 +74,7 @@ func TestPrivateGitRepository(t *testing.T) {
7474
username=developer
7575
password=nbusr123
7676
`
77-
err = os.WriteFile(filepath.Join(gitCredsDir, "credentials"), []byte(gitCred), 0600)
77+
err = os.WriteFile(filepath.Join(gitCredsDir, "credentials"), []byte(gitCred), 0644)
7878
if err != nil {
7979
t.Fatal(err)
8080
}

pkg/builders/buildpacks/builder.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ func (b *Builder) Build(ctx context.Context, f fn.Function, platforms []fn.Platf
153153
}
154154
// Pack build options
155155
opts := pack.BuildOptions{
156+
GroupID: -1,
157+
UserID: -1,
156158
AppPath: f.Root,
157159
Image: f.Build.Image,
158160
LifecycleImage: DefaultLifecycleImage,

0 commit comments

Comments
 (0)