Skip to content

refactor(vulnfeeds): migrate debian-copyright-mirror to Go - #5885

Merged
jess-lowe merged 12 commits into
google:masterfrom
jess-lowe:refactor/debian-copyright-mirror
Sep 28, 2026
Merged

jess-lowe merged 12 commits into
google:masterfrom
jess-lowe:refactor/debian-copyright-mirror

Conversation

@jess-lowe

@jess-lowe jess-lowe commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

Rewrites debian-copyright-mirror from Python and Bash into a standalone Go binary (vulnfeeds/cmd/mirrors/debian-copyright-mirror). Instead of buffering the entire archive and parsing the full YAML file into memory, the Go implementation streams filelist.yaml.xz over HTTP to scan for unstable package copyright files, manages parallel downloads via curl, creates the tarball archive, and uploads directly to Google Cloud Storage using the Cloud Storage Go client library. This eliminates the legacy Python and Bash scripts, removes runtime dependencies on Python and the gcloud CLI to significantly shrink the Docker container footprint, and improves reliability while maintaining full compatibility with downstream consumers like cpe-repo-gen.

Testing Done

  • go test ./... in vulnfeeds (all tests passing).
  • golangci-lint run (0 issues).
  • Verified full download and local .tar generation with live Debian changelog metadata.

Comment thread vulnfeeds/utility/archive.go Fixed
Comment thread vulnfeeds/utility/archive.go Fixed

@another-rex another-rex left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a lot of unnecessary code imho. We don't need to reimplement the whole archiving stack in go. Just shell out to tar to extract the files like it did in the original script.

This should be about 200 lines of go code, not 1500

@michaelkedar michaelkedar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems mostly fine to me

Comment thread vulnfeeds/cmd/mirrors/debian-copyright-mirror/Dockerfile Outdated
michaelkedar
michaelkedar previously approved these changes Sep 25, 2026

@another-rex another-rex left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also rewrite the commit to fix the CLA issue.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow actually about 200 lines, nice!

Comment thread vulnfeeds/cmd/mirrors/debian-copyright-mirror/main.go
Comment thread vulnfeeds/cmd/mirrors/debian-copyright-mirror/README.md
Comment thread vulnfeeds/cmd/mirrors/debian-copyright-mirror/main_test.go
another-rex
another-rex previously approved these changes Sep 28, 2026

@another-rex another-rex left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice LGTM. (PR description might need a bit of updating though)

}

files, err := ExtractUnstableCopyright(stdout, prefixFilter)
_ = cmd.Wait()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also return this error (if this errors?)

@jess-lowe
jess-lowe merged commit 7f87c13 into google:master Sep 28, 2026
24 checks passed
@jess-lowe
jess-lowe deleted the refactor/debian-copyright-mirror branch September 28, 2026 03:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants