feat(policy): add witness policy generate command#697
Open
manzil-infinity180 wants to merge 4 commits intoin-toto:mainfrom
Open
feat(policy): add witness policy generate command#697manzil-infinity180 wants to merge 4 commits intoin-toto:mainfrom
witness policy generate command#697manzil-infinity180 wants to merge 4 commits intoin-toto:mainfrom
Conversation
Signed-off-by: Rahul Vishwakarma <rahulvs2809@gmail.com>
✅ Deploy Preview for witness-project ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Signed-off-by: Rahul Vishwakarma <rahulvs2809@gmail.com>
Signed-off-by: Rahul Vishwakarma <rahulvs2809@gmail.com>
Signed-off-by: Rahul Vishwakarma <rahulvs2809@gmail.com>
Contributor
Author
|
Another example $ ../bin/witness policy generate \
--step "build" \
--root-ca "build=rootca.pem" \
--expires-in "720h" \
--attestation "build=slsa" \
--output policy-rootca-single.json
INFO Generating Witness policy...
INFO Processing step: build
INFO Policy successfully generated: policy-rootca-single.json
INFO Policy expires: 2026-01-17T01:25:14+05:30
INFO Steps: 1
INFO Public keys: 0
INFO Root CAs: 1 $ ../bin/witness policy check policy-rootca-single.json -v
INFO Validating policy: policy-rootca-single.json
INFO Reading policy file...
INFO Valid JSON structure
INFO Policy expires: 2026-01-17T01:25:14+05:30
INFO Checking policy expiration...
INFO Policy valid until 2026-01-17 (29 days)
WARNING Warning: Policy expires in 29 days
INFO Validating Rego policies...
INFO Validated 0 Rego module(s)
INFO Validating functionaries...
INFO Root '422a97dfaf9398124e846f07748b6be2136a13212f975ae3df9c78a72d14cb1b' exists for step 'build'
INFO Validated 1 functionary root reference(s)
INFO Validating root certificates...
INFO Checking root certificate '422a97dfaf9398124e846f07748b6be2136a13212f975ae3df9c78a72d14cb1b'...
INFO Valid x509 certificate (CN=Root CA)
INFO Root certificate '422a97dfaf9398124e846f07748b6be2136a13212f975ae3df9c78a72d14cb1b' is valid
INFO Validated 1 root certificate(s)
INFO Policy validation successful!
INFO Summary:
INFO Total checks: 10
INFO Passed: 10
INFO Failed: 0
WARNING Warnings: 1$ ../bin/witness run \
--step build \
--signer-file-cert-path signer.pem \
--signer-file-key-path signer-key.pem \
-a slsa \
-o attestation-build-root-ca.json \
-- go build -o testapp main.go
INFO Starting prematerial attestors stage...
INFO Completed prematerial attestors stage...
INFO Starting material attestors stage...
INFO Starting material attestor...
INFO Finished material attestor... (0.011555875s)
INFO Completed material attestors stage...
INFO Starting execute attestors stage...
INFO Starting command-run attestor...
INFO Finished command-run attestor... (0.381696625s)
INFO Completed execute attestors stage...
INFO Starting product attestors stage...
INFO Starting product attestor...
INFO Finished product attestor... (0.003569166s)
INFO Completed product attestors stage...
INFO Starting postproduct attestors stage...
INFO Starting slsa attestor...
WARNING No build system attestor invoked. Consider using github, gitlab, jenkins, or aws-codebuild attestors (if appropriate) to enrich your SLSA provenance
INFO Finished slsa attestor... (3.4667e-05s)
INFO Completed postproduct attestors stage... $ ../bin/witness verify \
-p policy-rootca-single-signed.json \
--attestations attestation-build-root-ca.json \
-k policy-pub.pem \
-f testapp
INFO Starting verify attestors stage...
INFO Starting policyverify attestor...
INFO policy signature verified
INFO Finished policyverify attestor... (0.003267458s)
INFO Completed verify attestors stage...
INFO Verification succeeded
INFO Evidence:
INFO Step: build
INFO 0: attestation-build-root-ca.json
INFO 1: attestation-build-root-ca.json
INFO 2: attestation-build-root-ca.json
test-policy (feat/witness-policy-create-cmd) $ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it
Description
We already have the
witness policy checkcommand #681 , so adding it to generate the policy will improve the user experiences.By this pr we completed these things:
Policy Creation and Validation: Capability within witness policy to create and validate policy files.from the issue #344Which issue(s) this PR fixes (optional)
Partial Fix #344
Example:
TODO:
Acceptance Criteria Met
Special notes for your reviewer: