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

README and docs restructure #362

Merged
merged 61 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
41335ef
starting proposed restructure
ChaosInTheCRD Dec 12, 2023
43375bd
adding latest changes to README
ChaosInTheCRD Dec 13, 2023
0a0280f
fixed link to contributing md
ChaosInTheCRD Dec 13, 2023
03fada4
made title title heading size
ChaosInTheCRD Dec 13, 2023
96ab9df
named the file wrong - doh
ChaosInTheCRD Dec 13, 2023
68c38e1
resizing headings at top
ChaosInTheCRD Dec 13, 2023
ab1628f
added spacing
ChaosInTheCRD Dec 13, 2023
142a017
a few more fixes
ChaosInTheCRD Dec 13, 2023
03cd875
adding background section
ChaosInTheCRD Dec 13, 2023
a5c2cec
removing bullet
ChaosInTheCRD Dec 13, 2023
d70b8a0
final neatening
ChaosInTheCRD Dec 13, 2023
545e3b0
updated docs further - tutorial not working
ChaosInTheCRD Dec 14, 2023
0c0618d
adding demo gif
ChaosInTheCRD Dec 15, 2023
bbee6c2
adding docusaurus stuff and more progress
ChaosInTheCRD Dec 19, 2023
7603bf2
saving progress, including docusaurus website
ChaosInTheCRD Dec 20, 2023
c643b9d
changing logo
ChaosInTheCRD Dec 20, 2023
1922341
adding snowfall
ChaosInTheCRD Dec 21, 2023
a335e30
adding the concepts section
ChaosInTheCRD Jan 2, 2024
1ca4e7f
Adding the contributing.md from archivista (#327)
ChaosInTheCRD Jan 19, 2024
5fc24e7
Migrating go module (#328)
ChaosInTheCRD Dec 15, 2023
b2c373d
Migrating to the use of in-toto/go-witness module (#331)
ChaosInTheCRD Dec 15, 2023
f900d61
Bumping Go version for goreleaser (#333)
ChaosInTheCRD Dec 15, 2023
5506a27
chore: bump actions/download-artifact from 3.0.2 to 4.0.0 (#335)
dependabot[bot] Dec 19, 2023
b7c9ba5
chore: bump github/codeql-action from 2.22.9 to 3.22.11 (#336)
dependabot[bot] Dec 19, 2023
31591ec
chore: bump actions/upload-artifact from 3.1.3 to 4.0.0 (#337)
dependabot[bot] Dec 19, 2023
4f669ed
chore: bump github/codeql-action from 3.22.11 to 3.22.12 (#343)
dependabot[bot] Jan 2, 2024
25f7c82
chore: bump actions/download-artifact from 4.0.0 to 4.1.0 (#342)
dependabot[bot] Jan 2, 2024
ffecc71
moving config doc
ChaosInTheCRD Jan 3, 2024
604c3cb
adding latest changes
ChaosInTheCRD Jan 3, 2024
fc067bc
saving progress
ChaosInTheCRD Jan 4, 2024
3cbcb83
adding keyless signing tutorial
ChaosInTheCRD Jan 4, 2024
d73b2c0
doing images
ChaosInTheCRD Jan 4, 2024
f823fef
fixing broken image
ChaosInTheCRD Jan 4, 2024
5ed9700
changing url
ChaosInTheCRD Jan 4, 2024
1603131
fixed images
ChaosInTheCRD Jan 4, 2024
af4cc5b
updating docs and removing witness.md
ChaosInTheCRD Jan 5, 2024
4711a0e
Update go-git to resolve vulnerability (#346)
jkjell Jan 3, 2024
f934774
chore: bump actions/dependency-review-action from 3.1.4 to 3.1.5 (#349)
dependabot[bot] Jan 8, 2024
806bdda
Add FOSSA license scanning
jkjell Jan 6, 2024
b7d2e92
Add Security MD files an add FOSSA scan badge
ChaosInTheCRD Jan 19, 2024
d67015c
Pin dependencies and restrict permissions
jkjell Jan 6, 2024
9983e7f
Add signing to goreleaser and Best Practices badge to readme.
ChaosInTheCRD Jan 19, 2024
1942218
Add cosign install
jkjell Jan 6, 2024
7d0ae70
Update cloudflare/circl due to dependabot failure (#352)
jkjell Jan 10, 2024
5ee544d
updated package json
ChaosInTheCRD Jan 12, 2024
c3af51d
chore: bump actions/cache from 3.3.2 to 3.3.3 (#355)
dependabot[bot] Jan 16, 2024
87ff0e1
chore: bump actions/upload-artifact from 4.0.0 to 4.1.0 (#356)
dependabot[bot] Jan 16, 2024
249e5aa
chore: bump github/codeql-action from 3.22.12 to 3.23.0 (#357)
dependabot[bot] Jan 16, 2024
647b6dd
chore: bump actions/download-artifact from 4.1.0 to 4.1.1 (#358)
dependabot[bot] Jan 16, 2024
604b6b4
Initial attempt at PR and Issue templates (#351)
jkjell Jan 17, 2024
8c7b796
Checking attestors for duplicates (#361)
ChaosInTheCRD Jan 17, 2024
b15e4e6
removing witness website for now
ChaosInTheCRD Jan 19, 2024
8478623
Merge branch 'main' of github.com:in-toto/witness into readme-docs-re…
ChaosInTheCRD Jan 19, 2024
c51520f
editing image links
ChaosInTheCRD Jan 19, 2024
ee81560
updating docgen
ChaosInTheCRD Jan 22, 2024
07490b1
fixing docgen
ChaosInTheCRD Jan 22, 2024
3988348
addressing comments
ChaosInTheCRD Jan 23, 2024
84069e8
Merge branch 'main' into readme-docs-restructure
ChaosInTheCRD Jan 23, 2024
1f4e9d1
fixing small issue with md
ChaosInTheCRD Jan 23, 2024
c4dede3
Merge branch 'readme-docs-restructure' of github.com:ChaosInTheCRD/wi…
ChaosInTheCRD Jan 23, 2024
c8b4137
fixed ellipsis
ChaosInTheCRD Jan 23, 2024
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
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ taking the time to contribute!

Before starting, please take some time to familiarize yourself with the [Code of Conduct](CODE_OF_CONDUCT.md).


## Getting Started

We welcome many different types of contributions and not all of them need a
Expand Down
78 changes: 0 additions & 78 deletions CONTRIBUTORS.md

This file was deleted.

381 changes: 53 additions & 328 deletions README.md

Large diffs are not rendered by default.

29 changes: 25 additions & 4 deletions docgen/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
package main

import (
"bytes"
"flag"
"log"
"fmt"
"os"

"github.com/in-toto/witness/cmd"
"github.com/spf13/cobra/doc"
Expand All @@ -30,8 +32,27 @@ func init() {
}

func main() {
// Generate CLI docs
if err := doc.GenMarkdownTree(cmd.New(), directory); err != nil {
log.Fatalf("Error generating docs: %s", err)
mdContent := "# Witness CLI Reference\n\nThis is the reference for the Witness command line tool, generated by [Cobra](https://cobra.dev/).\n\n"
// Generate markdown content for all commands
for _, command := range cmd.New().Commands() {
// We are not generating docs for the completion command right now, as it doesn't render in Markdown correctly
if command.Use == "completion [bash|zsh|fish|powershell]" {
continue
}

buf := new(bytes.Buffer)
err := doc.GenMarkdown(command, buf)
if err != nil {
fmt.Println("Error generating markdown for command:", command.Use)
continue
}
mdContent += buf.String()
}

// Write the combined markdown content to a file
err := os.WriteFile(fmt.Sprintf("%s/commands.md", directory), []byte(mdContent), 0644)
Comment on lines +52 to +53
Copy link
Member

Choose a reason for hiding this comment

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

Does having separate files make rendering on the new docs website easier?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So again docs website related. I actually felt it was neater to present all the commands on a single page. This is something we can discuss / consider further though 😄 .

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good. Ship it for now, and we can revisit based on feedback after the new site is up.

if err != nil {
fmt.Println("Error writing to file:", err)
os.Exit(1)
}
}
2 changes: 1 addition & 1 deletion docgen/verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ set -e
# Verify that generated Markdown docs are up-to-date.
tmpdir=$(mktemp -d)
tmpdir2=$(mktemp -d)
cp docs/witness*.md "$tmpdir2/"
cp docs/commands.md "$tmpdir2/"
go run ./docgen --dir "$tmpdir"
echo "###########################################"
echo "If diffs are found, run: make docgen"
Expand Down
11 changes: 11 additions & 0 deletions docs/about/how-witness-works.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# How Witness Works

### Signing
Witness is able to observe your software development life-cycle (SDLC) by wrapping around commands executed within them. By passing any command to Witness as an argument, the tool is able to understand what was executed but also on what infrastructure, by what user or service account and more. The information that Witness gathers while the command is running is down to which [Attestors](docs/attestor.md) are used. Attestors are implementations of an interface that find and assert facts about the system Witness is running on (e.g., [AWS Attestor](docs/attestors/aws-iid.md)). Finally, Witness can compile this information into an [in-toto attestation](https://github.com/in-toto/attestation), place it in a [DSSE Envelope](https://github.com/secure-systems-lab/dsse) and sign that envelope with the key that was supplied by the user.

### Storing
For storage, the Witness project can upload signed attestations to an [Archivista](https://github.com/in-toto/archivista) server, a graph and storage service for in-toto attestations. This enables the discovery and retrieval of attestations for verification of software artifacts.

### Verifying
Witness allows users to verify the attestations that they generate by providing the `witness verify` command. To achieve this, Witness uses a [policy file](./docs/policy.md) defined by the user to check for presence of the expected attestations and that they were signed by the appropriate functionaries (Public keys or roots of trust that are trusted to sign certain types of attestation). To verify the attestation body itself, Witness supports defining [OPA Rego](https://www.openpolicyagent.org/docs/latest/policy-language/) policies inside the policy file. This allows users to ensure the facts asserted by the Attestors are reported expected.

Binary file added docs/assets/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion docs/attestor.md

This file was deleted.

175 changes: 175 additions & 0 deletions docs/commands.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
# Witness CLI Reference

This is the reference for the Witness command line tool, generated by [Cobra](https://cobra.dev/).

## witness run

Runs the provided command and records attestations about the execution

```
witness run [cmd] [flags]
```

### Options

```
--archivista-server string URL of the Archivista server to store or retrieve attestations (default "https://archivista.testifysec.io")
-a, --attestations strings Attestations to record ('product' and 'material' are always recorded) (default [environment,git])
--attestor-product-exclude-glob string Pattern to use when recording products. Files that match this pattern will be excluded as subjects on the attestation.
--attestor-product-include-glob string Pattern to use when recording products. Files that match this pattern will be included as subjects on the attestation. (default "*")
--enable-archivista Use Archivista to store or retrieve attestations
--hashes strings Hashes selected for digest calculation. Defaults to SHA256 (default [sha256])
-h, --help help for run
-o, --outfile string File to which to write signed data. Defaults to stdout
--signer-file-cert-path string Path to the file containing the certificate for the private key
--signer-file-intermediate-paths strings Paths to files containing intermediates required to establish trust of the signer's certificate to a root
-k, --signer-file-key-path string Path to the file containing the private key
--signer-fulcio-oidc-client-id string OIDC client ID to use for authentication
--signer-fulcio-oidc-issuer string OIDC issuer to use for authentication
--signer-fulcio-oidc-redirect-url string OIDC redirect URL (Optional). The default oidc-redirect-url is 'http://localhost:0/auth/callback'.
--signer-fulcio-token string Raw token string to use for authentication to fulcio (cannot be used in conjunction with --fulcio-token-path)
--signer-fulcio-token-path string Path to the file containing a raw token to use for authentication to fulcio (cannot be used in conjunction with --fulcio-token)
--signer-fulcio-url string Fulcio address to sign with
--signer-spiffe-socket-path string Path to the SPIFFE Workload API Socket
--signer-vault-altnames strings Alt names to use for the generated certificate. All alt names must be allowed by the vault role policy
--signer-vault-commonname string Common name to use for the generated certificate. Must be allowed by the vault role policy
--signer-vault-namespace string Vault namespace to use
--signer-vault-pki-secrets-engine-path string Path to the Vault PKI Secrets Engine to use (default "pki")
--signer-vault-role string Name of the Vault role to generate the certificate for
--signer-vault-token string Token to use to connect to Vault
--signer-vault-ttl duration Time to live for the generated certificate. Defaults to the vault role policy's configured TTL if not provided
--signer-vault-url string Base url of the Vault instance to connect to
-s, --step string Name of the step being run
--timestamp-servers strings Timestamp Authority Servers to use when signing envelope
--trace Enable tracing for the command
-d, --workingdir string Directory from which commands will run
```

### Options inherited from parent commands

```
-c, --config string Path to the witness config file (default ".witness.yaml")
-l, --log-level string Level of logging to output (debug, info, warn, error) (default "info")
```

### SEE ALSO

* [witness](witness.md) - Collect and verify attestations about your build environments

## witness sign

Signs a file

### Synopsis

Signs a file with the provided key source and outputs the signed file to the specified destination

```
witness sign [file] [flags]
```

### Options

```
-t, --datatype string The URI reference to the type of data being signed. Defaults to the Witness policy type (default "https://witness.testifysec.com/policy/v0.1")
-h, --help help for sign
-f, --infile string Witness policy file to sign
-o, --outfile string File to write signed data. Defaults to stdout
--signer-file-cert-path string Path to the file containing the certificate for the private key
--signer-file-intermediate-paths strings Paths to files containing intermediates required to establish trust of the signer's certificate to a root
-k, --signer-file-key-path string Path to the file containing the private key
--signer-fulcio-oidc-client-id string OIDC client ID to use for authentication
--signer-fulcio-oidc-issuer string OIDC issuer to use for authentication
--signer-fulcio-oidc-redirect-url string OIDC redirect URL (Optional). The default oidc-redirect-url is 'http://localhost:0/auth/callback'.
--signer-fulcio-token string Raw token string to use for authentication to fulcio (cannot be used in conjunction with --fulcio-token-path)
--signer-fulcio-token-path string Path to the file containing a raw token to use for authentication to fulcio (cannot be used in conjunction with --fulcio-token)
--signer-fulcio-url string Fulcio address to sign with
--signer-spiffe-socket-path string Path to the SPIFFE Workload API Socket
--signer-vault-altnames strings Alt names to use for the generated certificate. All alt names must be allowed by the vault role policy
--signer-vault-commonname string Common name to use for the generated certificate. Must be allowed by the vault role policy
--signer-vault-namespace string Vault namespace to use
--signer-vault-pki-secrets-engine-path string Path to the Vault PKI Secrets Engine to use (default "pki")
--signer-vault-role string Name of the Vault role to generate the certificate for
--signer-vault-token string Token to use to connect to Vault
--signer-vault-ttl duration Time to live for the generated certificate. Defaults to the vault role policy's configured TTL if not provided
--signer-vault-url string Base url of the Vault instance to connect to
--timestamp-servers strings Timestamp Authority Servers to use when signing envelope
```

### Options inherited from parent commands

```
-c, --config string Path to the witness config file (default ".witness.yaml")
-l, --log-level string Level of logging to output (debug, info, warn, error) (default "info")
```

### SEE ALSO

* [witness](witness.md) - Collect and verify attestations about your build environments

## witness verify

Verifies a witness policy

### Synopsis

Verifies a policy provided key source and exits with code 0 if verification succeeds

```
witness verify [flags]
```

### Options

```
--archivista-server string URL of the Archivista server to store or retrieve attestations (default "https://archivista.testifysec.io")
-f, --artifactfile string Path to the artifact to verify
-a, --attestations strings Attestation files to test against the policy
--enable-archivista Use Archivista to store or retrieve attestations
-h, --help help for verify
-p, --policy string Path to the policy to verify
--policy-ca strings Paths to CA certificates to use for verifying the policy
-k, --publickey string Path to the policy signer's public key
-s, --subjects strings Additional subjects to lookup attestations
```

### Options inherited from parent commands

```
-c, --config string Path to the witness config file (default ".witness.yaml")
-l, --log-level string Level of logging to output (debug, info, warn, error) (default "info")
```

### SEE ALSO

* [witness](witness.md) - Collect and verify attestations about your build environments

## witness version

Prints out the witness version

### Synopsis

Prints out the witness version

```
witness version [flags]
```

### Options

```
-h, --help help for version
```

### Options inherited from parent commands

```
-c, --config string Path to the witness config file (default ".witness.yaml")
-l, --log-level string Level of logging to output (debug, info, warn, error) (default "info")
```

### SEE ALSO

* [witness](witness.md) - Collect and verify attestations about your build environments

27 changes: 27 additions & 0 deletions docs/concepts/attestor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Attestors

A Witness attestor is a programming interface that defines an object that can assert facts about a system and store those facts in a versioned schema. An attestor has a `Name`, `Type` and `RunType`. The `Type` is a versioned string corresponding to the JSON schema of the attestation. For example, the AWS attestor is defined as follows:
```
Name = "aws"
Type = "https://witness.dev/attestations/aws/v0.1"
RunType = attestation.PreRunType
```
Attestation types are leveraged to ensure the correct version schema is used when we evaluate policy against these attestations.

## Attestor Security Model

Attestations are only as secure as the data that feeds them. Where possible cryptographic material should be validated, evidence of validation should be included in the attestation for out-of-band validation.

Examples of cryptographic validation is found in the [GCP](https://github.com/testifysec/witness/tree/main/pkg/attestation/gcp-iit), [AWS](https://github.com/testifysec/witness/blob/main/pkg/attestation/aws-iid/aws-iid.go), and [GitLab](https://github.com/testifysec/witness/tree/main/pkg/attestation/gitlab) attestors.

## Attestor Life Cycle

- **Pre-material:** Pre-material attestors run before any other attestors. These attestors generally collect information about the environment.

- **Material:** Material attestors run after any prematerial attestors and prior to any execute attestors. Generally these collect information about state that may change after any execute attestors, such as file hashes.

- **Execute:**: Execute attestors run after any material attestors and generally record information about some command or process that is to be executed.

- **Product:** Product attestors run after any execute attestors and generally record information about what changed during the execute lifecycle step, such as changed or created files.

- **Post-product:** Post-product attestors run after product attestors and generally record some additional information about specific products, such as OCI image information from a saved image tarball.
Loading