diff --git a/getting_started/attestations.md b/getting_started/attestations.md index 0102f2b..46e6913 100644 --- a/getting_started/attestations.md +++ b/getting_started/attestations.md @@ -172,7 +172,7 @@ All `kosli attest` commands support flags for attaching additional data. These f |------|-------------|---------| | `--user-data` | All evidence attest commands | Attach structured JSON metadata that is stored and visible alongside the attestation in the Kosli UI | | `--attachments` | All evidence attest commands | Upload files or directories to the Evidence Vault as compressed archives for later download | -| `--attestation-data` | `attest custom` only | Provide the JSON payload that the custom type's jq rules evaluate to determine compliance | +| `--attestation-data` | `attest custom` only | Provide the JSON or YAML file that the custom type's jq rules evaluate to determine compliance | | `--annotate` | All evidence attest commands | Attach `key=value` annotations that are displayed as a label/value pair on the attestation in the Kosli UI | ### When to use which @@ -205,12 +205,20 @@ kosli attest generic \ --attachments scan-report.html,scan-config.yml ``` -Use **`--attestation-data`** on `kosli attest custom` to provide the JSON data that the custom +Use **`--attestation-data`** on `kosli attest custom` to provide the data that the custom attestation type's jq expression evaluates. This is what determines the compliance status of the attestation. See the [Custom](#custom) attestation type below for details. -The `--attestation-data` JSON payload sent to Kosli is limited to 1 MB; larger payloads fail with a -400 error. For larger reports, distill the data you need into a summary and attach the full document +The file can be JSON or YAML. The CLI picks the format from the file extension: it converts a +`.yaml` or `.yml` file to JSON before sending it, and reads any other file as JSON. YAML reads an +unquoted number with a leading zero as octal (`0644` becomes `420`) and drops trailing zeros from +decimals (`1.10` becomes `1.1`), so quote version-like values and codes (`"1.10"`, `"0123"`) +to keep them as written. A YAML file with several documents needs `--attestation-data-as-list`, +which sends the documents as a JSON list. See +[`kosli attest custom`](/client_reference/kosli_attest_custom) for the full conversion rules. + +The `--attestation-data` JSON payload sent to Kosli is limited to 1 MB, measured after any YAML +conversion; larger payloads fail with a 400 error. For larger reports, distill the data you need into a summary and attach the full document separately — see [Attesting large documents](/tutorials/attest_large_documents). ```shell diff --git a/tutorials/attest_custom.md b/tutorials/attest_custom.md index 9c67865..984542d 100644 --- a/tutorials/attest_custom.md +++ b/tutorials/attest_custom.md @@ -44,6 +44,8 @@ Prepare a JSON file with the data you want to attest. Save it as `coverage.json` In every example below, this `coverage.json` is the value of `--attestation-data`. +`--attestation-data` also accepts a `.yaml` or `.yml` file, which the CLI converts to JSON before sending it. + ## 2. Report the attestation A custom attestation can be bound to either a **trail** or an **artifact**. Pick the option that matches what you want to attest about.