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

WIP(mesh)[SEC-1079/Do-Not-Merge]: Mesh SLSA build provenance and image signatures for verification #7231

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

saisatishkarra
Copy link
Contributor

@saisatishkarra saisatishkarra commented Apr 14, 2024

Description

  • JIRA: https://konghq.atlassian.net/browse/SEC-1079
  • Target version:
    • Image Signing and SBOM: >=2.7.4
    • Image Provenance and Binary Provenance: >=2.8.0
  • Draft /WIP: Pending official Kong Mesh release tag for specified <target_version> to verify provenance (NOT generated on preview tags / push to release branches).
  • Docs Type: Customer-facing docs

Summary

PR is focussed to allow customers to take full advantage of the recent SLSA related changes to the Kong Mesh build that implement:

  • cosign-based image signing (Image Signatures)
  • slsa-container generator based image provenance verification (Image build provenance)
  • slsa-generic generator based binary artifacts verification (Binary build provenance)

Sources

JIRA:

https://konghq.atlassian.net/browse/SEC-1018
https://konghq.atlassian.net/browse/SEC-1016

PRs:

Testing instructions

Preview link:

Checklist

For example, if this change is for an upcoming 3.6 release, enclose your content in {% if_version gte:3.6.x %} <content> {% endif_version %} tags (or if_plugin_version tags for plugins).

Use any of the following keys:

  • gte:<version> - greater than or equal to a specific version
  • lte:<version> - less than or equal to a specific version
  • eq:<version> - exactly equal to a specific version

You can do the same for older versions.

Copy link
Contributor

⚠️ Please add at least one of the following review labels to this PR:

  • review:copyedit: Request for writer review.
  • review:general: Review for general accuracy and presentation.
    Does the doc work? Does it output correctly?
  • review:tech: Request for technical review for a docs platform change.
  • review:sme: Request for review from an SME (engineer, PM, etc.).

Note: Only Kong employees can add labels due to a GitHub limitation.
If you're an OSS contributor, thank you! The maintainers will label this PR for you.

Copy link

netlify bot commented Apr 14, 2024

Deploy Preview for kongdocs ready!

