|
| 1 | +# Testing Editing Feature |
| 2 | + |
| 3 | +- This is simply to test all the features related to edit command. |
| 4 | +- It allows edit on the basis of subject. It support 3 kinds of subjects: Document, Primary COmponent, and Cmponent with name and version. |
| 5 | + |
| 6 | +## Examples |
| 7 | + |
| 8 | +### 1. Edit Document |
| 9 | + |
| 10 | +1. Append author to the document |
| 11 | + |
| 12 | +```bash |
| 13 | +sbomasm edit --subject document --author "Interlynk (hello@interlynk.io)" samples/test/edit/in-complete-sbom.spdx.json -o append-author-sbom.spdx.json --append |
| 14 | + |
| 15 | +sbomasm edit --subject document --author "Interlynk (hello@interlynk.io)" samples/test/edit/in-complete-sbom.cdx.json -o append-author-sbom.cdx.json --append |
| 16 | +``` |
| 17 | + |
| 18 | +- Similarly for other fields: |
| 19 | + |
| 20 | +```bash |
| 21 | +# supplier(SPDX doesn't support) |
| 22 | +sbomasm edit --subject document --supplier "Interlynk (https://interlynk.io)" samples/test/edit/in-complete-sbom.cdx.json -o append-supplier-sbom.cdx.json --append |
| 23 | + |
| 24 | +# lifecycle |
| 25 | +sbomasm edit --subject document --lifecycle "source" samples/test/edit/in-complete-sbom.spdx.json -o append-lifecycle-sbom.spdx.json --append |
| 26 | + |
| 27 | +sbomasm edit --subject document --lifecycle "source" samples/test/edit/in-complete-sbom.cdx.json -o append-lifecycle-sbom.cdx.json --append |
| 28 | + |
| 29 | +# license |
| 30 | +sbomasm edit --subject document --license "CC0-1.1" samples/test/edit/in-complete-sbom.spdx.json -o append-license-sbom.spdx.json |
| 31 | + |
| 32 | +sbomasm edit --subject document --license "Acme Customer Data License" samples/test/edit/in-complete-sbom.cdx.json -o append-license-sbom.cdx.json |
| 33 | + |
| 34 | +# repository(SPDX doesn't support) |
| 35 | +sbomasm edit --subject document --repository "https://kyverno.io/" samples/test/edit/in-complete-sbom.cdx.json -o append-repo-sbom.cdx.json --append |
| 36 | +``` |
| 37 | + |
| 38 | +### 2. Edit Primary Component |
| 39 | + |
| 40 | +```bash |
| 41 | +sbomasm edit --subject primary-component --author "Jim (jim@nirmata.com)" samples/test/edit/in-complete-sbom.spdx.json -o append-pc-author-sbom.spdx.json --append |
| 42 | + |
| 43 | +sbomasm edit --subject primary-component --author "Interlynk (hello@interlynk.io)" samples/test/edit/in-complete-sbom.cdx.json -o append-author-sbom.cdx.json --append |
| 44 | +``` |
| 45 | + |
| 46 | +- Similarly for other fields: |
| 47 | + |
| 48 | +```bash |
| 49 | +# supplier |
| 50 | +sbomasm edit --subject primary-component --supplier "Kyverno (https://kyverno.io)" samples/test/edit/in-complete-sbom.spdx.json -o append-pc-supplier-sbom.spdx.json --append |
| 51 | + |
| 52 | +sbomasm edit --subject primary-component --supplier "Kyverno (https://kyverno.io)" samples/test/edit/in-complete-sbom.cdx.json -o append-pc-supplier-sbom.cdx.json --append |
| 53 | + |
| 54 | +# license |
| 55 | +sbomasm edit --subject primary-component --license "Apache-2.0" samples/test/edit/in-complete-sbom.spdx.json -o append-pc-license-sbom.spdx.json |
| 56 | + |
| 57 | +sbomasm edit --subject primary-component --license "Apache-2.0" samples/test/edit/in-complete-sbom.cdx.json -o append-pc-license-sbom.cdx.json |
| 58 | + |
| 59 | +# copyright |
| 60 | +sbomasm edit --subject primary-component --copyright "Copyright 2025, the Kyverno project" samples/test/edit/in-complete-sbom.spdx.json -o append-pc-copyright-sbom.spdx.json |
| 61 | + |
| 62 | +sbomasm edit --subject primary-component --copyright "Copyright 2025, the Kyverno project" samples/test/edit/in-complete-sbom.cdx.json -o append-pc-copyright-sbom.cdx.json |
| 63 | + |
| 64 | +# description |
| 65 | +sbomasm edit --subject primary-component --description "Kyverno is a policy engine designed for Kubernetes." samples/test/edit/in-complete-sbom.spdx.json -o append-pc-description-sbom.spdx.json |
| 66 | + |
| 67 | +sbomasm edit --subject primary-component --description "Kyverno is a policy engine designed for Kubernetes." samples/test/edit/in-complete-sbom.cdx.json -o append-pc-description-sbom.cdx.json |
| 68 | + |
| 69 | +# repository |
| 70 | +sbomasm edit --subject primary-component --repository "https://github.com/kyverno/kyverno/releases" samples/test/edit/in-complete-sbom.spdx.json -o append-pc-repository-sbom.spdx.json |
| 71 | + |
| 72 | + |
| 73 | +sbomasm edit --subject primary-component --repository "https://github.com/kyverno/kyverno/releases" samples/test/edit/in-complete-sbom.cdx.json -o append-pc-repository-sbom.cdx.json |
| 74 | + |
| 75 | +# type |
| 76 | +sbomasm edit --subject primary-component --type "APPLICATION" samples/test/edit/in-complete-sbom.spdx.json -o append-pc-type-sbom.spdx.json |
| 77 | + |
| 78 | +sbomasm edit --subject primary-component --type "APPLICATION" samples/test/edit/in-complete-sbom.cdx.json -o append-pc-type-sbom.cdx.json |
| 79 | + |
| 80 | +``` |
| 81 | + |
| 82 | +### 3. Edit Specific Component |
| 83 | + |
| 84 | +In whole examples, we will take a component `github.com/fluxcd/pkg/oci` and version `v0.45.0` |
| 85 | + |
| 86 | +```bash |
| 87 | +sbomasm edit --subject component-name-version --search "github.com/fluxcd/pkg/oci (v0.45.0)" --author "Stefan Prodan (stefan@fluxcd.io)" samples/test/edit/in-complete-sbom.spdx.json -o append-comp-author-sbom.spdx.json --append |
| 88 | + |
| 89 | +sbomasm edit --subject component-name-version --search "github.com/fluxcd/pkg/oci (v0.45.0)" --author "Stefan Prodan (stefan@fluxcd.io)" samples/test/edit/in-complete-sbom.cdx.json -o append-comp-author-sbom.cdx.json --append |
| 90 | +``` |
| 91 | + |
| 92 | +- Similarly for other fields: |
| 93 | + |
| 94 | +```bash |
| 95 | +# supplier |
| 96 | +sbomasm edit --subject component-name-version --search "github.com/fluxcd/pkg/oci (v0.45.0)" --supplier "Flux (https://fluxcd.io)" samples/test/edit/in-complete-sbom.spdx.json -o append-comp-supplier-sbom.spdx.json --append |
| 97 | + |
| 98 | +sbomasm edit --subject component-name-version --search "github.com/fluxcd/pkg/oci (v0.45.0)" --supplier "Flux (https://fluxcd.io)" samples/test/edit/in-complete-sbom.cdx.json -o append-comp-supplier-sbom.cdx.json --append |
| 99 | + |
| 100 | +# license |
| 101 | +sbomasm edit --subject component-name-version --search "github.com/fluxcd/pkg/oci (v0.45.0)" --license "Apache-2.0" samples/test/edit/in-complete-sbom.spdx.json -o append-comp-license-sbom.spdx.json |
| 102 | + |
| 103 | +sbomasm edit --subject component-name-version --search "github.com/fluxcd/pkg/oci (v0.45.0)" --license "Apache-2.0" samples/test/edit/in-complete-sbom.cdx.json -o append-comp-license-sbom.cdx.json |
| 104 | + |
| 105 | +# copyright |
| 106 | +sbomasm edit --subject component-name-version --search "github.com/fluxcd/pkg/oci (v0.45.0)" --copyright "Copyright 2025, the FluxCD project" samples/test/edit/in-complete-sbom.spdx.json -o append-comp-copyright-sbom.spdx.json |
| 107 | + |
| 108 | +sbomasm edit --subject component-name-version --search "github.com/fluxcd/pkg/oci (v0.45.0)" --copyright "Copyright 2025, the FluxCD project" samples/test/edit/in-complete-sbom.cdx.json -o append-comp-copyright-sbom.cdx.json |
| 109 | + |
| 110 | +# description |
| 111 | +sbomasm edit --subject component-name-version --search "github.com/fluxcd/pkg/oci (v0.45.0)" --description "The OCI package provides utilities for working with OCI images and registries." samples/test/edit/in-complete-sbom.spdx.json -o append-comp-description-sbom.spdx.json |
| 112 | + |
| 113 | +sbomasm edit --subject component-name-version --search "github.com/fluxcd/pkg/oci (v0.45.0)" --description "The OCI package provides utilities for working with OCI images and registries." samples/test/edit/in-complete-sbom.cdx.json -o append-comp-description-sbom.cdx.json |
| 114 | + |
| 115 | +# repository |
| 116 | +sbomasm edit --subject component-name-version --search "github.com/fluxcd/pkg/oci (v0.45.0)" --repository "https://github.com/fluxcd/pkg/oci" samples/test/edit/in-complete-sbom.spdx.json -o append-comp-repository-sbom.spdx.json |
| 117 | + |
| 118 | +sbomasm edit --subject component-name-version --search "github.com/fluxcd/pkg/oci (v0.45.0)" --repository "https://github.com/fluxcd/pkg/oci" samples/test/edit/in-complete-sbom.cdx.json -o append-comp-repository-sbom.cdx.json |
| 119 | + |
| 120 | +# type |
| 121 | +sbomasm edit --subject component-name-version --search "github.com/fluxcd/pkg/oci (v0.45.0)" --type "library" samples/test/edit/in-complete-sbom.spdx.json -o append-comp-type-sbom.spdx.json |
| 122 | + |
| 123 | +sbomasm edit --subject component-name-version --search "github.com/fluxcd/pkg/oci (v0.45.0)" --type "library" samples/test/edit/in-complete-sbom.cdx.json -o append-comp-type-sbom.cdx.json |
| 124 | +``` |
0 commit comments