-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for Windows containers (#181)
* Use newer version of container libraries Signed-off-by: Philippe Ombredanne <[email protected]> * Use new container-inspector structures Signed-off-by: Philippe Ombredanne <[email protected]> * Add minimal support for Windows containers Signed-off-by: Philippe Ombredanne <[email protected]> * Update Windows package getter * The windows_helper module from scancode is not available on pypi Signed-off-by: Jono Yang <[email protected]> * Use newer version of container libraries Signed-off-by: Philippe Ombredanne <[email protected]> * Update call to windows_helper to win_reg Signed-off-by: Jono Yang <[email protected]> * Create new pipeline for Windows Docker images * Create Windows specific tag_uninteresting_windows_codebase_resources function Signed-off-by: Jono Yang <[email protected]> * Add function to find packages at well-known paths * Update tests Signed-off-by: Jono Yang <[email protected]> * Add step to tag known software in pipeline * Change name of Docker step from "find_images_linux_distro" to "find_images_os_and_distro" Signed-off-by: Jono Yang <[email protected]> * Get version from path in tag_known_software #238 * Update docstrings * Pin fetchcode dep Signed-off-by: Jono Yang <[email protected]> * Troubleshoot regex patterns #238 Signed-off-by: Jono Yang <[email protected]> * Report Program File contents as packages #238 Signed-off-by: Jono Yang <[email protected]> * Update Windows-specific regex * Add more file names and file extensions to be ignored * Update expected test results Signed-off-by: Jono Yang <[email protected]> * Do not ignore .mui files #238 Signed-off-by: Jono Yang <[email protected]> * Filter using extension field rather than path #238 Signed-off-by: Jono Yang <[email protected]> * Update scanpipe/pipes/docker.py Create issue to track extraction issue See #251 Signed-off-by: Philippe Ombredanne <[email protected]> * Fix scancode-toolkit pinned version in base.txt #238 Signed-off-by: Jono Yang <[email protected]> * Create pipeline step to tag ignorable files #252 Signed-off-by: Jono Yang <[email protected]> * Update formatting #238 Signed-off-by: Jono Yang <[email protected]> * Generalize regex expressions #238 * Modify regex used for Windows container analysis so it can be used outside the context of a Windows Docker image * Update tests Signed-off-by: Jono Yang <[email protected]> * Create new pipes for ignoring files #238 * Create pipes that ignore media files and data files with no clues * Update test results Signed-off-by: Jono Yang <[email protected]> * Add more file extensions to ignore #238 Signed-off-by: Jono Yang <[email protected]> * Bump dep versions #238 Signed-off-by: Jono Yang <[email protected]> * Update docstring #238 * Use InstalledWindowsProgram object instead of Package Signed-off-by: Jono Yang <[email protected]> * Improve regex used in tag_known_software #238 * Update tests with more paths to test regex patterns Signed-off-by: Jono Yang <[email protected]> * Adjust code for consistency across the codebase #181 Signed-off-by: Thomas Druez <[email protected]> * Address PR comments #238 * Use re.match instead of re.split * Rename WindowsDocker pipeline to DockerWindows * Set the default value of the q_objects argument for tag_installed_package_files to be a tuple Signed-off-by: Jono Yang <[email protected]> * Add is_media field to CodebaseResource #238 * Update test results Signed-off-by: Jono Yang <[email protected]> * Simplify tag_media_files_as_unintersting() #238 * Update test Signed-off-by: Jono Yang <[email protected]> * Refine windows pipes #238 Signed-off-by: Thomas Druez <[email protected]> Co-authored-by: Jono Yang <[email protected]> Co-authored-by: Thomas Druez <[email protected]>
- Loading branch information
1 parent
b5dbd57
commit a7e3897
Showing
14 changed files
with
1,107 additions
and
375 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 3.2.6 on 2021-08-03 18:27 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('scanpipe', '0010_codebaseresource_is_key_file'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='codebaseresource', | ||
name='is_media', | ||
field=models.BooleanField(default=False), | ||
), | ||
] |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# http://nexb.com and https://github.com/nexB/scancode.io | ||
# The ScanCode.io software is licensed under the Apache License version 2.0. | ||
# Data generated with ScanCode.io is provided as-is without warranties. | ||
# ScanCode is a trademark of nexB Inc. | ||
# | ||
# You may not use this software except in compliance with the License. | ||
# You may obtain a copy of the License at: http://apache.org/licenses/LICENSE-2.0 | ||
# Unless required by applicable law or agreed to in writing, software distributed | ||
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
# CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations under the License. | ||
# | ||
# Data Generated with ScanCode.io is provided on an "AS IS" BASIS, WITHOUT WARRANTIES | ||
# OR CONDITIONS OF ANY KIND, either express or implied. No content created from | ||
# ScanCode.io should be considered or used as legal advice. Consult an Attorney | ||
# for any legal advice. | ||
# | ||
# ScanCode.io is a free software code scanning tool from nexB Inc. and others. | ||
# Visit https://github.com/nexB/scancode.io for support and download. | ||
|
||
from scanpipe.pipelines.docker import Docker | ||
from scanpipe.pipes import docker | ||
from scanpipe.pipes import rootfs | ||
from scanpipe.pipes import windows | ||
|
||
|
||
class DockerWindows(Docker): | ||
""" | ||
A pipeline to analyze Windows Docker images. | ||
""" | ||
|
||
@classmethod | ||
def steps(cls): | ||
return ( | ||
cls.extract_images, | ||
cls.extract_layers, | ||
cls.find_images_os_and_distro, | ||
cls.collect_images_information, | ||
cls.collect_and_create_codebase_resources, | ||
cls.collect_and_create_system_packages, | ||
cls.tag_known_software_packages, | ||
cls.tag_uninteresting_codebase_resources, | ||
cls.tag_program_files_dirs_as_packages, | ||
cls.tag_empty_files, | ||
cls.scan_for_application_packages, | ||
cls.scan_for_files, | ||
cls.analyze_scanned_files, | ||
cls.tag_data_files_with_no_clues, | ||
cls.tag_not_analyzed_codebase_resources, | ||
) | ||
|
||
def tag_known_software_packages(self): | ||
""" | ||
Flag files from well-known software packages by checking common install paths. | ||
""" | ||
windows.tag_known_software(self.project) | ||
|
||
def tag_uninteresting_codebase_resources(self): | ||
""" | ||
Flag files that are known to be uninteresting. | ||
""" | ||
docker.tag_whiteout_codebase_resources(self.project) | ||
windows.tag_uninteresting_windows_codebase_resources(self.project) | ||
rootfs.tag_ignorable_codebase_resources(self.project) | ||
rootfs.tag_media_files_as_uninteresting(self.project) | ||
|
||
def tag_program_files_dirs_as_packages(self): | ||
""" | ||
Report the immediate subdirectories of `Program Files` and `Program | ||
Files (x86)` as packages. | ||
""" | ||
windows.tag_program_files(self.project) | ||
|
||
def tag_data_files_with_no_clues(self): | ||
""" | ||
If a file is a data file and has no clues towards its origin, mark as | ||
uninteresting. | ||
""" | ||
rootfs.tag_data_files_with_no_clues(self.project) |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.