fuzzy1337.sbom_graph¶
This Experimental library adds an explicit opt-in SPDX 2.3 local package graph
profile. The supported surface is SPDX_GRAPH_IMPORT_VERSION and
ApplyVerifiedSpdxGraph; all remaining helpers are Internal. The existing flat
SPDX inventory profile and canonical image/package identities remain unchanged.
Admission revalidates exact typed inputs and verifies the original immutable offline evidence manifest and bytes. One described CONTAINER root requires a checksum matching the caller's explicit config/manifest image identity. Nested containment must form a rooted acyclic graph covering every package, including after canonical PURL aliases collapse. Only direct source containment edges are emitted. Local dependency claims and their inverses use attributed RELATED_TO relations; cycles imply no runtime reachability or transitive relation.
Original relationship coordinates retain manifest, content, image and local-to- canonical endpoint bindings. Declared/concluded licenses and missing/NONE/ NOASSERTION states remain distinct inert facts without compliance evaluation. The returned model/delta requires explicit model-store CAS saving. Actual save/reopen/relocate/replay preserves original evidence and existing finding triage. No scanner receipt or execution/retrieval authorization is created. File/external-document graphs, scoped LicenseRef definitions, vulnerability/VEX graphs, signatures and broader layer/runtime coverage remain outside this profile. See Verified local SPDX graph claims.
fuzzy1337.sbom_graph
¶
Experimental original-evidence-backed local SPDX containment and dependency claims.
SourceEdge
dataclass
¶
Retain an original relationship coordinate beside its normalized direction.
Source code in fuzzy1337/sbom_graph.py
52 53 54 55 56 57 58 59 60 61 62 | |
SourceCatalog
dataclass
¶
Hold an internal validated local catalog without accepting detached graphs as evidence.
Source code in fuzzy1337/sbom_graph.py
65 66 67 68 69 70 71 | |
CheckContainment(root: str, nodes: set[str], edges: set[tuple[str, str]]) -> None
¶
Require a bounded rooted DAG covering every catalog node without recursive traversal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
str
|
Explicitly described image, not a guessed dependency root. |
required |
nodes
|
set[str]
|
Local source IDs or canonical references after package alias correlation. |
required |
edges
|
set[tuple[str, str]]
|
Explicit containment claims only; dependencies never establish membership. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
A containment cycle, incoming root edge or disconnected node exists. |
Source code in fuzzy1337/sbom_graph.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |
GraphCatalog(payload: dict[str, object], image_identity: ImageIdentity) -> SourceCatalog
¶
Validate the explicit local graph profile as a pure transformation of original JSON.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
dict[str, object]
|
Strictly decoded SPDX 2.3 document whose envelope was already validated. |
required |
image_identity
|
ImageIdentity
|
Caller-declared config/manifest semantics, never inferred from checksums. |
required |
Returns:
| Type | Description |
|---|---|
SourceCatalog
|
One checksum-bound root, local package rows and exact original relationship coordinates. |
Raises:
| Type | Description |
|---|---|
ValueError
|
Package, root, relationship, checksum or containment claims are unsupported. |
Source code in fuzzy1337/sbom_graph.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | |
RevalidateInputs(state: ModelState, record: EvidenceRecord, provenance: ModelProvenance, image_identity: ImageIdentity) -> None
¶
Reconstruct exact typed inputs before reading evidence or trusting frozen instance fields.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
ModelState
|
Original canonical basis snapshot, including its existing triage history. |
required |
record
|
EvidenceRecord
|
Original manifest identity with exact typed reference and acquisition provenance. |
required |
provenance
|
ModelProvenance
|
Offline attribution bound to the original source by VerifyRecords. |
required |
image_identity
|
ImageIdentity
|
Explicit validated hash-kind identity. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
Subclasses, untyped inputs, mutated frozen fields or offline execution appear. |
Source code in fuzzy1337/sbom_graph.py
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | |
GraphCandidates(raw: bytes, workspace_id: str, record: EvidenceRecord, provenance: ModelProvenance, image_identity: ImageIdentity) -> tuple[list[SecurityObject], list[Relation], list[Observation]]
¶
Produce source-bound graph interpretations without filesystem, process or network I/O.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
raw
|
bytes
|
Original bytes already verified against the exact immutable source manifest. |
required |
workspace_id
|
str
|
Existing model workspace identity. |
required |
record
|
EvidenceRecord
|
Verified original manifest, never a fabricated producer receipt. |
required |
provenance
|
ModelProvenance
|
Revalidated matching source acquisition attribution. |
required |
image_identity
|
ImageIdentity
|
Explicit root checksum and hash-kind semantics. |
required |
Returns:
| Type | Description |
|---|---|
tuple[list[SecurityObject], list[Relation], list[Observation]]
|
Fully validated canonical objects, exact source relations and inert licensing facts. |
Raises:
| Type | Description |
|---|---|
ValueError
|
Source profile, licensing, package linkage or canonical containment fails. |
Source code in fuzzy1337/sbom_graph.py
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 | |
ApplyVerifiedSpdxGraph(state: ModelState, record: EvidenceRecord, provenance: ModelProvenance, image_identity: ImageIdentity, workspace_root: Path) -> tuple[ModelState, ModelDelta]
¶
Opt in to bounded local SPDX graph claims through original evidence and canonical model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
ModelState
|
Original validated same-workspace basis snapshot; existing triage is retained. |
required |
record
|
EvidenceRecord
|
Explicit immutable independently acquired offline sbom EvidenceRecord. |
required |
provenance
|
ModelProvenance
|
Matching acquisition attribution with no invocation or execution fabrication. |
required |
image_identity
|
ImageIdentity
|
Caller-declared config or manifest identity bound to one root checksum. |
required |
workspace_root
|
Path
|
Owned existing or relocated workspace retaining the original source. |
required |
Returns:
| Type | Description |
|---|---|
ModelState
|
One atomic in-memory transition. The caller owns LocalModelStore.Save and its CAS check. |
ModelDelta
|
Dependency relations describe source claims; they assert no runtime reachability. |
Raises:
| Type | Description |
|---|---|
ValueError
|
Typed inputs, manifest bindings, package/graph/license profile or basis fail. |
EvidenceError
|
Original immutable manifest or raw source bytes fail verification. |
OSError
|
Owning workspace metadata or evidence cannot be read. |
Source code in fuzzy1337/sbom_graph.py
376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | |