fix(sbom): stop marking every package of an image directly attackable - #330
Closed
reyreavman wants to merge 3 commits into
Closed
reyreavman wants to merge 3 commits into
reyreavman wants to merge 3 commits into
Conversation
An image declared with attackSurface: yes now carries that value on the image component only; the packages it contains are reachable through the image and get indirect. Other values, and securityFunction in all cases, keep applying unchanged to the whole tree. Signed-off-by: Radmir Khurum <radmir.khurum@flant.com>
… SBOM The container wrapping an image dissolved the image root component into itself, so the ISPRAS rule binding a container to the maximum over its content had nothing carrying the image's own attack surface. Keep the root as the first component of its container and let the container derive its values from it. Signed-off-by: Radmir Khurum <radmir.khurum@flant.com>
Signed-off-by: Radmir Khurum <radmir.khurum@flant.com>
Collaborator
Author
|
Модель не та. DoD карточки 69801379 требует графовую модель: корни — узлы дерева зависимостей, а здесь корнем считался |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
sbom.gost.attackSurface: yesno longer stampsyeson every package of the image. The value states that the image exposes an interface to an attacker; the packages inside it are reachable only through the image and now carryindirect. To keep that expressible in the ISPRAScontainerformat, the image's own root component stays listed inside its container instead of being dissolved into it.Implements the target picture of card 69801379 («
yes→ корневой компонентyes, потомкиindirect»), which until now could not be produced: the checker rejected it.What
gost.Config.ForDescendantsderives what everything below the image root carries:yes→indirect, every other attack surface value andsecurityFunctionunchanged.gost.Upsertapplies the configured values tometadata.componentand the derived ones to the component tree.ContainerAssemblerkeeps the image root component as the first component of its container, instead of copying it over the container and rewriting every reference to it. The container takes the root's version (the ISPRAS schema requires one) and derives its GOST values as the maximum over its content, which the root now supplies.NewImageSBOMcountsmetadata.componentin the image's aggregate, so the container derives from the image value rather than from packages alone.Why
ISPRAS binds a container's GOST values to the maximum over all its descendants, transitively, for both fields — verified on 28 fixtures. «Container
yesoverindirectpackages» is the one arrangement it rejects (ERROR: контейнер "app" не содержит компонентов со значением его поверхности атаки (yes)), and that is exactly what the card asks for when the image root and the container are the same object. Keeping them distinct satisfies the rule by construction: the root carriesyes, the container equals the maximum, the packages stayindirect.Without the split every package of every image is attested as directly reachable by an attacker and as implementing a security function — an overstatement in a document bound for a regulator.
VERIFIED
Real two-image stapel build (
base-layerat the defaults,appwithattackSurface: yes, securityFunction: no) pushed to a local registry,werf sbom mergein both formats, output run through3p-ispras-sbom-checker:master:--format container→файл корректный;--format oss→файл корректный.task format,task build,task lint(0 issues),task test:unit(full) — green.Review focus
BOMRef/Name= image name and takes onlyVersionfrom the root. The purl is deliberately not carried over — inheriting it is what collapsed two images into one container (fixed ine9dfef499bon the base branch).keeps every reference to the image root resolvable and the caller's BOM untouchedcovers it.ossformat the image root is not part of the output (merge drops import metadata), so per-image values are not visible there — unchanged from before this PR, but worth a decision.Depends on
Based on #329, not on
main. Retarget tomainonce #329 lands.