Skip to content

Preserve package properties in CycloneDX output - #14

Merged
andrew merged 1 commit into
git-pkgs:mainfrom
abhinavgautam01:fix/encode-package-properties-307
Aug 27, 2026
Merged

Preserve package properties in CycloneDX output#14
andrew merged 1 commit into
git-pkgs:mainfrom
abhinavgautam01:fix/encode-package-properties-307

Conversation

@abhinavgautam01

Copy link
Copy Markdown
Contributor

Refs git-pkgs/git-pkgs#307

Summary

  • Copy Package.Properties into generated CycloneDX components.
  • Preserve properties in both CycloneDX JSON and XML output.
  • Add regression coverage for JSON round-tripping and XML encoding.

Motivation

Package.Properties is currently populated and parsed by the SBOM package, but generated CycloneDX documents omit it during encoding.

This is a prerequisite for git-pkgs/git-pkgs#307, which attaches manifest occurrence metadata to SBOM components using indexed properties.

Verification

  • gofmt
  • go test ./... -count=1

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR ensures Package.Properties are preserved when encoding CycloneDX SBOMs, addressing the gap where properties were parsed/populated internally but dropped from generated CycloneDX output. This aligns the encoder with existing CycloneDX parsing support that already reads component properties back into Package.Properties.

Changes:

  • Copy Package.Properties into CycloneDX component.properties during encoding.
  • Verify CycloneDX JSON preserves properties via a JSON round-trip regression test.
  • Verify CycloneDX XML output includes <properties><property .../></properties> via an encoding regression test.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
encode.go Adds property propagation from Package.Properties into encoded CycloneDX components.
encode_test.go Extends fixtures and tests to assert CycloneDX JSON round-trips properties and CycloneDX XML includes the expected <property> element.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@andrew
andrew merged commit 232d3db into git-pkgs:main Aug 27, 2026
2 checks passed
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.

3 participants