Security updates to containers
PR Description
This PR serves to reduce image sizes and drastically reduce CVEs in built images, along with fixing a deprecation warning to the python API.
BEFORE
| Container Name | Size | Critical CVEs | High CVEs | Medium CVEs | Low CVEs | Unspecified CVEs |
|---|---|---|---|---|---|---|
| datafed/core | 200.37MB | 0 | 0 | 5 | 52 | 0 |
| datafed/web | 610.28MB | 1 | 8 | 1211 | 59 | 0 |
| datafed/repo | 181.30MB | 0 | 0 | 5 | 12 | 0 |
| datafed/gcs | 6.16GB | 2 | 23 | 30 | 19 | 0 |
AFTER
| Container Name | Size | Critical CVEs | High CVEs | Medium CVEs | Low CVEs | Unspecified CVEs |
|---|---|---|---|---|---|---|
| datafed/core | 159.88MB | 0 | 0 | 0 | 33 | 0 |
| datafed/web | 747.02MB | 0 | 2 | 1 | 75 | 2 |
| datafed/repo | 141.48MB | 0 | 0 | 0 | 33 | 0 |
| datafed/gcs | 1.57GB | 1 | 14 | 13 | 53 | 0 |
Tasks
- [x] - A description of the PR has been provided, and a diagram included if it is a new feature.
- [x] - Formatter has been run
- [x] - CHANGELOG comment has been added
- [x] - Labels have been assigned to the pr
- [x] - A reviwer has been added
- [x] - A user has been assigned to work on the pr
- [x] - If new feature a unit test has been added
Summary by Sourcery
Updates dependencies, base images, and protobuf handling to reduce image sizes and CVEs, and fixes a deprecation warning in the Python API.
Bug Fixes:
- Fixes a deprecation warning in the Python API related to protobuf messages by using MessageFactory to create protobuf message instances.
Enhancements:
- Updates the base image for the GCS container to debian:bookworm-slim, reducing image size and potential security vulnerabilities.
- Updates dependencies including Node.js, protobuf, libcurl, and Boost to address security vulnerabilities and improve performance.
Reviewer's Guide by Sourcery
This PR updates dependency versions, addresses a protobuf deprecation warning, and modifies the base image used for building containers. These changes aim to reduce image sizes, mitigate CVEs, and improve the overall security and compatibility of the DataFed system.
Updated class diagram for protobuf message handling
classDiagram
class Connection {
+recv(self, a_timeout=1000)
+makeMessage(self, msg_name)
}
note for Connection.recv "Uses MessageFactory to create message instances"
note for Connection.makeMessage "Uses MessageFactory to create message instances"
class MessageFactory {
+GetMessageClass(desc)
}
Connection -- MessageFactory : uses
File-Level Changes
| Change | Details | Files |
|---|---|---|
Updated dependency versions in dependency_versions.sh to address security vulnerabilities and improve compatibility. |
|
scripts/dependency_versions.sh |
| Addressed a deprecation warning in the Python API related to protobuf message creation. |
|
python/datafed_pkg/datafed/Connection.py |
Modified the base image and submodule checkout in compose_build_images.sh to reduce image sizes and CVEs. |
|
scripts/compose_build_images.sh |
| Passed arguments to the compose build images script. |
|
compose/all/build_images_for_compose.sh |
Updated the protobuf dependency version in requirements.txt. |
|
python/datafed_pkg/requirements.txt |
Added libopenssl to the list of external dependencies in install_authz_dependencies.sh. |
|
scripts/install_authz_dependencies.sh |
Added libboost-program-options-dev to the list of packages in install_core_dependencies.sh. |
|
scripts/install_core_dependencies.sh |
Tips and commands
Interacting with Sourcery
-
Trigger a new review: Comment
@sourcery-ai reviewon the pull request. - Continue discussions: Reply directly to Sourcery's review comments.
-
Generate a GitHub issue from a review comment: Ask Sourcery to create an
issue from a review comment by replying to it. You can also reply to a
review comment with
@sourcery-ai issueto create an issue from it. -
Generate a pull request title: Write
@sourcery-aianywhere in the pull request title to generate a title at any time. You can also comment@sourcery-ai titleon the pull request to (re-)generate the title at any time. -
Generate a pull request summary: Write
@sourcery-ai summaryanywhere in the pull request body to generate a PR summary at any time exactly where you want it. You can also comment@sourcery-ai summaryon the pull request to (re-)generate the summary at any time. -
Generate reviewer's guide: Comment
@sourcery-ai guideon the pull request to (re-)generate the reviewer's guide at any time. -
Resolve all Sourcery comments: Comment
@sourcery-ai resolveon the pull request to resolve all Sourcery comments. Useful if you've already addressed all the comments and don't want to see them anymore. -
Dismiss all Sourcery reviews: Comment
@sourcery-ai dismisson the pull request to dismiss all existing Sourcery reviews. Especially useful if you want to start fresh with a new review - don't forget to comment@sourcery-ai reviewto trigger a new review! -
Generate a plan of action for an issue: Comment
@sourcery-ai planon an issue to generate a plan of action for it.
Customizing Your Experience
Access your dashboard to:
- Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others.
- Change the review language.
- Add, remove or edit custom review instructions.
- Adjust other review settings.
Getting Help
- Contact our support team for questions or feedback.
- Visit our documentation for detailed guides and information.
- Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.
I have been pinged
Pushing this along so it doesn't go stale. Was told the CI/CD issue was addressed, and wanted to keep this in motion
Python PPA package downloads don't work with Bookworm.
#25 31.45 Setting up packagekit-tools (1.2.6-5) ...
#25 31.46 Setting up software-properties-common (0.99.30-4.1~deb12u1) ...
#25 31.57 Processing triggers for dbus (1.14.10-1~deb12u1) ...
#25 31.85 Traceback (most recent call last):
#25 31.85 File "/usr/bin/add-apt-repository", line 362, in <module>
#25 31.85 sys.exit(0 if addaptrepo.main() else 1)
#25 31.85 ^^^^^^^^^^^^^^^^^
#25 31.85 File "/usr/bin/add-apt-repository", line 345, in main
#25 31.85 shortcut = handler(source, **shortcut_params)
#25 31.85 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#25 31.85 File "/usr/lib/python3/dist-packages/softwareproperties/shortcuts.py", line 40, in shortcut_handler
#25 31.85 return handler(shortcut, **kwargs)
#25 31.85 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
#25 31.85 File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 86, in __init__
#25 31.85 if self.lpppa.publish_debug_symbols:
#25 31.85 ^^^^^^^^^^
#25 31.85 File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 126, in lpppa
#25 31.85 self._lpppa = self.lpteam.getPPAByName(name=self.ppaname)
#25 31.85 ^^^^^^^^^^^
#25 31.85 File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 113, in lpteam
#25 31.85 self._lpteam = self.lp.people(self.teamname)
#25 31.85 ^^^^^^^^^^^^^^
#25 31.85 AttributeError: 'NoneType' object has no attribute 'people'
#25 ERROR: process "/bin/bash -c DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC ${BUILD_DIR}/scripts/install_dependencies.sh -a -r -z -c" did not complete successfully: exit code: 1
------
> [21/31] RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC /datafed/source/scripts/install_dependencies.sh -a -r -z -c:
31.85 File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 86, in __init__
31.85 if self.lpppa.publish_debug_symbols:
31.85 ^^^^^^^^^^
31.85 File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 126, in lpppa
31.85 self._lpppa = self.lpteam.getPPAByName(name=self.ppaname)
31.85 ^^^^^^^^^^^
31.85 File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 113, in lpteam
31.85 self._lpteam = self.lp.people(self.teamname)
31.85 ^^^^^^^^^^^^^^
31.85 AttributeError: 'NoneType' object has no attribute 'people'
------
Dockerfile.dependencies:51
--------------------
49 | # Web dependencies
50 | COPY ./scripts/install_ws_dependencies.sh ${BUILD_DIR}/scripts/
51 | >>> RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC ${BUILD_DIR}/scripts/install_dependencies.sh -a -r -z -c
52 |
53 | # Core dependencies
--------------------
ERROR: failed to solve: process "/bin/bash -c DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC ${BUILD_DIR}/scripts/install_dependencies.sh -a -r -z -c" did not complete successfully: exit code: 1
Hardcoded version numbers in Dockerfile will be addressed here: https://github.com/ORNL/DataFed/issues/1512