csspin-tooling 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,18 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2026 CONTACT Software GmbH
4
+ # https://www.contact-software.com/
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+
18
+ # File needed for _utils.py to be imported.
@@ -0,0 +1,155 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2026 CONTACT Software GmbH
4
+ # https://www.contact-software.com/
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+
18
+ """Fetches the VEX file for a given project from Dependency-Track."""
19
+
20
+ import json
21
+ import re
22
+ from dataclasses import dataclass
23
+
24
+ import requests
25
+ from click import STRING
26
+ from csspin import argument, config, die, info, mkdir, task, writetext
27
+ from csspin.tree import ConfigTree
28
+ from path import Path
29
+
30
+ FILENAME_FALLBACK = "vex.json"
31
+
32
+ # -- Spin task -----------------------------------------------------------------
33
+ defaults = config(
34
+ project_name="{spin.project_name}",
35
+ target_directory="{spin.project_root}",
36
+ cyclonedx_version="1.6",
37
+ )
38
+
39
+
40
+ @task()
41
+ def fetch_vex(
42
+ cfg: ConfigTree,
43
+ project_version: argument(type=STRING, required=True), # type: ignore[valid-type]
44
+ ) -> None:
45
+ """Automated VEX file download for Dependency-Track.
46
+
47
+ Fetches the VEX data for the configured project from the configured
48
+ Dependency-Track instance and stores it as a JSON located in the configured
49
+ target directory."""
50
+
51
+ # input validation
52
+ required_inputs = (
53
+ (cfg.fetch_vex.deptrack_url, "fetch_vex.deptrack_url"),
54
+ (cfg.fetch_vex.deptrack_api_key, "fetch_vex.deptrack_api_key"),
55
+ (cfg.fetch_vex.project_name, "fetch_vex.project_name"),
56
+ )
57
+ for value, desc in required_inputs:
58
+ if not value:
59
+ die(f"Required configuration value {desc} missing")
60
+
61
+ target_project = Project(cfg.fetch_vex.project_name, project_version)
62
+ deptrack = DepTrackAPI(
63
+ cfg.fetch_vex.deptrack_url,
64
+ cfg.fetch_vex.deptrack_api_key,
65
+ cfg.fetch_vex.cyclonedx_version,
66
+ )
67
+ target_project.uuid = deptrack.get_uuid(target_project)
68
+ info(
69
+ f"Retrieved project UUID {target_project.uuid} "
70
+ f"({target_project.name} {target_project.version}) from {deptrack.url}"
71
+ )
72
+ _write_vex(deptrack.get_vex(target_project), cfg.fetch_vex.target_directory)
73
+
74
+
75
+ # -- DepTrack API --------------------------------------------------------------
76
+ @dataclass
77
+ class Project:
78
+ """Minimal representation of a Project as defined by Dependency-Track"""
79
+
80
+ name: str
81
+ version: str
82
+ uuid: str | None = None
83
+
84
+
85
+ @dataclass
86
+ class DepTrackAPI:
87
+ """Helper class to retrieve VEX data from Dependency-Track"""
88
+
89
+ url: str
90
+ api_key: str
91
+ cyclonedx_version: str
92
+
93
+ def get_uuid(self, project: Project) -> str:
94
+ """Retrieves a project's UUID from DepTrack"""
95
+ response = requests.get(
96
+ f"{self.url}/api/v1/project/lookup",
97
+ params={"name": project.name, "version": project.version},
98
+ headers={"X-API-Key": self.api_key},
99
+ timeout=10,
100
+ )
101
+
102
+ if not response.ok:
103
+ die(f"Unable to get project UUID: ({response.status_code}) {response.text}")
104
+
105
+ return response.json()["uuid"] # type: ignore
106
+
107
+ def get_vex(self, project: Project) -> dict:
108
+ """Retrieves the project's VEX data as a dict"""
109
+ response = requests.get(
110
+ f"{self.url}/api/v1/vex/cyclonedx/project/{project.uuid}",
111
+ params={"version": self.cyclonedx_version},
112
+ headers={"X-API-Key": self.api_key},
113
+ timeout=10,
114
+ )
115
+
116
+ if not response.ok:
117
+ die(
118
+ f"Unable to get VEX file from DepTrack: ({response.status_code}) {response.text}",
119
+ )
120
+
121
+ return response.json() # type: ignore
122
+
123
+
124
+ # -- Internals -----------------------------------------------------------------
125
+ def _write_vex(vex_data: dict, target_dir: Path) -> None:
126
+ """Serializes the VEX data to JSON and writes it to the given target directory.
127
+
128
+ The file name is determined by :func:`_get_filename`. If the function cannot
129
+ determine a filename based on the component metadata from the VEX data, a
130
+ fallback will be used and an error will be logged."""
131
+ filename = _get_filename(vex_data)
132
+ info(f"Writing VEX data to {target_dir / filename}")
133
+
134
+ mkdir(str(target_dir))
135
+ writetext(filename, json.dumps(vex_data))
136
+
137
+ if filename == FILENAME_FALLBACK:
138
+ die(
139
+ "Could not retrieve component metdata at /metadata/component."
140
+ f"Please check your VEX file at {target_dir / filename} as it might be invalid."
141
+ )
142
+
143
+
144
+ def _get_filename(vex_data: dict) -> str:
145
+ """Generates the file name from the VEX data"""
146
+ try:
147
+ tracking_id: str = (
148
+ f"{vex_data['metadata']['component']['name']}-"
149
+ f"{vex_data['metadata']['component']['version']}"
150
+ )
151
+ except KeyError:
152
+ return FILENAME_FALLBACK
153
+ tracking_id = tracking_id.lower()
154
+ tracking_id = re.sub(r"[^+\-a-z0-9]+", "_", tracking_id)
155
+ return f"{tracking_id}.vex.json"
@@ -0,0 +1,24 @@
1
+ # -*- mode: yaml; coding: utf-8 -*-
2
+ #
3
+ # Schema for the fetch_vex plugin for spin
4
+
5
+ fetch_vex:
6
+ type: object
7
+ help: |
8
+ The fetch_vex plugin pulls the VEX data from Dependency-Track and stores it in a local JSON file for later bundling.
9
+ properties:
10
+ project_name:
11
+ type: str
12
+ help: Project name as it is known to Dependency-Track
13
+ deptrack_url:
14
+ type: str
15
+ help: Dependency-Track instance to connect to
16
+ deptrack_api_key:
17
+ type: secret
18
+ help: API key for Dependency-Track
19
+ cyclonedx_version:
20
+ type: str
21
+ help: CycloneDX specification version for the VEX file
22
+ target_directory:
23
+ type: path
24
+ help: Directory to store the VEX JSON file in
@@ -0,0 +1,57 @@
1
+ # -*- mode: yaml; coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2026 CONTACT Software GmbH
4
+ # https://www.contact-software.com/
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ # Default SBOM quality policy for the csspin_tooling.sbomqs plugin.
19
+ #
20
+ # The blacklist covers copyleft licenses incompatible with commercial
21
+ # distribution. Required fields name, version, and license apply to all
22
+ # components.
23
+
24
+ policy:
25
+ # we also ensure license compliance in Dependency Track, so this rule here is
26
+ # just to receive early feedback.
27
+ - name: prohibited license
28
+ type: blacklist
29
+ rules:
30
+ - field: license
31
+ patterns:
32
+ - GPL-.* # includes LGPL and AGPL
33
+ - EUPL-.*
34
+ - CC-BY-SA.*
35
+ - CC-BY-NC.*
36
+ - CC-BY-ND.*
37
+ action: fail
38
+ - name: name
39
+ type: required
40
+ rules:
41
+ - field: name
42
+ action: fail
43
+ - name: version
44
+ type: required
45
+ rules:
46
+ - field: version
47
+ action: fail
48
+ - name: license
49
+ type: required
50
+ rules:
51
+ - field: license
52
+ action: fail
53
+ - name: purl
54
+ type: required
55
+ rules:
56
+ - field: purl
57
+ action: warn # will be fail as soon as we have that in place
@@ -0,0 +1,146 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2026 CONTACT Software GmbH
4
+ # https://www.contact-software.com/
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+
18
+ """Module implementing the SBOM assembly plugin for spin."""
19
+
20
+ from __future__ import annotations
21
+
22
+ import os
23
+ import sys
24
+ from tempfile import TemporaryDirectory
25
+
26
+ from csspin import (
27
+ backtick,
28
+ config,
29
+ die,
30
+ download,
31
+ exists,
32
+ extract,
33
+ group,
34
+ info,
35
+ setenv,
36
+ )
37
+ from csspin.tree import ConfigTree
38
+ from path import Path
39
+
40
+ defaults = config(
41
+ version="2.0.10",
42
+ install_dir="{spin.data}/csspin_tooling/sbomasm",
43
+ output_file="{spin.project_name}.cdx.json",
44
+ format=config(spec="cyclonedx", version="1.6"),
45
+ primary_sbom="{spin.project_name}*.python_sbom.cdx.json",
46
+ requires=config(spin=["csspin_python.python"]),
47
+ )
48
+
49
+
50
+ def provision(cfg: ConfigTree) -> None:
51
+ """Provision the plugin"""
52
+ _provision_sbomasm(cfg)
53
+
54
+
55
+ def init(cfg: ConfigTree) -> None:
56
+ """Make the managed sbomasm binary discoverable on ``PATH``."""
57
+ sbomasm_dir = cfg.sbomasm.install_dir / cfg.sbomasm.version
58
+ setenv(PATH=os.pathsep.join((sbomasm_dir, "{PATH}")))
59
+
60
+
61
+ @group()
62
+ def sbomasm(cfg: ConfigTree) -> None: # pylint: disable=unused-argument
63
+ """sbomasm-based SBOM assembly."""
64
+
65
+
66
+ @sbomasm.task(when="sbom:assemble")
67
+ def assemble(cfg: ConfigTree) -> None:
68
+ """Merge the top-level SBOMs into a single one."""
69
+ _assemble_sbom(cfg)
70
+
71
+
72
+ # -- Internals -----------------------------------------------------------------
73
+ def _provision_sbomasm(cfg: ConfigTree) -> None:
74
+ """Downloads sbomasm"""
75
+ version = cfg.sbomasm.version
76
+ sbomasm_install_dir = cfg.sbomasm.install_dir / version
77
+
78
+ if exists(sbomasm_install_dir / f"sbomasm{cfg.platform.exe}"):
79
+ info(f"Using cached sbomasm ({sbomasm_install_dir})")
80
+ return
81
+
82
+ info("Installing sbomasm")
83
+ archive = (
84
+ f"sbomasm_{version}_Windows_x86_64.tar.gz"
85
+ if sys.platform == "win32"
86
+ else f"sbomasm_{version}_Linux_x86_64.tar.gz"
87
+ )
88
+
89
+ with TemporaryDirectory() as tmp_dir:
90
+ archive_path = Path(tmp_dir) / archive
91
+ download(
92
+ f"https://github.com/interlynk-io/sbomasm/releases/download/v{version}/{archive}",
93
+ archive_path,
94
+ )
95
+ extract(archive_path, sbomasm_install_dir, f"sbomasm{cfg.platform.exe}")
96
+
97
+
98
+ def _assemble_sbom(cfg: ConfigTree) -> None:
99
+ """Merge SBOMs in the working directory into ``cfg.sbomasm.output_file``.
100
+
101
+ The primary SBOM is resolved from the ``cfg.sbomasm.primary_sbom`` glob and
102
+ extended with every other ``*.cdx.json`` file found next to it. A glob that
103
+ matches nothing is a hard error; if it matches several files the first
104
+ (sorted) one is used as the primary and the rest are merged in as regular
105
+ inputs. With no other SBOMs the primary is copied through unchanged.
106
+ """
107
+ output = Path(cfg.sbomasm.output_file)
108
+
109
+ primary_matches = sorted(p.name for p in Path().glob(cfg.sbomasm.primary_sbom))
110
+ if not primary_matches:
111
+ die(f"No primary SBOM matching {cfg.sbomasm.primary_sbom!r} found.")
112
+ return
113
+ primary = primary_matches[0]
114
+ if len(primary_matches) > 1:
115
+ info(
116
+ f"Multiple primary SBOMs matched {cfg.sbomasm.primary_sbom!r}: "
117
+ f"{primary_matches}; using {primary}."
118
+ )
119
+
120
+ others = sorted(
121
+ p.name
122
+ for p in Path().glob("*.cdx.json")
123
+ if p.name not in {output.name, primary}
124
+ )
125
+ info(f"Found {len(others)} SBOM(s) to merge into {primary}: {others}")
126
+
127
+ if not others:
128
+ output.write_text(Path(primary).read_text(encoding="utf-8"), encoding="utf-8")
129
+ info(f"Single SBOM {primary} copied to {output}")
130
+ return
131
+
132
+ args = [
133
+ "sbomasm",
134
+ "assemble",
135
+ "--flatMerge",
136
+ "--primary",
137
+ primary,
138
+ ]
139
+ if cfg.sbomasm.format.spec.lower() == "spdx":
140
+ args.append("--outputSpecSpdx")
141
+ args += ["--outputSpecVersion", cfg.sbomasm.format.version]
142
+ args.extend(others)
143
+
144
+ sbom_text = backtick(*args)
145
+ output.write_text(sbom_text, encoding="utf-8")
146
+ info(f"Merged {len(others)} SBOM(s) into {primary} -> {output}")
@@ -0,0 +1,34 @@
1
+ # -*- mode: yaml; coding: utf-8 -*-
2
+ #
3
+ # Schema for the sbomasm plugin for spin
4
+
5
+ sbomasm:
6
+ type: object
7
+ help: |
8
+ The sbomasm plugin wraps around the sbomasm tool for assembling SBOMs.
9
+ properties:
10
+ version:
11
+ type: str
12
+ help: Version of sbomasm to use
13
+ install_dir:
14
+ type: path
15
+ help: The installation directory to install sbomasm versions into
16
+ output_file:
17
+ type: path
18
+ help: The file path to write the generated SBOM to
19
+ primary_sbom:
20
+ type: str
21
+ help: |
22
+ Glob for the primary SBOM to extend with all other SBOMs. Must match at
23
+ least one file; if it matches several, the first (sorted) one is used.
24
+ format:
25
+ type: object
26
+ help: Configuration regarding the output format of the generated SBOM
27
+ properties:
28
+ spec:
29
+ type: str
30
+ help: |
31
+ The output format specification to use (cyclonedx or spdx)
32
+ version:
33
+ type: str
34
+ help: The version of the output format to use
@@ -0,0 +1,115 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2026 CONTACT Software GmbH
4
+ # https://www.contact-software.com/
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+
18
+ """Module implementing the SBOM quality gate plugin for spin."""
19
+
20
+ from __future__ import annotations
21
+
22
+ import os
23
+ import sys
24
+ from importlib import resources
25
+ from tempfile import TemporaryDirectory
26
+
27
+ from csspin import (
28
+ Verbosity,
29
+ config,
30
+ die,
31
+ download,
32
+ exists,
33
+ extract,
34
+ group,
35
+ info,
36
+ setenv,
37
+ sh,
38
+ )
39
+ from csspin.tree import ConfigTree
40
+ from path import Path
41
+
42
+
43
+ def default_policy_file(cfg: ConfigTree) -> Path: # pylint: disable=unused-argument
44
+ """Return the path to the bundled default policy file."""
45
+ return Path(resources.files("csspin_tooling") / "policies/default.yaml")
46
+
47
+
48
+ defaults = config(
49
+ version="2.0.9",
50
+ install_dir="{spin.data}/csspin_tooling/sbomqs",
51
+ input_file="{spin.project_name}.cdx.json",
52
+ policy_file=default_policy_file,
53
+ )
54
+
55
+
56
+ def configure(cfg: ConfigTree) -> None:
57
+ """Resolve callable defaults in the sbomqs subtree to concrete values."""
58
+ for key, value in cfg.sbomqs.items():
59
+ if callable(value):
60
+ cfg.sbomqs[key] = value(cfg)
61
+
62
+
63
+ def provision(cfg: ConfigTree) -> None:
64
+ """Download the managed sbomqs binary."""
65
+ _provision_sbomqs(cfg)
66
+
67
+
68
+ def init(cfg: ConfigTree) -> None:
69
+ """Make the managed sbomqs binary discoverable on ``PATH``."""
70
+ sbomqs_dir = cfg.sbomqs.install_dir / cfg.sbomqs.version
71
+ setenv(PATH=os.pathsep.join((sbomqs_dir, "{PATH}")))
72
+
73
+
74
+ @group()
75
+ def sbomqs(cfg: ConfigTree) -> None: # pylint: disable=unused-argument
76
+ """sbomqs-based SBOM quality gating."""
77
+
78
+
79
+ @sbomqs.task(when="sbom:quality")
80
+ def policy(cfg: ConfigTree) -> None:
81
+ """Gate the SBOM against the policy and exit non-zero on violations."""
82
+ sbom = cfg.sbomqs.input_file
83
+ if not exists(sbom):
84
+ die(f"Cannot gate {sbom}: file does not exist.")
85
+
86
+ policy_file = cfg.sbomqs.policy_file
87
+ info(f"Check {sbom} against policy {policy_file}")
88
+ extra = ["-o", "table"] if cfg.verbosity > Verbosity.NORMAL else []
89
+ sh("sbomqs", "policy", "-f", str(policy_file), *extra, str(sbom))
90
+
91
+
92
+ # -- Internals -----------------------------------------------------------------
93
+ def _provision_sbomqs(cfg: ConfigTree) -> None:
94
+ """Downloads sbomqs"""
95
+ version = cfg.sbomqs.version
96
+ sbomqs_install_dir = cfg.sbomqs.install_dir / version
97
+
98
+ if exists(sbomqs_install_dir / f"sbomqs{cfg.platform.exe}"):
99
+ info(f"Using cached sbomqs ({sbomqs_install_dir})")
100
+ return
101
+
102
+ info("Installing sbomqs")
103
+ archive = (
104
+ f"sbomqs_{version}_Windows_x86_64.tar.gz"
105
+ if sys.platform == "win32"
106
+ else f"sbomqs_{version}_Linux_x86_64.tar.gz"
107
+ )
108
+
109
+ with TemporaryDirectory() as tmp_dir:
110
+ archive_path = Path(tmp_dir) / archive
111
+ download(
112
+ f"https://github.com/interlynk-io/sbomqs/releases/download/v{version}/{archive}",
113
+ archive_path,
114
+ )
115
+ extract(archive_path, sbomqs_install_dir, f"sbomqs{cfg.platform.exe}")
@@ -0,0 +1,24 @@
1
+ # -*- mode: yaml; coding: utf-8 -*-
2
+ #
3
+ # Schema for the sbomqs plugin for csspin
4
+
5
+ sbomqs:
6
+ type: object
7
+ help: |
8
+ The sbomqs plugin wraps around the sbomqs tool to gate SBOMs against a
9
+ quality policy.
10
+ properties:
11
+ version:
12
+ type: str
13
+ help: Version of sbomqs to use
14
+ install_dir:
15
+ type: path
16
+ help: The installation directory to install sbomqs versions into
17
+ input_file:
18
+ type: path
19
+ help: The SBOM file to gate against the policy
20
+ policy_file:
21
+ type: path
22
+ help: |
23
+ Path to a policy file to gate against. Defaults to the bundled default
24
+ policy; set this to override it.
@@ -0,0 +1,85 @@
1
+ Metadata-Version: 2.4
2
+ Name: csspin-tooling
3
+ Version: 1.0.0
4
+ Summary: Plugin-package for csspin providing common tooling for csspin-based projects
5
+ Author-email: CONTACT Software GmbH <info@contact-software.com>
6
+ Maintainer-email: Benjamin Thomas Schwertfeger <benjaminthomas.schwertfeger@contact-software.com>, Fabian Hafer <fabian.hafer@contact-software.com>, Waleri Enns <waleri.enns@contact-software.com>, Lena Herkommer <lena.herkommer@contact-software.com>
7
+ License-Expression: Apache-2.0
8
+ Project-URL: CONTACT Software GmbH, https://contact-software.com
9
+ Project-URL: Documentation, https://csspin-tooling.readthedocs.io/en/stable/
10
+ Project-URL: Issue Tracker, https://github.com/cslab/csspin-tooling/issues
11
+ Project-URL: Release Notes, https://csspin-tooling.readthedocs.io/en/stable/relnotes.html
12
+ Project-URL: Repository, https://github.com/cslab/csspin-tooling
13
+ Classifier: Environment :: Console
14
+ Classifier: Development Status :: 5 - Production/Stable
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Programming Language :: Python :: 3.14
23
+ Classifier: Topic :: Software Development
24
+ Requires-Python: >=3.10
25
+ Description-Content-Type: text/x-rst
26
+ License-File: LICENSE
27
+ Requires-Dist: csspin-python
28
+ Requires-Dist: requests
29
+ Dynamic: license-file
30
+
31
+ ``csspin-tooling`` is maintained by `CONTACT Software GmbH`_ and provides
32
+ utility plugins and tasks to be used with the `csspin`_ task runner.
33
+
34
+ The following plugins are available:
35
+
36
+ - ``csspin_tooling.sbomasm``: Assembles multiple CycloneDX SBOM files into a
37
+ single enriched top-level SBOM using the `sbomasm`_ tool.
38
+ - ``csspin_tooling.fetch_vex``: Downloads a CycloneDX VEX file for a given
39
+ package version from Dependency-Track.
40
+
41
+ Prerequisites
42
+ -------------
43
+
44
+ `csspin`_ must be installed before using this package:
45
+
46
+ .. code-block:: console
47
+
48
+ python -m pip install csspin
49
+
50
+ Using csspin-tooling
51
+ --------------------
52
+
53
+ Add the package and the desired plugins to your project's ``spinfile.yaml``:
54
+
55
+ .. code-block:: yaml
56
+
57
+ spin:
58
+ project_name: my_project
59
+
60
+ plugin_packages:
61
+ - csspin-python
62
+ - csspin-tooling
63
+
64
+ plugins:
65
+ - csspin_tooling.sbomasm
66
+ - csspin_tooling.fetch_vex
67
+
68
+ python:
69
+ version: "3.11.9"
70
+
71
+ Provision the project to download sbomasm and install all dependencies:
72
+
73
+ .. code-block:: console
74
+
75
+ spin provision
76
+
77
+ Assemble a top-level SBOM from all ``*.cdx.json`` files in the project root:
78
+
79
+ .. code-block:: console
80
+
81
+ spin sbom --help
82
+
83
+ .. _`CONTACT Software GmbH`: https://contact-software.com
84
+ .. _`csspin`: https://pypi.org/project/csspin
85
+ .. _`sbomasm`: https://github.com/interlynk-io/sbomasm
@@ -0,0 +1,13 @@
1
+ csspin_tooling/__init__.py,sha256=_aend_LjiCh_wXpo6X9YU9_BFxqx9I8JpSJA2GLrq6k,696
2
+ csspin_tooling/fetch_vex.py,sha256=JzAQBAkrN6-OAiUr9xaoMelRib8jHEAdS6FWOZKvm8E,5249
3
+ csspin_tooling/fetch_vex_schema.yaml,sha256=KBaeWwewaeMDnebf31ygUcir6q1nbX1oJcU-ss6c3Nc,706
4
+ csspin_tooling/sbomasm.py,sha256=6cZb7YbZjg57YDbU200qzXi9dqajrs-LNSpdNqrcsVE,4657
5
+ csspin_tooling/sbomasm_schema.yaml,sha256=4uNPthaZuFJHI5vNnB53LGmObGc_fgjF8dgct2JwGuI,1015
6
+ csspin_tooling/sbomqs.py,sha256=Y7kB90Up3uZN20n62J-wVVfazsVs3OubUEIp-ovQAaQ,3547
7
+ csspin_tooling/sbomqs_schema.yaml,sha256=_cg7gjk5IQEXTGS-n0aydMUkSxRr8YLI8-rEJmSDaO0,648
8
+ csspin_tooling/policies/default.yaml,sha256=6-YNnJLxEh3y2ZQ4GXHAnuAx7NTTIys0m7ybG72_Akg,1655
9
+ csspin_tooling-1.0.0.dist-info/licenses/LICENSE,sha256=4MAecetnRTQw5DlHtiikDSzKWO1xVLwzM5_DsPMYlnE,10172
10
+ csspin_tooling-1.0.0.dist-info/METADATA,sha256=OgigQexRnOXx898Y8y2Bm3SMCg2dgdAo4AlGGNzrg-c,2893
11
+ csspin_tooling-1.0.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
12
+ csspin_tooling-1.0.0.dist-info/top_level.txt,sha256=84uiKmEci5TW1HewSfGKdOvTX5-BP6ElnP3W9p7VIbE,15
13
+ csspin_tooling-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1 @@
1
+ csspin_tooling