Giter VIP home page Giter VIP logo

capabilities-psp-policy's People

Contributors

ereslibre avatar fabriziosestito avatar flavio avatar geeksambhu avatar jvanz avatar khaledemaradev avatar olblak avatar renovate-bot avatar renovate[bot] avatar viccuad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

capabilities-psp-policy's Issues

Rebuild policy against latest SDK

We changed the way mutated objects are sent back to the policy-server. This breaks this policy's ability to mutate requests once a new version of the policy server is released.

A simple rebuild of the policy and release will fix it, but we have to wait for a new version of the policy-server to be tagged

Feature Request: Validate ephemeral containers too

Ephemeral containers also have a spec.securityContext, hence we can set capabilities for them (and an attacker can use it for privilege escalation). This policy predates their inclusion in Kubernetes, and this policy mirrors the analogous capabilities PSP, which also predates their inclusion in Kubernetes. The PSP was never updated because as it was deprecated instead.
This doesn't mean we shouldn't check ephemeral containers too.

Acceptance criteria

Validate ephemeral containers too.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

cargo
Cargo.toml
  • anyhow 1.0
  • serde 1.0
  • serde_json 1.0
  • jsonpath_lib 0.3.0
  • kubewarden-policy-sdk 0.11.0
  • k8s-openapi 0.22.0
  • assert-json-diff 2.0.2
github-actions
.github/workflows/release.yml
  • kubewarden/github-actions v3.3.1
  • kubewarden/github-actions v3.3.1
.github/workflows/tests.yml
  • kubewarden/github-actions v3.3.1

  • Check this box to trigger a request for Renovate to run again on this repository

Create e2e tests

Acceptance criteria

Add a new make e2e-tests that runs end-to-end tests for the policy locally, using already an present kwctl binary.
Write e2e tests for the "Examples" cases listed in the readme.
Come up with more e2e tests if needed.

Notes

Note that the e2e tests for the policy are not run against a real cluster, but run with kwctl run, which simulates what would happen in a cluster.

One needs the json requests of the operations against the cluster (e.g: a CREATE of a Pod). These requests are what the k8s admission & mutation controller would receive. Kubewarden controller is registered with a webhook into the admission & mutation, so Kubewarden controller receives those requests, passes them to the policy, and depending if the policy accepts, rejects or mutates the request, the Kubewarden controller will forward the request to the kubernetes API for it to be taken into effect (e.g: the creation of the pod).

Once one has those json requests, one can use kwctl run to run them locally and outside of the cluster. This is how the e2e tests get run.

For obtaining the json requests, one craft them manually (from other requests saved in other policy e2e tests for example). Another option is to run the Echo policy in a real cluster, and save the requests from its logs.

For examples and inspiration, see the end to end tests of other policies. Example:

Add policy metadata

The Wasm file containing the policy must be enriched with metadata.

This is just an example of the metadata.yaml file:

rules:
- apiGroups: [""]
  apiVersions: ["v1"]
  resources: ["pods"]
  operations: ["CREATE", "UPDATE"]
mutating: false
labels:
  production: false
annotations:
  name.castelli.hello: world
  io.kubewarden.policy.title: psp-apparmor
  io.kubewarden.policy.description: Replacement for the Kubernetes Pod Security Policy that controls the usage of AppArmor profiles
  io.kubewarden.policy.author: Flavio Castelli
  io.kubewarden.policy.url: https://github.com/kubewarden/psp-apparmor
  io.kubewarden.policy.source: https://github.com/kubewarden/psp-apparmor
  io.kubewarden.policy.license: Apache-2.0
  io.kubewarden.policy.usage: |
    This policy works by defining a whitelist of allowed AppArmor profiles. Pods are then inspected at creation and update time, to ensure only approved profiles are used.

    When no AppArmor profile is defined, Kubernetes will leave the final choice to the underlying container runtime. This will result in using the default AppArmor profile provided by Container Runtime. Because of that, the default behaviour of this policy is to accept workloads that do not have an AppArmor profile specified.

    The policy can be configured with the following data structure:
    ```yaml
    # list of allowed profiles
    allowed_profiles:
    - runtime/default
    - localhost/my-special-workload
    ```

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.