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

doc: CLI spec for trust policy management (DO NOT REVIEW) #505

Closed
wants to merge 10 commits into from

Conversation

yizha1
Copy link
Contributor

@yizha1 yizha1 commented Jan 12, 2023

Update:

  • Introduce new CLI command to manage trust policy

Signed-off-by: Yi Zha yizha1@microsoft.com

Signed-off-by: Yi Zha <yizha1@microsoft.com>
@codecov-commenter
Copy link

codecov-commenter commented Jan 12, 2023

Codecov Report

Merging #505 (f72dea3) into main (1281179) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #505   +/-   ##
=======================================
  Coverage   29.57%   29.57%           
=======================================
  Files          26       26           
  Lines        1515     1515           
=======================================
  Hits          448      448           
  Misses       1050     1050           
  Partials       17       17           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Signed-off-by: Yi Zha <yizha1@microsoft.com>
Signed-off-by: Yi Zha <yizha1@microsoft.com>
Signed-off-by: Yi Zha <yizha1@microsoft.com>
Signed-off-by: Yi Zha <yizha1@microsoft.com>
Signed-off-by: Yi Zha <yizha1@microsoft.com>
Signed-off-by: Yi Zha <yizha1@microsoft.com>
@yizha1 yizha1 marked this pull request as ready for review January 14, 2023 05:45
@yizha1 yizha1 added documentation Improvements or additions to documentation spec Specifications to define the product requirements labels Jan 14, 2023
@yizha1 yizha1 modified the milestones: RC-3, RC-2 Jan 14, 2023
@yizha1 yizha1 self-assigned this Jan 14, 2023
Signed-off-by: Yi Zha <yizha1@microsoft.com>
Signed-off-by: Yi Zha <yizha1@microsoft.com>
Signed-off-by: Yi Zha <yizha1@microsoft.com>

An example of `trustpolicy.json`:

```json
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need json example in this doc when we already have link to specification which contains similar json?

Suggested change
```json
```jsonc

"level": "strict"
"override" : {
"expiry" : "log",
"authenticity": "log"
Copy link
Contributor

Choose a reason for hiding this comment

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

A couple of suggestions, if we want to display policy in this doc:

  1. First example should be simple and should not contain overrides.
  2. For override, please only show expiry. Adding override for authenticity has major security implications.
  3. Prod trust policy should be first and then dev
  4. We should show wildcard policy

--scope stringArray repository URIs to which the policy applies (default ["*"])
--trust-store stringArray trust stores in format "<trust_store_type>:<trust_store_name>"
--verification-level string verification level, options: "strict", "permissive", "audit", "skip" (default "strict")
--x509-cert stringArray paths to x509 certificate file that certificate subject is retrieved from
Copy link
Contributor

Choose a reason for hiding this comment

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

How are expecting user to use use --x509-cert? IMO software publisher will distribute software and share the identity(not the certificate) that consumer needs to trust.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@priteshbandi The --x509-cert here is designed for one scenario: Users have the certificate file, not the identity, then with this flag, notation policy command can retrieve the identity from the certificate file for the users. One question for your case: If it is the identity shared to users, how can users add certificate file using notation cert add command?

--trust-store stringArray trust stores in format "<trust_store_type>:<trust_store_name>"
--verification-level string verification level, options: "strict", "permissive", "audit", "skip" (default "strict")
--x509-cert stringArray paths to x509 certificate file that certificate subject is retrieved from
--x509-id stringArray trust identities, user trusted x509 certificate subjects
Copy link
Contributor

Choose a reason for hiding this comment

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

should we rename this to --trusted-identity

### notation policy delete

```text
Delete trust policies. User cannot delete all the trust policies, at least one trust policy should be configured for signature verification.
Copy link
Contributor

Choose a reason for hiding this comment

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

user cannot delete all the trust policies, at least one trust policy should be configured for signature verification.
Instead of restricting it should add a disclaimer that for signature verification, notation needs at least one trust-policy?


The execution fails in one of below cases:

- Version doesn't support. Currently only `1.0` version is supported.
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
- Version doesn't support. Currently only `1.0` version is supported.
- Unsupported Version. Currently only `1.0` version is supported.

The execution fails in one of below cases:

- Version doesn't support. Currently only `1.0` version is supported.
- The trust policy name exists.
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
- The trust policy name exists.
- A trust policy with same name already exists.

Comment on lines +212 to +224

```json
{
"name": "wabbit-networks-dev",
"registryScopes": [ "*" ],
"signatureVerification": {
"level": "strict"
},
"trustStores": [ "ca:wabbit-networks-dev" ],
"trustedIdentities": [
"*"
]
}
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO we don't need to display both json and text format for each variation of a command, its making doc large and doesnt adds much value.

Comment on lines +414 to +419
- Version doesn't support. Currently only `1.0` version is supported.
- The trust policy name doesn't exists.
- More than one trust policy that uses a global scope, that is, the value of `registryScopes` is `["*"]`.
- The values of `trustIdentities` overlap. For example, the following two identity values are overlapping:
- "C=US, ST=WA, O=wabbit-network.io, OU=org1"
- "C=US, ST=WA, O=wabbit-network.io"
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO this is redundant information and can be removed.

Comment on lines +436 to +440
name: wabbit-network-dev
registryScopes: ["dev.wabbitnetworks.io/net-monitor"]

name: wabbit-network-prod
registryScopes: ["prod.wabbitnetworks.io/net-monitor"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we use tree based representation here?

Comment on lines 15 to 17
| [plugin](./commandline/plugin.md) | Manage plugins |
| [policy](./commandline/policy.md) | Manage trust policies |
| [sign](./commandline/sign.md) | Sign artifacts |
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
| [plugin](./commandline/plugin.md) | Manage plugins |
| [policy](./commandline/policy.md) | Manage trust policies |
| [sign](./commandline/sign.md) | Sign artifacts |
| [plugin](./commandline/plugin.md) | Manage plugins |
| [policy](./commandline/policy.md) | Manage trust policies |
| [sign](./commandline/sign.md) | Sign artifacts |


Upon successful execution, the added trust policy is printed out. For example:

In text format
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we really need text format for the notation policy command set? To be honest, the text format is less readable than the json format for a human.

list, ls

Flags:
--details list the details of trust policies
Copy link
Contributor

Choose a reason for hiding this comment

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

We could have something like --raw or --export to print the trustpolicy.json file directly.

@yizha1 yizha1 removed this from the RC-2 milestone Feb 13, 2023
@yizha1
Copy link
Contributor Author

yizha1 commented Feb 13, 2023

Based on the community discussion, move this PR out of rc.2, and I will update it to phase-1 later for rc.3

@yizha1 yizha1 changed the title doc: CLI spec for trust policy management doc: CLI spec for trust policy management (DO NOT REVIEW) Feb 25, 2023
@yizha1 yizha1 closed this Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation spec Specifications to define the product requirements
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants