Skip to content

Commit 9ddc3dc

Browse files
committed
Extend default debian/gbp.conf with extra security config tips
When creating a new package, populate the git-buildpackage with additional configs and in-line comments on why and how to use them. This will make go packaging easier, more consistent and more secure as the best practices flow to all packages via good defaults. Also add comment to explain why pristine-tar is beneficial.
1 parent 7040600 commit 9ddc3dc

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

make.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,8 @@ func runGitCommandIn(dir string, arg ...string) error {
416416
}
417417

418418
func createGitRepository(debsrc, gopkg, orig string, u *upstream,
419-
includeUpstreamHistory bool, allowUnknownHoster bool, debianBranch string, dep14 bool, pristineTar bool) (string, error) {
419+
includeUpstreamHistory bool, allowUnknownHoster bool, debianBranch string,
420+
dep14 bool, pristineTar bool) (string, error) {
420421

421422
// debianBranch is passed in function call, but upstream import branch needs
422423
// also to be defined

template.go

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,40 @@ func writeDebianGbpConf(dir string, dep14, pristineTar bool) error {
342342
fmt.Fprintf(f, "dist = DEP14\n")
343343
}
344344
if pristineTar {
345-
fmt.Fprintf(f, "pristine-tar = True\n")
345+
fmt.Fprintf(f, `
346+
# Always use pristine tar to improve supply chain security and auditability
347+
pristine-tar = True
348+
349+
`)
346350
}
351+
352+
// Additional text to the template which is useful for 99% of the go packages
353+
fmt.Fprint(f, `
354+
# Lax requirement to use branch name 'debian/latest' so that git-buildpackage
355+
# will always build using the currently checked out branch as the Debian branch.
356+
# This makes it easier for contributors to work with feature and bugfix
357+
# branches.
358+
ignore-branch = True
359+
360+
# Configure the upstream tag format below, so that 'gbp import-orig' will run
361+
# correctly, and link tarball import branch ('upstream/latest') with the
362+
# equivalent upstream release tag, showing a complete audit trail of what
363+
# upstream released and what was imported into Debian.
364+
#
365+
# Most Go packages have tags of form 'v1.0.0'
366+
upstream-vcs-tag = v%(version%~%-)s
367+
368+
# If upstream publishes tarball signatures, git-buildpackage will by default
369+
# import and use the them. Change this to 'on' to make 'gbp import-orig' abort
370+
# if the signature is not found or is not valid.
371+
#
372+
# Most Go packages don't publish signatures for the tarball releases, so this is
373+
# not enabled by default.
374+
#upstream-signatures = on
375+
376+
# Ensure the Debian maintainer signs git tags automatically
377+
sign-tags = True
378+
`)
347379
return nil
348380
}
349381

0 commit comments

Comments
 (0)