Skip to content

Remediate critical container-image CVEs and pin runtime dependencies #13

Description

@jamesray

Summary

The sdc_aws_sorting_lambda container image has multiple active critical package-vulnerability findings. We need to determine which findings are introduced by the shared Lambda base image versus this repository’s Dockerfile and Python dependency installation, then apply and verify the smallest safe set of updates.

This issue tracks changes required specifically in:

  • swxsoc/sdc_aws_sorting_lambda
  • The Lambda image build and runtime layers
  • Dependencies installed by lambda_function/requirements.txt
  • The downloaded AWS Lambda Runtime Interface Emulator (RIE)

Related base-image work should be tracked separately in the base-image repository and linked here.

Current implementation

The Lambda image currently:

  • Uses public.ecr.aws/w5r9l1c8/dev-swsoc-docker-lambda-base:latest
  • Installs swxsoc from the moving main branch
  • Upgrades pip and setuptools without version pins
  • Installs curl through apt
  • Downloads the latest AWS Lambda RIE binary during every build

These moving inputs make the resulting image difficult to reproduce and can cause vulnerability status to change between otherwise identical builds.

Reported critical findings

The following findings were reported against the deployed image:

Investigation required

Obtain the scanner’s detailed finding export and record, for every CVE:

  • Scanned image repository, tag, and digest
  • Package manager/ecosystem
  • Installed package version
  • Fixed package version
  • Package or binary filesystem path
  • Image layer that introduced the package
  • Scanner/vendor advisory source
  • Whether the vulnerable code is present in the final runtime image

Determine whether each finding originates from:

  1. The shared base image
  2. swxsoc or one of its transitive dependencies
  3. Packages installed directly by this Dockerfile
  4. The AWS Lambda RIE compiled binary
  5. A false positive or stale image scan

Proposed remediation

  • Obtain and attach the detailed scanner export.
  • Record the exact affected image digest.
  • Link the corresponding base-image remediation issue.
  • Update the base-image reference after a remediated image is published.
  • Pin the base image by immutable digest where practical.
  • Identify whether aiohttp, FontTools, or Pillow are installed through swxsoc or inherited from the base image.
  • Apply only the Python version constraints required to select fixed releases.
  • Identify the compiled binary responsible for each Go standard-library finding.
  • Update and pin AWS Lambda RIE if it is responsible for either Go finding.
  • Avoid installing curl in the final runtime image if it is needed only to download RIE.
  • Pin swxsoc to a release, tag, or commit rather than the moving main branch.
  • Make package-installation steps noninteractive and clean package-manager caches.
  • Build the resulting container image.
  • Run the complete Lambda test suite.
  • Inventory OS and Python package versions in the final image.
  • Rescan the exact resulting image digest.
  • Confirm every listed finding is resolved, suppressed with documented evidence, or transferred to the base-image issue.

Acceptance criteria

  • The Lambda is built from a remediated, identifiable base-image digest.
  • Runtime dependencies are reproducible enough to associate a source commit with an image digest.
  • The full test suite passes.
  • The new image is scanned using the same scanner/policy as the original image.
  • All listed critical findings are closed or have a documented exception supported by package-path and vendor-advisory evidence.
  • No unrelated application or dependency upgrades are included.
  • Changes are delivered as one focused CVE-remediation commit if practical.

Verification commands

pytest --pyargs lambda_function/tests \
  --cov=lambda_function/src \
  --cov-report=html

cd lambda_function
docker build -t sdc_aws_sorting_lambda:cve-remediation .

Metadata

Metadata

Assignees

Labels

dependenciesPull requests that update a dependency file

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions