Reduce Buildah log level to hide secrets for s2i

Solution Verified - Updated -

Environment

  • Red Hat OpenShift Container Platform(RHOCP)
    • All OCP 4 versions prior to 4.10.30

Issue

When customer uses S2I , all secrets used in OCP cluster will be printed in buildah logs since "--quiet" argument cannot be used as per the below configuration:

type: Source
    sourceStrategy:
      from:
        kind: ImageStreamTag
        namespace: xxxxxxx
        name: 's2i-xxxxxx-xxxxxxx:v1.0.0'

Resolution

Root Cause

Customers are using secrets but in an earlier version of OCP 4 (prior to 4.10.30) the default buildah logs will print out all ENV, LABEL, image get/push details to the log.

Diagnostic Steps

Verification Steps:

  1. Create a simple Containerfile that has an ENV statement
FROM registry.redhat.io/ubi8/ubi:latest
ENV SECRET_DATA="hello-world"
RUN echo "Hello world!"
  1. Build an image with the Containerfile above, with log level set to "error"
$ buildah --log-level=error bud -t hello-world:latest -f Containerfile .
  1. Result - Step ENV is printed.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments