chainloop icon indicating copy to clipboard operation
chainloop copied to clipboard

Improve typing of policy arguments

Open jiparis opened this issue 1 year ago • 0 comments

Currently, arguments are all interpreted as strings, supporting array of strings either in the form of comma separated values, or line feeds. However, real arrays or numeric values are not supported, forcing Policy writers to do a to_number or is_array in the policy script to correctly handle arguments.

policies:
  materials:
    - ref: sbom-banned-licenses:
      with:
        licenses:  AGPL-1.0, AGPL-3.0 # <-- currently interpreted as an array

The goal of this task is to improve the arguments parsing function so that it understands "native" YAML or JSON types, in particular arrays and numbers.

policies:
  materias:
    - ref: sbom-freshness
      with: 
        limit: 15 # <-- interpreted as a number
policies:
  materials:
    - ref: sbom-banned-licenses:
      with:
        licenses:  # <-- interpreted as an array
          - AGPL-10
          - AGPL-3.0 

Note that this might imply having proper input schemas for policy specs.

jiparis avatar Sep 09 '24 08:09 jiparis