Skip to content

KCSA · Domain 1: Overview of Cloud Native Security · 14% of the exam

Task 1.6: Workload and Application Code Security

Least privilege for workloads, non-root containers, read-only root filesystems, keeping secrets out of code and images, and securing dependencies.

Study it

  • Workload and application code security

    Lesson coming

Sample questions

Try each one before opening the answer. Every option is explained, with the CNCF documentation page that proves it.

Question 1 · choose 1

A team's image runs as root because its Dockerfile has no USER instruction. Its namespace will soon enforce the Restricted Pod Security Standard, and the Pod already sets every other field that Restricted requires. Adding runAsUser: 10001 to the Pod's securityContext makes the application fail at start-up with permission errors on files under /app that the image's build steps created. Which approach lets the Pod run under Restricted with working file access?

  1. ARebuild the image to start as an unprivileged user that owns the files it needs
  2. BKeep runAsUser: 10001 and add the CAP_DAC_OVERRIDE capability to bypass file permission checks
  3. CKeep runAsUser: 10001 and set readOnlyRootFilesystem: false so that the files under /app are writable
  4. DKeep runAsUser: 10001 and set fsGroup: 10001 so that the files under /app get the new group
Show the answer and why
  • ARebuild the image to start as an unprivileged user that owns the files it needs

    Correct

    The checklist asks for images that start with an unprivileged user through the USER instruction, and warns that file permissions in image layers can make a different runtime user fail without changing the image.

  • BKeep runAsUser: 10001 and add the CAP_DAC_OVERRIDE capability to bypass file permission checks

    Incorrect

    Restricted's capability rule does not allow adding CAP_DAC_OVERRIDE, so the Pod would be rejected.

  • CKeep runAsUser: 10001 and set readOnlyRootFilesystem: false so that the files under /app are writable

    Incorrect

    readOnlyRootFilesystem is false by default, so this changes nothing; the errors come from the files' ownership and modes in the image layers.

  • DKeep runAsUser: 10001 and set fsGroup: 10001 so that the files under /app get the new group

    Incorrect

    fsGroup changes the group ownership of supported volumes mounted into the Pod; it does not change files that are part of the image's own layers.

runAsUser can start a container as another user without changing the image, but the checklist notes that the file permissions in the image layers may make that impossible. Restricted rejects an added CAP_DAC_OVERRIDE, a writable root filesystem is already the default, and fsGroup reaches volumes, not image files. The durable fix is an image that is built to run as an unprivileged user, with its files owned accordingly.

Question 2 · choose 1

For the Develop lifecycle phase, which kinds of security automation does Kubernetes' cloud native security overview mention adopting where justified?

  1. ANode autoscaling and Pod disruption budgets
  2. BImage pull policies and imagePullSecrets
  3. CFuzzing and security chaos engineering
  4. DHorizontal Pod autoscaling and readiness probes
Show the answer and why
  • ANode autoscaling and Pod disruption budgets

    Incorrect

    These are availability features, not the security automation named for the Develop phase.

  • BImage pull policies and imagePullSecrets

    Incorrect

    These control how images are pulled at run time, not development-time security testing.

  • CFuzzing and security chaos engineering

    Correct

    The overview suggests incorporating advanced security automation, such as fuzzing and security chaos engineering, where it is justified.

  • DHorizontal Pod autoscaling and readiness probes

    Incorrect

    These manage scaling and traffic readiness, not security testing of code.

In the Develop phase the overview recommends secure design, security-aware code review, threat modeling and, where justified, advanced automation such as fuzzing and security chaos engineering.

Question 3 · choose 1

According to the CNCF Cloud Native Security Whitepaper, what should an application log so that investigators have a trail of evidence after an incident?

  1. AAuthentication, authorization, actions and failures
  2. BOnly successful requests, to keep logs small
  3. CFull request bodies including credentials
  4. DNothing; the platform's audit log covers application actions
Show the answer and why
  • AAuthentication, authorization, actions and failures

    Correct

    The whitepaper says an application should provide logs about authentication, authorization, actions and failures, planned from the design phase.

  • BOnly successful requests, to keep logs small

    Incorrect

    Failures and authorization decisions are among the most useful evidence; the whitepaper lists them explicitly.

  • CFull request bodies including credentials

    Incorrect

    Logging credentials would expose them; the whitepaper asks for events, not secret values.

  • DNothing; the platform's audit log covers application actions

    Incorrect

    The API server audit log records API requests, not what happens inside the application.

The whitepaper's incident response guidance asks developers to build logging of authentication, authorization, actions and failures into applications from the planning stage, so a root cause can be traced later.

Practice domain 1 →Practice all domains →