python-sbom 0.1.1__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.
Files changed (69) hide show
  1. python_sbom/__init__.py +46 -0
  2. python_sbom/__main__.py +10 -0
  3. python_sbom/_cli/__init__.py +1 -0
  4. python_sbom/_cli/_archive.py +38 -0
  5. python_sbom/_cli/_embed.py +28 -0
  6. python_sbom/_cli/_main.py +28 -0
  7. python_sbom/_cli/_parser.py +144 -0
  8. python_sbom/_cli/_spdx.py +61 -0
  9. python_sbom/_cli/_validate.py +40 -0
  10. python_sbom/_collect/__init__.py +1 -0
  11. python_sbom/_collect/_archive.py +94 -0
  12. python_sbom/_collect/_content.py +109 -0
  13. python_sbom/_collect/_facts.py +155 -0
  14. python_sbom/_collect/_revision.py +93 -0
  15. python_sbom/_collect/_settings.py +82 -0
  16. python_sbom/_collect/_source.py +54 -0
  17. python_sbom/_collect/_wheel.py +55 -0
  18. python_sbom/_errors.py +15 -0
  19. python_sbom/_formats/__init__.py +1 -0
  20. python_sbom/_formats/_json.py +18 -0
  21. python_sbom/_formats/_spdx.py +263 -0
  22. python_sbom/_generate/__init__.py +1 -0
  23. python_sbom/_generate/_archive.py +84 -0
  24. python_sbom/_generate/_embed.py +74 -0
  25. python_sbom/_model/__init__.py +1 -0
  26. python_sbom/_model/_archive.py +117 -0
  27. python_sbom/_model/_bom.py +137 -0
  28. python_sbom/_model/_components.py +182 -0
  29. python_sbom/_model/_content.py +128 -0
  30. python_sbom/_model/_document.py +100 -0
  31. python_sbom/_model/_graph.py +64 -0
  32. python_sbom/_model/_identity.py +53 -0
  33. python_sbom/_model/_inputs.py +141 -0
  34. python_sbom/_model/_iri.py +96 -0
  35. python_sbom/_model/_licenses.py +58 -0
  36. python_sbom/_model/_markers.py +61 -0
  37. python_sbom/_model/_metadata.py +100 -0
  38. python_sbom/_model/_names.py +90 -0
  39. python_sbom/_model/_tools.py +48 -0
  40. python_sbom/_model/_types.py +281 -0
  41. python_sbom/_model/_wheel.py +89 -0
  42. python_sbom/_validate/__init__.py +1 -0
  43. python_sbom/_validate/_artifact.py +55 -0
  44. python_sbom/_validate/_document.py +221 -0
  45. python_sbom/_validate/_licenses.py +104 -0
  46. python_sbom/_validate/_limits.py +27 -0
  47. python_sbom/_validate/_schemas.py +124 -0
  48. python_sbom/_validate/schemas/LICENSE +201 -0
  49. python_sbom/_validate/schemas/bom-1.6.schema.json +5699 -0
  50. python_sbom/_validate/schemas/jsf-0.82.schema.json +240 -0
  51. python_sbom/_validate/schemas/spdx.schema.json +1662 -0
  52. python_sbom/_wheel/__init__.py +1 -0
  53. python_sbom/_wheel/_bundled.py +142 -0
  54. python_sbom/_wheel/_reader.py +59 -0
  55. python_sbom/_wheel/_record.py +55 -0
  56. python_sbom/_wheel/_write.py +103 -0
  57. python_sbom/_wheel/_zip.py +94 -0
  58. python_sbom/hatch/__init__.py +9 -0
  59. python_sbom/hatch/_hook.py +150 -0
  60. python_sbom/hatch/hooks.py +18 -0
  61. python_sbom/py.typed +0 -0
  62. python_sbom/version.py +24 -0
  63. python_sbom-0.1.1.dist-info/METADATA +95 -0
  64. python_sbom-0.1.1.dist-info/RECORD +69 -0
  65. python_sbom-0.1.1.dist-info/WHEEL +4 -0
  66. python_sbom-0.1.1.dist-info/entry_points.txt +5 -0
  67. python_sbom-0.1.1.dist-info/licenses/LICENSE +18 -0
  68. python_sbom-0.1.1.dist-info/licenses/src/python_sbom/_validate/schemas/LICENSE +201 -0
  69. python_sbom-0.1.1.dist-info/sboms/python-sbom.cdx.json +13548 -0
