Skip to content

Commit 5bb6dd4

Browse files
authored
Merge pull request #115 from scanoss/feature/mdaloia/es-213-add-container-scanning
feat: ES-213 Add container scanning
2 parents 3ce0d0a + 70bd84f commit 5bb6dd4

File tree

13 files changed

+797
-47
lines changed

13 files changed

+797
-47
lines changed

CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
### Added
1010
- Upcoming changes...
1111

12+
## [1.22.0] - 2025-04-23
13+
### Added
14+
- Add `container-scan` subcommand to scan container images.
15+
- Add `--container` flag to `dependency` subcommand to scan dependencies in container images.
16+
### Modified
17+
- Refactor CLI argument handling for output and format options.
18+
### Fixed
19+
- Fixed issue with wfp command where settings file was being loaded from the cwd instead of the scan root directory
20+
1221
## [1.21.0] - 2025-03-27
1322
### Added
1423
- Add folder-scan subcommand
@@ -498,4 +507,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
498507
[1.20.4]: https://github.com/scanoss/scanoss.py/compare/v1.20.3...v1.20.4
499508
[1.20.5]: https://github.com/scanoss/scanoss.py/compare/v1.20.4...v1.20.5
500509
[1.20.6]: https://github.com/scanoss/scanoss.py/compare/v1.20.5...v1.20.6
501-
[1.21.0]: https://github.com/scanoss/scanoss.py/compare/v1.20.6...v1.21.0
510+
[1.21.0]: https://github.com/scanoss/scanoss.py/compare/v1.20.6...v1.21.0
511+
[1.22.0]: https://github.com/scanoss/scanoss.py/compare/v1.21.0...v1.22.0

CLIENT_HELP.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,11 @@ The dependency files of a project can be fingerprinted/parsed using the `dep` co
163163
scanoss-py dep -o src-deps.json src
164164
```
165165

166+
You can also analyze dependencies from a container image using the `--container` flag:
167+
```bash
168+
scanoss-py dep --container ubuntu:latest -o container-deps.json
169+
```
170+
166171
This parsed dependency file can then be sent to the SCANOSS for decoration using the scanning command:
167172
```bash
168173
scanoss-py scan --dep src-deps.json --dependencies-only -o scan-results.json
@@ -429,4 +434,13 @@ The new `folder-scan` subcommand performs a comprehensive scan on an entire dire
429434
**Usage:**
430435
```shell
431436
scanoss-py folder-scan /path/to/folder -o folder-scan-results.json
432-
```
437+
```
438+
439+
### Container-Scan a Docker Image
440+
441+
The `container-scan` subcommand allows you to scan Docker container images for dependencies. This command extracts and analyzes dependencies from container images, helping you identify open source components within containerized applications.
442+
443+
**Usage:**
444+
```shell
445+
scanoss-py container-scan image_name:tag -o container-scan-results.json
446+
```

Dockerfile

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ FROM base AS builder
1010

1111
# Setup the required build tooling
1212
RUN apt-get update \
13-
&& apt-get install -y --no-install-recommends build-essential gcc \
14-
&& apt-get clean \
15-
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
13+
&& apt-get install -y --no-install-recommends build-essential gcc \
14+
&& apt-get clean \
15+
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
1616

1717
# Create and activate virtual environment
1818
RUN python -m venv /opt/venv
@@ -56,9 +56,12 @@ ENV GRPC_POLL_STRATEGY=poll
5656

5757
# Install jq and curl commands
5858
RUN apt-get update \
59-
&& apt-get install -y --no-install-recommends jq curl \
60-
&& apt-get clean \
61-
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
59+
&& apt-get install -y --no-install-recommends jq curl \
60+
&& apt-get clean \
61+
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
62+
63+
# Install syft
64+
RUN curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
6265

6366
# Setup working directory and user
6467
WORKDIR /scanoss

docs/source/index.rst

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ Scan source code for dependencies, but do not decorate them.
174174
- Description
175175
* - --output <file name>, -o <file name>
176176
- Output result file name (optional - default STDOUT)
177+
* - --container <image_name:tag>
178+
- Analyze dependencies from a Docker container image instead of a directory
177179
* - --sc-command SC_COMMAND
178180
- Scancode command and path if required (optional - default scancode)
179181
* - --sc-timeout SC_TIMEOUT
@@ -301,6 +303,39 @@ Both commands also support these general options:
301303
* --trace, -t: Enable trace messages
302304
* --quiet, -q: Enable quiet mode
303305

306+
------------------------------------
307+
Container Scanning: container-scan, cs
308+
------------------------------------
309+
310+
Scans Docker container images for dependencies, extracting and analyzing components within containerized applications.
311+
312+
.. code-block:: bash
313+
314+
scanoss-py container-scan -i <image_name:tag>
315+
316+
.. list-table::
317+
:widths: 20 30
318+
:header-rows: 1
319+
320+
* - Argument
321+
- Description
322+
* - --image <image_name:tag>, -i <image_name:tag>
323+
- Docker image name and tag to scan (required)
324+
* - --output <file name>, -o <file name>
325+
- Output result file name (optional - default STDOUT)
326+
* - --include-base-image
327+
- Include base image dependencies in the scan results
328+
* - --format <format>, -f <format>
329+
- Output format: {json} (optional - default json)
330+
* - --timeout <seconds>, -M <seconds>
331+
- Timeout in seconds for API communication (optional - default 600)
332+
* - --key <token>, -k <token>
333+
- SCANOSS API Key token (optional - not required for default OSSKB URL)
334+
* - --proxy <url>
335+
- Proxy URL to use for connections
336+
* - --ca-cert <file>
337+
- Alternative certificate PEM file
338+
304339
-----------------
305340
Component:
306341
-----------------
@@ -434,4 +469,4 @@ The Scanoss Open Source scanoss-py package is released under the MIT license.
434469

435470
SCANOSS Website <https://www.scanoss.com/>
436471
GitHub <https://github.com/scanoss>
437-
Software transparency foundation <https://www.softwaretransparency.org/>
472+
Software transparency foundation <https://www.softwaretransparency.org/>

src/scanoss/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@
2222
THE SOFTWARE.
2323
"""
2424

25-
__version__ = '1.21.0'
25+
__version__ = '1.22.0'

0 commit comments

Comments
 (0)