Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move pre-processors to policy or rule declaration #167

Open
1 task done
JimBugwadia opened this issue Oct 30, 2023 · 2 comments
Open
1 task done

Move pre-processors to policy or rule declaration #167

JimBugwadia opened this issue Oct 30, 2023 · 2 comments
Labels
enhancement New feature or request triage Default label assigned to all new issues indicating label curation is needed to fully organize.

Comments

@JimBugwadia
Copy link
Member

Problem Statement

The pre-processors do not add much value and can lead to confusing results if the same policy is applied without the --pre-processor flag.

It seems best to require that policy rule declarations are complete in how they reference data in the JSON payload and not spread processing logic across the rule declaration and pre-processing declarations.

Also, for the web application form factor pre-processors require creating an outer request type with the fields payload and pre-processors. It would be simpler to simply add the JSON payload to the POST body.

Solution Description

Remove pre-processors.

Alternatives

No response

Additional Context

No response

Slack discussion

No response

Research

  • I have searched other issues in this repository and mine is not recorded.
@JimBugwadia JimBugwadia added enhancement New feature or request triage Default label assigned to all new issues indicating label curation is needed to fully organize. labels Oct 30, 2023
@JimBugwadia JimBugwadia added this to the Release v0.20 milestone Oct 30, 2023
@eddycharly
Copy link
Member

This doesn't sound doable to me.

@JimBugwadia JimBugwadia changed the title Remove pre-processors Move pre-processors to policy or rule declaration Nov 2, 2023
@JimBugwadia
Copy link
Member Author

Updated based on recent discussions....it makes sense to keep a pre-processing option, but may be best to declare and manage as part of the policy:

Something like this:

apiVersion: json.kyverno.io/v1alpha1
kind: ValidatingPolicy
metadata:
  name: fs-read-only
spec:
  select: 
  - "planned_values.root_module.resources[]"
  identifier: "address"
  rules:
    - name: require-fs-read-only
      match:
        any:
        - type: aws_ecs_task_definition
      assert:
        any:
        - message: ECS containers only have read-only access to root filesystems
          check:
            values:
              ~.(json_parse(container_definitions)):
                  readonlyRootFilesystem: true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request triage Default label assigned to all new issues indicating label curation is needed to fully organize.
Projects
None yet
Development

No branches or pull requests

2 participants