Skip to content

Commit e2f228e

Browse files
committed
tag-whitedout files
Signed-off-by: Varsha U N <[email protected]>
1 parent 53700eb commit e2f228e

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 5.1.1 on 2025-03-22 14:19
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('scanpipe', '0067_discoveredpackage_notes'),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name='codebaseresource',
15+
name='is_whiteout',
16+
field=models.BooleanField(default=False, help_text='Indicates if this resource is a white-out file in a container scan.'),
17+
),
18+
]

scanpipe/models.py

+4
Original file line numberDiff line numberDiff line change
@@ -2497,6 +2497,10 @@ class FileClassifierFieldsModelMixin(models.Model):
24972497
"manifest file."
24982498
),
24992499
)
2500+
is_whiteout = models.BooleanField(
2501+
default=False,
2502+
help_text="Indicates if this resource is a white-out file in a container scan."
2503+
)
25002504

25012505
class Meta:
25022506
abstract = True

scanpipe/pipelines/docker.py

+8
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def steps(cls):
3636
cls.find_images_os_and_distro,
3737
cls.collect_images_information,
3838
cls.collect_and_create_codebase_resources,
39+
cls.tag_whiteout_files,
3940
cls.collect_and_create_system_packages,
4041
cls.flag_uninteresting_codebase_resources,
4142
cls.flag_empty_files,
@@ -85,3 +86,10 @@ def flag_uninteresting_codebase_resources(self):
8586
"""Flag files that don't belong to any system package."""
8687
docker.flag_whiteout_codebase_resources(self.project)
8788
rootfs.flag_uninteresting_codebase_resources(self.project)
89+
90+
def tag_whiteout_files(project):
91+
"""Tag resources that are white-out files in the container scan."""
92+
for resource in project.codebaseresources.all():
93+
if resource.name.startswith(".wh."):
94+
resource.is_whiteout = True
95+
resource.save(update_fields=["is_whiteout"])

0 commit comments

Comments
 (0)