Name Link
🔨 Latest commit 8881add
🔍 Latest deploy log https://app.netlify.com/sites/kongdocs/deploys/6675b51309af390008fc1496
😎 Deploy Preview https://deploy-preview-7231--kongdocs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
9 paths audited
Performance: 93 (no change from production)
Accessibility: 93 (no change from production)
Best Practices: 98 (🟢 up 8 from production)
SEO: 91 (🟢 up 1 from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@saisatishkarra saisatishkarra added blocked:kong Issues/PRs waiting on Kong PRs to merge before it can be solved do not merge Issues/ PRs whose changes should not be merged at this time labels Apr 14, 2024
@saisatishkarra saisatishkarra changed the title feat(slsa/provenance)[SEC-1079]: mesh image and provenance verification wip(slsa/provenance)[SEC-1079]: mesh image and provenance verification Apr 14, 2024
@saisatishkarra saisatishkarra changed the title wip(slsa/provenance)[SEC-1079]: mesh image and provenance verification wip(slsa/provenance)[SEC-1079]: mesh image sigs and provenance verification Apr 15, 2024
@saisatishkarra saisatishkarra changed the title wip(slsa/provenance)[SEC-1079]: mesh image sigs and provenance verification wip(slsa/provenance)[SEC-1079]: Mesh build provenance and image signatures for verification Apr 17, 2024
@saisatishkarra saisatishkarra force-pushed the feat/slsa-mesh branch 3 times, most recently from 2ef5ebf to cf4e0c5 Compare April 17, 2024 23:22
@saisatishkarra saisatishkarra force-pushed the feat/slsa-mesh branch 4 times, most recently from 9bb8c9c to d96e357 Compare June 10, 2024 21:29
app/_data/docs_nav_mesh_2.7.x.yml Show resolved Hide resolved
app/_data/docs_nav_mesh_2.7.x.yml Outdated Show resolved Hide resolved
- text: Verify Build Provenance for Signed Kong Mesh Images
url: /features/provenance-verification-images
- text: Verify Build Provenance for Signed Kong Mesh Binaries
url: /features/provenance-verification-binaries
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image provenance and binary provenance are available from 2.8.x

app/_data/tables/features/mesh.yml Show resolved Hide resolved
app/_src/mesh/features/provenance-verification-binaries.md Outdated Show resolved Hide resolved
app/_src/mesh/features/provenance-verification-binaries.md Outdated Show resolved Hide resolved
app/_src/mesh/features/provenance-verification-images.md Outdated Show resolved Hide resolved
app/_src/mesh/features/provenance-verification-images.md Outdated Show resolved Hide resolved
app/_src/mesh/features/provenance-verification-images.md Outdated Show resolved Hide resolved
app/_src/mesh/sbom.md Outdated Show resolved Hide resolved
@saisatishkarra
Copy link
Contributor Author

saisatishkarra commented Jun 10, 2024

@lahabana I would the need the following from mesh team before i can proceed with comments i posted to update <placeholder> values:

  1. Backport PR to release-2.7 branch. Refer for Context
  2. Blocked until official Kong Mesh release tag for specified <target_version> to populate assets in cloudsmith and dockerhub kong/notary
  3. @lahabana @vsofronievk Review this PR for any feedback: https://deploy-preview-7231--kongdocs.netlify.app/

@saisatishkarra to update placeholder values after the above steps are completed. This PR will then be ready for merge.

app/_src/mesh/sbom.md Outdated Show resolved Hide resolved
app/_src/mesh/sbom.md Outdated Show resolved Hide resolved
app/_src/mesh/sbom.md Outdated Show resolved Hide resolved
@saisatishkarra saisatishkarra force-pushed the feat/slsa-mesh branch 3 times, most recently from 20a3910 to 54592a5 Compare June 11, 2024 17:08
app/_src/mesh/sbom.md Outdated Show resolved Hide resolved
@saisatishkarra
Copy link
Contributor Author

@lahabana This PR is ready for review and needs only one clarification on this comment

@saisatishkarra saisatishkarra marked this pull request as ready for review June 20, 2024 19:47
@saisatishkarra saisatishkarra requested a review from a team as a code owner June 20, 2024 19:47
@saisatishkarra saisatishkarra changed the title wip(slsa/provenance)[SEC-1079]: Mesh build provenance and image signatures for verification ci(slsa/provenance)[SEC-1079]: Mesh build provenance and image signatures for verification Jun 20, 2024
@saisatishkarra saisatishkarra changed the title ci(slsa/provenance)[SEC-1079]: Mesh build provenance and image signatures for verification docs(mesh)[SEC-1079]: Mesh SLSA build provenance and image signatures for verification Jun 20, 2024
Copy link
Contributor

@lahabana lahabana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think 2 mains things are required:

  • tabs for cosign vs slsa-verifier would be much more readable.
  • Just provide things that can be copy pasted directly that's really what someone landing on this page would want.

app/_src/mesh/features/provenance-verification-binaries.md Outdated Show resolved Hide resolved
app/_src/mesh/features/provenance-verification-binaries.md Outdated Show resolved Hide resolved
--print-provenance \
--provenance-path 'kong-mesh.intoto.jsonl' \
--source-uri 'github.com/Kong/kong-mesh' \
kong-mesh-2.7.4-*-*.tar.gz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
kong-mesh-2.7.4-*-*.tar.gz
kong-mesh-{{ page.latest_version }}-*-*.tar.gz

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am using the {{page.kong_latest.version}} everywhere instead {{ page.latest_version }} which doesn't seem to work. Not sure why though.

PASSED: Verified SLSA provenance
```

### Complete example
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the actual diff for the minimal and the complete example. It just seems to have the tag in which case why just make it simple and have the complete example directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the minimalexample is the bare minimum required parameters to verify a provenance

the complete example uses is the additional options to establish more trust ex: tag from which it was generated etc.

I can remove the "minimal" example and have the "complete" as the only option to verify

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


1. Ensure `slsa-verifier` is installed.

2. [Download security assets](https://cloudsmith.io/~kong/repos/kong-mesh-binaries-release/packages/?q=name%3Asecurity-assets*+version%3A{{page.kong_latest.version}}) for the required version of {{site.mesh_product_name}} binaries
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the in-toto is not included but that's fine.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the in-toto in the security-assets is this normal?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the release tags should have the intoto.jsonl within the security-assets

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me look into this!!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lahabana The tag 2.7.4 was using the slsa provenance generator v1.10.0 instead of v2.0.0.

An improvement / breaking change to use v4 to allow downloading the artifacts during the workflow run for later jobs instead of waiting until the end of workflow run.

The step download-artifact@v4 used in the distributions to upload to cloudsmith failed to find / filter (check sreenshot for workflow warnings on GH Summary page) kong-mesh.intoto.jsonl from workflow assets since it was uploaded using an older API of actions/upload-artifacts with the issue mentioned above

The file should be published to cloudmsmith automatically in release-2.8 as it uses the version to make artifacts available to be accessible later in the workflow. NO change is needed.

Screenshot 2024-06-21 at 12 52 17 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lahabana LMK if a backport of this might is needed for 2.7.x or will later be ported automatically on the next minor version bump. Hence I am moving the doc content for for Image Provenance and Binary Provenance to be available from: '>=2.8.0'

| `<repo>` | GitHub repository | `kong-mesh` |
| `<workflow name>` | GitHub workflow name | `build-test-distribute` |
| `<workflow trigger>` | Github workflow trigger name | `push` |
| `<version>` | Artifact version to download | `2.7.4` |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use page.version


### Prerequisites

For both examples, you need to:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be simpler to use tabs. 1 for cosign, 1 for slsa-verifier I think it'd be just less confusing for users.


```sh
cosign verify-attestation \
<image>:<tag>@sha256:<manifest_digest> \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to explain to folks how to get the sha from a tag I think (docker inspect kong/kuma-cp:2.7.4 -f '{{ .RepoDigests }}')

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refer #7231 (comment). LMK if this is enough

{:.important .no-icon}
> Github owner is case-sensitive (`Kong/kong-mesh` vs `kong/kong-mesh`).

### Minimal example
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here I don't see the point of complete vs minimal. Let's just go complete always it's simpler for users.
Also I would just give something users can copy/paste so no need to have a templated example first and then the full example

app/_src/mesh/sbom.md Outdated Show resolved Hide resolved
--print-provenance \
--provenance-path 'kong-mesh.intoto.jsonl' \
--source-uri 'github.com/Kong/kong-mesh' \
kong-mesh-2.7.4-*-*.tar.gz
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am using the {{page.kong_latest.version}} everywhere instead {{ page.latest_version }} which doesn't seem to work. Not sure why though.

PASSED: Verified SLSA provenance
```

### Complete example
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the minimalexample is the bare minimum required parameters to verify a provenance

the complete example uses is the additional options to establish more trust ex: tag from which it was generated etc.

I can remove the "minimal" example and have the "complete" as the only option to verify


3. Collect the necessary image details.

4. Parse the `<manifest_digest>` for the image using `regctl`.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

app/_src/mesh/sbom.md Outdated Show resolved Hide resolved
@saisatishkarra
Copy link
Contributor Author

saisatishkarra commented Jun 21, 2024

@lahabana Due to the below issues related to provenance in 2.7.x.

  • missing provenance file intoto.jsonl for binary artifacts - (Pending fix)
  • improper notary repository for image provenance = PRThe fixes for the above only targetrelease-2.8` branch and master since 2.7.4 is already generated.

i am updating the target versions for the controls in the docs to below:

  • Image Signing and SBOM: >=2.7.4
  • Image Provenance and Binary Provenance: '>=2.8.0'

LMK if you plan on otherwise.

@@ -158,6 +163,8 @@ inherit:
url: /features/access-audit
- text: MeshGlobalRateLimit (beta)
url: /features/meshglobalratelimit
- text: Verify Signatures for Signed Kong Mesh Images
url: /features/signed-images
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed build and image provenance from 2.7.x

@@ -0,0 +1,68 @@
---
title: Verify Build Provenance for Kong Mesh Binaries
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Waiting to test until 2.8.0 is released and docs versions are updated

@@ -0,0 +1,81 @@
---
title: Verify Build Provenance for Signed Kong Mesh Images
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Waiting to test until 2.8.0 is released and docs versions are updated


```sh
cosign verify-attestation \
'kong/kuma-cp:2.8.0@<TODO_IMAGE_DIGEST>' \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait for release and replace with 2.8.0 digest


```sh
slsa-verifier verify-image \
'kong/kuma-cp:2.8.0@<TODO_IMAGE_DIGEST>' \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait and replace with 2.8.0 digest

@saisatishkarra saisatishkarra changed the title docs(mesh)[SEC-1079]: Mesh SLSA build provenance and image signatures for verification WIP(mesh)[SEC-1079/Do-Not-Merge]: Mesh SLSA build provenance and image signatures for verification Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked:kong Issues/PRs waiting on Kong PRs to merge before it can be solved do not merge Issues/ PRs whose changes should not be merged at this time
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants