Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ LDFLAGS += -extldflags "-static"

help: ## Show this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n\nTargets:\n"} \
/^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } \
/^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-21s\033[0m %s\n", $$1, $$2 } \
/^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) }' $(MAKEFILE_LIST)

ldflags: ## Print ldflags
Expand Down
22 changes: 11 additions & 11 deletions cmd/kosli/createAttestationType.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,35 @@ You can specify attestation type parameters in flags.

^TYPE-NAME^ must start with a letter or number, and only contain letters, numbers, ^.^, ^-^, ^_^, and ^~^.

^--schema^ is a path to a file containing a JSON schema which will be used to validate attestations made using this type.
The schema is used to specify the structure of the attestation data, e.g. any fields that are required or
^--schema^ is a path to a file containing a JSON schema which will be used to validate attestations made using this type.
The schema is used to specify the structure of the attestation data, e.g. any fields that are required or
the expected type of the data.
See an example schema file
See an example schema file
[here](https://github.com/cyber-dojo/kosli-attestation-types/blob/f9130c58d3a8151b0b0e7c5db284e4380eb2d2cf/metrics-coverage.schema.json).

^--jq^ defines an evaluation rule, given in jq-format, for this attestation type. The flag can be repeated in order to add additional rules.
These rules specify acceptable values for attestation data, e.g. ^.age >= 21^ or ^.failing_tests == 0^.
When a custom attestation is reported, the provided data is evaluated according to the rules defined in its attestation-type.
^--jq^ defines an evaluation rule, given in ^jq^-format, for this attestation type. The flag can be repeated in order to add additional rules.
These rules specify acceptable values for attestation data, e.g. ^.age >= 21^ or ^.failing_tests == 0^.
When a custom attestation is reported, the provided data is evaluated according to the rules defined in its attestation-type.
All rules must return ^true^ for the evaluation to pass and the attestation to be determined compliant.

^--summary^ defines one entry of the summary shown for attestations of this type, given as
^'NAME=EXPRESSION'^ where the expression is a jq expression evaluated against the attestation data.
^'NAME=EXPRESSION'^ where the expression is a ^jq^ expression evaluated against the attestation data.
The flag can be repeated to add further entries, which are displayed in the order given, e.g.
^--summary "Critical=.critical_count" --summary "Tool=.scanner.name"^.
Each value is split on its first ^=^ only, so jq expressions containing ^==^ are unaffected.
Each value is split on its first ^=^ only, so ^jq^ expressions containing ^==^ are unaffected.

^--summary-json^ is an alternative to ^--summary^ for summaries that are easier to express as JSON,
given as a JSON array of ^{"name": ..., "expression": ...}^ entries, e.g.
^'[{"name":"Critical","expression":".critical_count"}]'^. The two summary flags cannot be combined.

Attestation types created without a summary fall back to the jq evaluation rules checklist.
Attestation types created without a summary fall back to the ^jq^ evaluation rules checklist.
`

const createAttestationTypeExample = `
# create/update a custom attestation type with no schema no evaluation rules:
kosli create attestation-type customTypeName
kosli create attestation-type customTypeName

# create/update a custom attestation type with schema and jq evaluation rules:
# create/update a custom attestation type with schema and ^jq^ evaluation rules:
kosli create attestation-type customTypeName \
--description "Attest that a person meets the age requirements." \
--schema person-schema.json \
Expand Down