@@ -0,0 +1,104 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING, Final
4
+
5
+ from license_expression import (
6
+ AND,
7
+ ExpressionError,
8
+ LicenseSymbol,
9
+ LicenseWithExceptionSymbol,
10
+ Licensing,
11
+ get_license_index,
12
+ )
13
+
14
+ from python_sbom._model._graph import shipped_libraries
15
+
16
+ if TYPE_CHECKING:
17
+ from license_expression import LicenseExpression
18
+
19
+ from python_sbom._model._types import Component, License
20
+
21
+ # the SPDX ids alone, without the aliases get_spdx_licensing() adds: those rename ids (LicenseRef-Apache becomes
22
+ # Apache-2.0, Net-SNMP becomes LicenseRef-scancode-net-snmp), so a policy would judge an id other than the one declared;
23
+ # knowing the ids still lets the parser tell "MIT ISC" apart from a single license
24
+ _LICENSING: Final[Licensing] = Licensing(
25
+ LicenseSymbol(entry["spdx_license_key"], is_exception=entry["is_exception"])
26
+ for entry in get_license_index()
27
+ if entry.get("spdx_license_key")
28
+ )
29
+
30
+
31
+ def license_problems(contents: list[Component], allowed: frozenset[str]) -> list[str]:
32
+ # SPDX matches license ids without regard to case
33
+ folded: Final[frozenset[str]] = frozenset(identifier.casefold() for identifier in allowed)
34
+ return [
35
+ f"{component.get('bom-ref', component['name'])}: {problem}"
36
+ for component in shipped_libraries(contents)
37
+ if (problem := _judge(component, allowed, folded))
38
+ ]
39
+
40
+
41
+ def _judge(component: Component, allowed: frozenset[str], folded: frozenset[str]) -> str | None:
42
+ licenses: Final[list[License]] = component.get("licenses", [])
43
+ terms: Final[list[str]] = [
44
+ entry["expression"] if "expression" in entry else entry["license"]["id"]
45
+ for entry in licenses
46
+ if "expression" in entry or "id" in entry["license"]
47
+ ]
48
+ if not terms:
49
+ if names := [entry["license"]["name"] for entry in licenses if "license" in entry]:
50
+ return f"declares license names {names} with no SPDX id"
51
+ return "declares no license"
52
+ denied: Final[list[str]] = []
53
+ for term in terms:
54
+ try:
55
+ tree = _parse(term)
56
+ except ValueError as error:
57
+ return f"license expression {term!r} is malformed: {error}"
58
+ if not _allowed(tree, folded):
59
+ denied.append(term)
60
+ if denied:
61
+ return f"license {' AND '.join(denied)} is outside the allowed licenses {sorted(allowed)}"
62
+ return None
63
+
64
+
65
+ def _parse(term: str) -> LicenseExpression:
66
+ try:
67
+ tree: Final[LicenseExpression | None] = _LICENSING.parse(term)
68
+ except ExpressionError as error:
69
+ raise ValueError(str(error)) from error
70
+ except (AssertionError, IndexError) as error:
71
+ # boolean.py trips over some malformed input, such as "( OR MIT" or "()", before it reports it
72
+ msg = "it does not parse"
73
+ raise ValueError(msg) from error
74
+ if tree is None:
75
+ msg = "it is empty"
76
+ raise ValueError(msg)
77
+ return tree
78
+
79
+
80
+ def _allowed(tree: LicenseExpression, folded: frozenset[str]) -> bool:
81
+ # the parse tree nests as deep as the expression does, so it is walked with a stack instead of recursion; children
82
+ # come after their parent in this order, so the reversed walk judges them first
83
+ order: Final[list[LicenseExpression]] = []
84
+ pending: Final[list[LicenseExpression]] = [tree]
85
+ while pending:
86
+ order.append(node := pending.pop())
87
+ pending.extend(node.args)
88
+ verdicts: Final[dict[int, bool]] = {}
89
+ for node in reversed(order):
90
+ if isinstance(node, LicenseWithExceptionSymbol):
91
+ # an exception grants extra permissions on top of the license it modifies, so that license alone decides
92
+ verdicts[id(node)] = node.license_symbol.key.casefold() in folded
93
+ elif isinstance(node, LicenseSymbol):
94
+ verdicts[id(node)] = node.key.casefold() in folded
95
+ else:
96
+ # the parser builds only AND and OR around the symbols
97
+ branches = (verdicts[id(arg)] for arg in node.args)
98
+ verdicts[id(node)] = all(branches) if isinstance(node, AND) else any(branches)
99
+ return verdicts[id(tree)]
100
+
101
+
102
+ __all__ = [
103
+ "license_problems",
104
+ ]
@@ -0,0 +1,27 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Final, TypeAlias
4
+
5
+ # a JSON value, as json.loads hands it over
6
+ Json: TypeAlias = "str | int | float | bool | list[Json] | dict[str, Json] | None"
7
+
8
+ # every check takes time in proportion to the count, so the cap bounds the work an untrusted document can ask for, far
9
+ # above the few thousand components a wheel with its build tools' files lists
10
+ MAX_COMPONENTS: Final[int] = 100_000
11
+ # an exception's message, or a schema error's, can quote the hostile value that caused it, which runs to megabytes
12
+ MAX_TEXT: Final[int] = 200
13
+
14
+
15
+ def byte_limit(max_components: int) -> int:
16
+ # python-sbom writes about 540 bytes per component, since every file of the wheel and of its build tools is one; a
17
+ # KiB each leaves room for documents with fuller components, plus a MiB for the metadata, dependencies and
18
+ # formulation beside them, while tying what the JSON parser may be asked to hold to the component cap
19
+ return 1024 * 1024 + max_components * 1024
20
+
21
+
22
+ __all__ = [
23
+ "MAX_COMPONENTS",
24
+ "MAX_TEXT",
25
+ "Json",
26
+ "byte_limit",
27
+ ]
@@ -0,0 +1,124 @@
1
+ from __future__ import annotations
2
+
3
+ import json
4
+ from collections import Counter
5
+ from importlib.resources import files
6
+ from typing import TYPE_CHECKING, Final
7
+
8
+ from jsonschema_rs import Draft7Validator, Registry
9
+ from license_expression import ExpressionError, ExpressionParseError, LicenseExpression
10
+ from spdx_tools.common.spdx_licensing import spdx_licensing
11
+ from spdx_tools.spdx.parser.error import SPDXParsingError
12
+ from spdx_tools.spdx.parser.jsonlikedict.json_like_dict_parser import JsonLikeDictParser
13
+ from spdx_tools.spdx.validation.creation_info_validator import validate_creation_info
14
+ from spdx_tools.spdx.validation.extracted_licensing_info_validator import validate_extracted_licensing_infos
15
+ from spdx_tools.spdx.validation.package_validator import validate_package
16
+ from spdx_tools.spdx.validation.spdx_id_validators import validate_spdx_id
17
+
18
+ from ._limits import MAX_TEXT
19
+
20
+ if TYPE_CHECKING:
21
+ from importlib.resources.abc import Traversable
22
+
23
+ from jsonschema_rs import ValidationError
24
+ from spdx_tools.spdx.model import Document, SpdxNoAssertion, SpdxNone
25
+
26
+ from python_sbom._formats._spdx import Spdx
27
+
28
+ from ._limits import Json
29
+
30
+
31
+ def schema_error(document: Json) -> str | None:
32
+ detail: Final[ValidationError | None] = next(_VALIDATOR.iter_errors(document), None)
33
+ if detail is None:
34
+ return None
35
+ steps: Final[str] = "".join(
36
+ f"[{step}]" if isinstance(step, int) else f".{step}" if step.isidentifier() else f"[{step!r}]"
37
+ for step in detail.instance_path
38
+ )
39
+ return f"{detail.message[:MAX_TEXT]} at {f'${steps}'[:MAX_TEXT]}"
40
+
41
+
42
+ def spdx_problems(spdx: Spdx) -> list[str]:
43
+ try:
44
+ parsed: Final[Document] = JsonLikeDictParser().parse(dict(spdx))
45
+ except SPDXParsingError as error:
46
+ return [f"SPDX rendering does not parse: {message}" for message in error.get_messages()]
47
+ return [f"SPDX rendering invalid: {message}" for message in _invalid(parsed)]
48
+
49
+
50
+ def _invalid(document: Document) -> list[str]:
51
+ # spdx-tools' validate_full_spdx_document looks every relationship end, and every package's own relationships, up
52
+ # in lists, so its time grows with the square of the elements: 16,000 took a minute and a half. This runs its
53
+ # validators of each element and does the lookups across elements in sets. The rendering writes no files, snippets
54
+ # or annotations, and always the DESCRIBES relationship, so their checks are left out
55
+ version: Final[str] = document.creation_info.spdx_version
56
+ messages: Final[list[str]] = [
57
+ message.validation_message for message in validate_creation_info(document.creation_info, version)
58
+ ]
59
+ license_refs: Final[frozenset[str | None]] = frozenset(
60
+ info.license_id for info in document.extracted_licensing_info
61
+ )
62
+ for package in document.packages:
63
+ messages.extend(validate_spdx_id(package.spdx_id, document))
64
+ messages.extend(_license_problems(package.license_concluded, license_refs))
65
+ messages.extend(_license_problems(package.license_declared, license_refs))
66
+ messages.extend(message.validation_message for message in validate_package(package, version))
67
+ ids: Final[Counter[str]] = Counter(package.spdx_id for package in document.packages)
68
+ ids[document.creation_info.spdx_id] += 1
69
+ for relationship in document.relationships:
70
+ ends = (relationship.spdx_element_id, relationship.related_spdx_element_id)
71
+ messages.extend(
72
+ f'did not find the referenced spdx_id "{end}" in the SPDX document' for end in ends if end not in ids
73
+ )
74
+ messages.extend(
75
+ message.validation_message for message in validate_extracted_licensing_infos(document.extracted_licensing_info)
76
+ )
77
+ if duplicates := sorted(spdx_id for spdx_id, count in ids.items() if count > 1):
78
+ messages.append(
79
+ f"every spdx_id must be unique within the document, but found the following duplicates: {duplicates}"
80
+ )
81
+ return messages
82
+
83
+
84
+ def _license_problems(
85
+ expression: LicenseExpression | SpdxNoAssertion | SpdxNone | None, license_refs: frozenset[str | None]
86
+ ) -> list[str]:
87
+ # spdx-tools' validate_license_expression, with the LicenseRef ids it lists for every call gathered once
88
+ if not isinstance(expression, LicenseExpression):
89
+ return []
90
+ problems: Final[list[str]] = [
91
+ f"Unrecognized license reference: {symbol}. license_expression must only use IDs from the license list or"
92
+ f" extracted licensing info, but is: {expression}"
93
+ for symbol in spdx_licensing.validate(expression).invalid_symbols
94
+ if symbol not in license_refs
95
+ ]
96
+ try:
97
+ spdx_licensing.parse(str(expression), validate=True, strict=True)
98
+ except ExpressionParseError as error:
99
+ # an exception used as a license or the other way around; unknown symbols raise ExpressionError, listed above
100
+ problems.append(f"{error}. for license_expression: {expression}")
101
+ except ExpressionError:
102
+ pass
103
+ return problems
104
+
105
+
106
+ # the official CycloneDX schema files, unchanged: bom-1.6 and the jsf-0.82 it references from the specification's 1.6.2
107
+ # release, and the spdx license list from its 1.7.2 release, the newest, as the cyclonedx.org URL every schema version
108
+ # references serves the newest; Apache-2.0, see the LICENSE beside them. Format assertion is on, as in CycloneDX's own
109
+ # Draft 7 validation, and offline, so a reference missing from the registry fails instead of reaching the network
110
+ _SCHEMAS: Final[Traversable] = files(__package__) / "schemas"
111
+ _REFERENCED: Final[list[dict[str, Json]]] = [
112
+ json.loads((_SCHEMAS / name).read_text(encoding="utf-8")) for name in ("spdx.schema.json", "jsf-0.82.schema.json")
113
+ ]
114
+ _VALIDATOR: Final[Draft7Validator] = Draft7Validator(
115
+ json.loads((_SCHEMAS / "bom-1.6.schema.json").read_text(encoding="utf-8")),
116
+ validate_formats=True,
117
+ offline=True,
118
+ registry=Registry([(str(schema["$id"]), schema) for schema in _REFERENCED]),
119
+ )
120
+
121
+ __all__ = [
122
+ "schema_error",
123
+ "spdx_problems",
124
+ ]
@@ -0,0 +1,201 @@
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
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "{}"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright OWASP Foundation
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.