For IT professionals
Lesson 05 of 5
About 9 minutes

Authorized DevOps and container security practice

Triage findings and prove the hardening result

Use a second Gemini prompt to organize sanitized scan findings, choose a fix, and compare the rebuilt image with direct evidence.

Learning objective

Verify scanner findings against the scanned image and demonstrate the approved base, non-root runtime, and secret-safe build outcomes.

Use only a repository, branch, runner, registry, image, and activity you own or have explicit authorization to review. Use a Gemini tool only with sanitized material your organization approves. The website does not connect to Gemini.

Turn a finding into a testable decision

Start with the actual GitLab report and record its image reference or digest, package name, installed version, severity, affected path, and any fixed-version detail that the report supplies. Keep the report’s facts separate from a proposed cause. Do not invent a CVE, fixed version, or false-positive conclusion to fill a gap.

For each relevant finding, check whether it is present in the image that was actually scanned, whether a supported fix applies to this application, and what compatibility test would expose a regression. Prefer the narrowest supported update, then rebuild and scan the new commit-tagged image. If a finding remains, document its evidence and use the project’s approved exception process; do not suppress it just to make a pipeline green.

Check all three hardening outcomes on the resulting image. Confirm the base image source and version against policy; inspect Config.User and run a harmless identity check to verify the container is not root; inspect the Docker build context, history, image configuration, and scanner output for credentials. Secret scanning has limits, so also keep credentials outside source and provide them only through approved runtime or build-secret mechanisms.

Ask Gemini to organize evidence, not decide for you

A second prompt can help compare supplied findings and candidate fixes. Ask for a trace from each recommendation to an exact report field, an uncertainty list, a compatibility test, and a verification step. A response that refers to a finding not present in the input should be rejected as unsupported.

Repeat the relevant tests and the image scan after a change. Save the new job log and report, compare the old and new image references, and have the authorized owner review unresolved findings. A passing scanner job alone does not show that the new image runs correctly or meets every policy.

Controlled examples

Adapt examples only inside your approved project

Bounded prompt for sanitized container findingsUse this only with a Gemini tool that your organization approves for the finding data. Leave out credentials, personal data, private image URLs, and any finding detail that policy does not permit you to share.
I am authorized to review only this training image and the sanitized findings below.
Use only the supplied report fields. Do not invent a CVE, package version, fixed release, exploitability claim, or scan result.
For each finding, return:
1. The exact supplied evidence and the image reference it belongs to.
2. What remains uncertain or needs confirmation from the project owner.
3. A minimal candidate fix, if the supplied evidence supports one.
4. A compatibility test and the GitLab job/report that must be rerun.
5. A verification step for the approved base image, non-root runtime user, and secret handling.
Do not suppress a finding or recommend deployment. The authorized owner makes those decisions.

Sanitized report fields:
[paste only approved finding identifiers, package names, versions, paths, and report details]
Direct checks against the built training imageSet TRAINING_IMAGE only to the approved image built for this exercise. Confirm the configured and effective UID is nonzero; the exact id output varies by image. Review history alongside build configuration and scanner evidence. These commands do not prove that every secret or vulnerability is absent.
docker image inspect "$TRAINING_IMAGE" --format "{{.Config.User}}"
docker run --rm --entrypoint id "$TRAINING_IMAGE"
docker history --no-trunc "$TRAINING_IMAGE"

Controlled practice

Apply the lesson

Training scenario

The authorized project has a completed container_scanning job and a sanitized training finding. A new candidate image must be rebuilt and checked before the project owner reviews it.

  1. Record the old scan’s image reference and copy only approved, sanitized report fields into the bounded prompt.
  2. Check Gemini’s suggested package or Dockerfile change against the report and actual project files; mark unsupported claims as unverified.
  3. Make one compatible change on the approved feature branch and rerun the project tests and build.
  4. Scan the new commit-tagged image and save the resulting job status and report artifact.
  5. Inspect the base source/version, effective non-root UID, image history and configuration, build context, and secret-handling path.
  6. Summarize remaining findings and ask the authorized owner to review any exception or deployment decision.

Check your work: The rebuilt image has traceable scan evidence, an approved maintained base, verified non-root execution, no credentials copied into the image, and no claim broader than the checks that actually ran.

Learning check

Check your understanding

A Gemini answer recommends suppressing a scanner finding, but the supplied report does not contain the package version it describes. What should you do?

Choose the best answer

Official references

You have reached the end of this path. Return to the GitLab and Gemini path.