Files
krkn/containers/Dockerfile.template
T
7c94a307d0 fixes krkn source dependencies cves and introduces grype scan in GH Action (#1336)
* adding member request information

Signed-off-by: Paige Patton <prubenda@redhat.com>
Assisted By: Claude Code:

fixes krkn source dependencies cves

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
introduced grype scan on github images

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>

golang downgrade

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>

golang dependency pinning

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>

golang dependency pinning

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>

setuptools downgrade

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>

go-ntlmssp downgrade

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>

security scan in summary

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>

setuptools downgrade

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>

upgrade to fedora 45

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>

golang dependencies

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>

removed pinned dependencies

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>

pinned dependency for oc latest

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>

golang stdlib stable version

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>

upgrading oc release

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>

upgrading yq

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>

yq build in pipeline

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>

pinned transitive dependencies

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>

removed not working

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>

buildkit unpinned

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>

other pinned dependencies

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>

other pinned

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>

other pinned

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>

go work vendor

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>

other pinned

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>

pin buildkit and distribution

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>

reinstated distribution

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>

nit

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>

SECURITY.md

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>

feat: add Grype security scanning badge and comprehensive security policy

- Add security badge job to docker-image workflow
  - Generates detailed badge showing C:X H:Y M:Z vulnerability counts
  - Runs on every push to main branch
  - Publishes badge to krkn-lib-docs repository
  - Uses Grype to scan container image for CVEs
  - Dynamic color based on severity (green/yellow/orange/red)

- Add security badge to README.md
  - Displays current vulnerability baseline
  - Placed after coverage badge for visibility

- Enhance SECURITY.md with CNCF-ready security policy
  - Document proactive security approach with Grype CI/CD integration
  - Define security baseline: 0 Critical, 7 High, 3 Medium, 0 Low (12 total)
  - Detail accepted risks with mitigation strategies
  - Document all 12 known CVEs in transitive dependencies
  - Explain why each CVE cannot be fixed (dependency constraints)
  - Establish quarterly review process for accepted risks
  - Add SLA commitments for vulnerability remediation

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

fix: remove moby/buildkit v0.28.1 pin that breaks oc build

The moby/buildkit v0.28.1 upgrade has breaking API changes (undefined: archive.Compression)
that are incompatible with docker/docker v28.5.2 vendored in oc.

This CVE is documented as accepted risk in SECURITY.md.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

DCO

krkn-lib update

krkn-lib update

* increased krkn-lib version

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>

---------

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
Co-authored-by: Paige Patton <prubenda@redhat.com>
2026-05-20 14:21:51 -04:00

122 lines
4.9 KiB
Docker

# Vulnerability Remediation (2026-05-18):
# - Go 1.25.10: Stable release used for all Go binaries (oc, virtctl, yq)
# - oc release-5.1: Latest OpenShift CLI with newer dependencies
# - Fedora 45: Latest base image with updated system packages
# - yq v4.44.6: Compiled from source with Go 1.25.10 (Fedora/latest have Go 1.26.x)
# - docker 7.0+: Native Unix socket support, allows requests>=2.32
# - Pinned Go modules: go-git v5.19.0, fulcio v1.8.5, sigstore v1.10.4
# - See requirements.txt and SECURITY.md for accepted risks
# oc build
FROM golang:1.25.10 AS oc-build
RUN apt-get update && apt-get install -y --no-install-recommends libkrb5-dev
WORKDIR /tmp
# oc build
RUN git clone --branch release-5.1 https://github.com/openshift/oc.git
WORKDIR /tmp/oc
RUN go mod edit -go 1.25.10 &&\
go mod edit -require github.com/go-git/go-git/v5@v5.19.0 &&\
go mod edit -require github.com/go-git/go-billy/v5@v5.9.0 &&\
go mod edit -require go.opentelemetry.io/otel@v1.41.0 &&\
go mod edit -require github.com/moby/spdystream@v0.5.1 &&\
go mod edit -require golang.org/x/net@v0.38.0 &&\
go mod edit -require github.com/Azure/go-ntlmssp@v0.1.1 &&\
go mod edit -require github.com/sigstore/fulcio@v1.8.5 &&\
go mod edit -require github.com/sigstore/sigstore@v1.10.4 &&\
go mod edit -replace golang.org/x/net=golang.org/x/net@v0.38.0 &&\
go mod edit -replace github.com/moby/spdystream=github.com/moby/spdystream@v0.5.1 &&\
go mod edit -replace github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream=github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream@v1.7.8 &&\
go mod edit -replace github.com/aws/aws-sdk-go-v2/service/s3=github.com/aws/aws-sdk-go-v2/service/s3@v1.97.3 &&\
go mod tidy && \
rm -rf vendor && \
go mod vendor
RUN make GO_REQUIRED_MIN_VERSION:= oc
# virtctl build
WORKDIR /tmp
RUN git clone https://github.com/kubevirt/kubevirt.git
WORKDIR /tmp/kubevirt
RUN go mod edit -go 1.25.10 &&\
go mod edit -replace github.com/moby/spdystream=github.com/moby/spdystream@v0.5.1 &&\
go mod edit -replace github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream=github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream@v1.7.8 &&\
go mod edit -replace github.com/aws/aws-sdk-go-v2/service/s3=github.com/aws/aws-sdk-go-v2/service/s3@v1.97.3 &&\
go mod tidy &&\
go work use &&\
go work vendor &&\
go build -o virtctl ./cmd/virtctl/
# yq build (compile with Go 1.25.10 to avoid stdlib CVEs)
WORKDIR /tmp
RUN git clone --depth 1 --branch v4.44.6 https://github.com/mikefarah/yq.git
WORKDIR /tmp/yq
RUN go mod edit -replace golang.org/x/net=golang.org/x/net@v0.38.0 &&\
go mod edit -replace github.com/moby/spdystream=github.com/moby/spdystream@v0.5.1 &&\
go mod tidy &&\
go build -ldflags="-s -w" .
FROM fedora:45
ARG PR_NUMBER
ARG TAG
ARG PYTHON_VERSION=3.11
ENV PYTHON_CMD=python${PYTHON_VERSION}
RUN groupadd -g 1001 krkn && useradd -m -u 1001 -g krkn krkn
RUN dnf update -y
ENV KUBECONFIG /home/krkn/.kube/config
# This overwrites any existing configuration in /etc/yum.repos.d/kubernetes.repo
RUN dnf update && dnf install -y --setopt=install_weak_deps=False \
git python${PYTHON_VERSION} jq gettext wget which ipmitool openssh-server &&\
dnf clean all
# copy oc, virtctl, yq binaries from oc-build image
COPY --from=oc-build /tmp/oc/oc /usr/bin/oc
COPY --from=oc-build /tmp/kubevirt/virtctl /usr/bin/virtctl
COPY --from=oc-build /tmp/yq/yq /usr/bin/yq
RUN ln -s /usr/bin/oc /usr/bin/kubectl
# krkn build
RUN git clone https://github.com/krkn-chaos/krkn.git /home/krkn/kraken && \
mkdir -p /home/krkn/.kube
RUN mkdir -p /home/krkn/.ssh && \
chmod 700 /home/krkn/.ssh
WORKDIR /home/krkn/kraken
# default behaviour will be to build main
# if it is a PR trigger the PR itself will be checked out
RUN if [ -n "$PR_NUMBER" ]; then git fetch origin pull/${PR_NUMBER}/head:pr-${PR_NUMBER} && git checkout pr-${PR_NUMBER};fi
# if it is a TAG trigger checkout the tag
RUN if [ -n "$TAG" ]; then git checkout "$TAG";fi
RUN ${PYTHON_CMD} -m ensurepip --upgrade --default-pip
RUN ${PYTHON_CMD} -m pip install --upgrade pip setuptools==81.0.0
# removes the the vulnerable versions of setuptools and pip
RUN rm -rf "$(pip cache dir)"
RUN rm -rf /tmp/*
RUN rm -rf /usr/local/lib/${PYTHON_CMD}/ensurepip/_bundled
RUN ${PYTHON_CMD} -m pip install -r requirements.txt
RUN ${PYTHON_CMD} -m pip install jsonschema
# Force setuptools==81.0.0 after all deps (some may try to upgrade it to 82+)
RUN ${PYTHON_CMD} -m pip install --force-reinstall --no-deps setuptools==81.0.0
LABEL krknctl.title.global="Krkn Base Image"
LABEL krknctl.description.global="This is the krkn base image."
LABEL krknctl.input_fields.global='$KRKNCTL_INPUT'
# SSH setup script
RUN chmod +x /home/krkn/kraken/containers/setup-ssh.sh
# Main entrypoint script
RUN chmod +x /home/krkn/kraken/containers/entrypoint.sh
RUN chown -R krkn:krkn /home/krkn && chmod 755 /home/krkn
USER krkn
ENTRYPOINT ["/bin/bash", "/home/krkn/kraken/containers/entrypoint.sh"]
CMD ["--config=config/config.yaml"]