Skip to content

Commit 25e0ad4

Browse files
authored
Restructure documentation (#1255)
* Draft a POLICY Signed-off-by: Alexis <[email protected]> * Update documentation Signed-off-by: Alexis <[email protected]> * Add missing license Signed-off-by: Alexis <[email protected]> * Remove pdoc dependency Signed-off-by: Alexis <[email protected]> * Update documentation Signed-off-by: Alexis <[email protected]> * Improve documentation Signed-off-by: Alexis <[email protected]> * Explicit failure reasons Signed-off-by: Alexis <[email protected]> * Remove API folder * Add api folder * Update policy.md Signed-off-by: Alexis <[email protected]> * Remove API folder Signed-off-by: Alexis <[email protected]> * Add api folder Signed-off-by: Alexis <[email protected]> * Update policy.md Signed-off-by: Alexis <[email protected]> --------- Signed-off-by: Alexis <[email protected]>
1 parent 6a98ddd commit 25e0ad4

25 files changed

+742
-252
lines changed

.github/workflows/docs.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ jobs:
1515

1616
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
1717
with:
18-
# NOTE: We use 3.10+ typing syntax via future, which pdoc only
19-
# understands if it's actually run with Python 3.10 or newer.
20-
python-version: ">= 3.10"
18+
python-version: "3.x"
2119
cache: "pip"
2220
cache-dependency-path: pyproject.toml
2321

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.cache/
12
env/
23
pip-wheel-metadata/
34
*.egg-info/

Makefile

+6-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ SHELL := /bin/bash
33
PY_MODULE := sigstore
44

55
ALL_PY_SRCS := $(shell find $(PY_MODULE) -name '*.py') \
6-
$(shell find test -name '*.py')
6+
$(shell find test -name '*.py') \
7+
$(shell find docs/scripts -name '*.py') \
78

89
# Optionally overriden by the user, if they're using a virtual environment manager.
910
VENV ?= env
@@ -67,7 +68,8 @@ lint: $(VENV)/pyvenv.cfg
6768
ruff check $(ALL_PY_SRCS) && \
6869
mypy $(PY_MODULE) && \
6970
bandit -c pyproject.toml -r $(PY_MODULE) && \
70-
interrogate --fail-under 100 -c pyproject.toml $(PY_MODULE)
71+
interrogate --fail-under 100 -c pyproject.toml $(PY_MODULE) && \
72+
python docs/scripts/gen_ref_pages.py --check
7173

7274
.PHONY: reformat
7375
reformat: $(VENV)/pyvenv.cfg
@@ -97,7 +99,8 @@ gen-x509-testcases: $(VENV)/pyvenv.cfg
9799
.PHONY: doc
98100
doc: $(VENV)/pyvenv.cfg
99101
. $(VENV_BIN)/activate && \
100-
pdoc --output-directory html $(PY_MODULE)
102+
python docs/scripts/gen_ref_pages.py --overwrite && \
103+
mkdocs build --strict --site-dir html
101104

102105
.PHONY: package
103106
package: $(VENV)/pyvenv.cfg

README.md

+8-245
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,13 @@ else!
1818

1919
* [Features](#features)
2020
* [Installation](#installation)
21-
* [GitHub Actions](#github-actions)
2221
* [Usage](#usage)
2322
* [Signing](#signing)
2423
* [Verifying](#verifying)
2524
* [Generic identities](#generic-identities)
2625
* [Signatures from GitHub Actions](#signatures-from-github-actions)
2726
* [Advanced usage](#advanced-usage)
28-
* [Example uses](#example-uses)
29-
* [Signing with ambient credentials](#signing-with-ambient-credentials)
30-
* [Signing with an email identity](#signing-with-an-email-identity)
31-
* [Signing with an explicit identity token](#signing-with-an-explicit-identity-token)
32-
* [Verifying against a bundle](#verifying-against-a-bundle)
33-
* [Offline verification](#offline-verification)
34-
* [Verifying a digest instead of a file](#verifying-a-digest-instead-of-a-file)
35-
* [Verifying signatures from GitHub Actions](#verifying-signatures-from-github-actions)
27+
* [Documentation](#documentation)
3628
* [Licensing](#licensing)
3729
* [Community](#community)
3830
* [Contributing](#contributing)
@@ -55,44 +47,17 @@ else!
5547
python -m pip install sigstore
5648
```
5749

58-
Optionally, to install `sigstore` and all its dependencies with [hash-checking mode](https://pip.pypa.io/en/stable/topics/secure-installs/#hash-checking-mode) enabled, run the following:
59-
60-
```console
61-
python -m pip install -r https://raw.githubusercontent.com/sigstore/sigstore-python/main/install/requirements.txt
62-
```
63-
64-
This installs the requirements file located [here](https://github.com/sigstore/sigstore-python/blob/main/install/requirements.txt), which is kept up-to-date.
65-
66-
### GitHub Actions
67-
68-
`sigstore-python` has [an official GitHub Action](https://github.com/sigstore/gh-action-sigstore-python)!
69-
70-
You can install it from the
71-
[GitHub Marketplace](https://github.com/marketplace/actions/gh-action-sigstore-python), or
72-
add it to your CI manually:
73-
74-
```yaml
75-
jobs:
76-
sigstore-python:
77-
steps:
78-
- uses: sigstore/[email protected]
79-
with:
80-
inputs: foo.txt
81-
```
82-
83-
See the
84-
[action documentation](https://github.com/sigstore/gh-action-sigstore-python/blob/main/README.md)
85-
for more details and usage examples.
50+
See the [installation](https://sigstore.github.io/sigstore-python/installation) page in the documentation for more
51+
installation options.
8652

8753
## Usage
8854

89-
For Python API usage, see our [documentation](https://sigstore.github.io/sigstore-python/).
55+
For Python API usage, see our [API](https://sigstore.github.io/sigstore-python/api/).
9056

91-
You can run `sigstore` as a standalone program, or via `python -m`:
57+
You can run `sigstore` as a standalone program:
9258

9359
```console
9460
sigstore --help
95-
python -m sigstore --help
9661
```
9762

9863
Top-level:
@@ -236,12 +201,7 @@ Output options:
236201

237202
### Verifying
238203

239-
#### Generic identities
240-
241-
This is the most common verification done with `sigstore`, and therefore
242-
the one you probably want: you can use it to verify that a signature was
243-
produced by a particular identity (like `[email protected]`), as attested
244-
to by a particular OIDC provider (like `https://github.com/login/oauth`).
204+
#### Identities
245205

246206
<!-- @begin-sigstore-verify-identity-help@ -->
247207
```
@@ -281,11 +241,6 @@ Verification options:
281241

282242
#### Signatures from GitHub Actions
283243

284-
If your signatures are coming from GitHub Actions (e.g., a workflow
285-
that uses its [ambient credentials](#signing-with-ambient-credentials)),
286-
then you can use the `sigstore verify github` subcommand to verify
287-
claims more precisely than `sigstore verify identity` allows:
288-
289244
<!-- @begin-sigstore-verify-github-help@ -->
290245
```
291246
usage: sigstore verify github [-h] [-v] [--certificate FILE]
@@ -330,195 +285,9 @@ Verification options:
330285
```
331286
<!-- @end-sigstore-verify-github-help@ -->
332287

333-
## Advanced usage
334-
335-
### Configuring a custom root of trust ("BYO PKI")
336-
337-
Apart from the default and "staging" Sigstore instances, `sigstore` also
338-
supports "BYO PKI" setups, where a user maintains their own Sigstore
339-
instance services.
340-
341-
These are supported via the `--trust-config` flag, which accepts a
342-
JSON-formatted file conforming to the `ClientTrustConfig` message
343-
in the [Sigstore protobuf specs](https://github.com/sigstore/protobuf-specs).
344-
This file configures the entire Sigstore instance state, *including* the URIs
345-
used to access the CA and artifact transparency services as well as the
346-
cryptographic root of trust itself.
347-
348-
To use a custom client config, prepend `--trust-config` to any `sigstore`
349-
command:
350-
351-
```console
352-
$ sigstore --trust-config custom.trustconfig.json sign foo.txt
353-
$ sigstore --trust-config custom.trustconfig.json verify identity foo.txt ...
354-
```
355-
356-
## Example uses
288+
## Documentation
357289

358-
`sigstore` supports a wide variety of workflows and usages. Some common ones are
359-
provided below.
360-
361-
### Signing with ambient credentials
362-
363-
For environments that support OpenID Connect, `sigstore` supports ambient credential
364-
detection. This includes many popular CI platforms and cloud providers. See the full list of
365-
supported environments [here](https://github.com/di/id#supported-environments).
366-
367-
Sign a single file (`foo.txt`) using an ambient OpenID Connect credential,
368-
saving the bundle to `foo.txt.sigstore.json`:
369-
370-
```console
371-
$ python -m sigstore sign foo.txt
372-
```
373-
374-
### Signing with an email identity
375-
376-
`sigstore` can use an OAuth2 + OpenID flow to establish an email identity,
377-
allowing you to request signing certificates that attest to control over
378-
that email.
379-
380-
Sign a single file (`foo.txt`) using the OAuth2 flow, saving the
381-
bundle to `foo.txt.sigstore.json`:
382-
383-
```console
384-
$ python -m sigstore sign foo.txt
385-
```
386-
387-
By default, `sigstore` attempts to do
388-
[ambient credential detection](#signing-with-ambient-credentials), which may preempt
389-
the OAuth2 flow. To force the OAuth2 flow, you can explicitly disable ambient detection:
390-
391-
```console
392-
$ python -m sigstore sign --oidc-disable-ambient-providers foo.txt
393-
```
394-
395-
### Signing with an explicit identity token
396-
397-
If you can't use an ambient credential or the OAuth2 flow, you can pass a pre-created
398-
identity token directly into `sigstore sign`:
399-
400-
```console
401-
$ python -m sigstore sign --identity-token YOUR-LONG-JWT-HERE foo.txt
402-
```
403-
404-
Note that passing a custom identity token does not circumvent Fulcio's requirements,
405-
namely the Fulcio's supported identity providers and the claims expected within the token.
406-
407-
### Verifying against a bundle
408-
409-
By default, `sigstore verify identity` will attempt to find a `<filename>.sigstore.json`
410-
or `<filename>.sigstore` in the same directory as the file being verified:
411-
412-
```console
413-
# looks for foo.txt.sigstore.json
414-
$ python -m sigstore verify identity foo.txt \
415-
--cert-identity '[email protected]' \
416-
--cert-oidc-issuer 'https://github.com/login/oauth'
417-
```
418-
419-
Multiple files can be verified at once:
420-
421-
```console
422-
# looks for {foo,bar}.txt.sigstore.json
423-
$ python -m sigstore verify identity foo.txt bar.txt \
424-
--cert-identity '[email protected]' \
425-
--cert-oidc-issuer 'https://github.com/login/oauth'
426-
```
427-
428-
### Offline verification
429-
430-
> [!IMPORTANT]
431-
> Because `--offline` disables trust root updates, `sigstore-python` falls back
432-
> to the latest cached trust root or, if none exists, the trust root baked
433-
> into `sigstore-python` itself. Like with any other offline verification,
434-
> this means that users may miss trust root changes (such as new root keys,
435-
> or revocations) unless they separately keep the trust root up-to-date.
436-
>
437-
> Users who need to operationalize offline verification may wish to do this
438-
> by distributing their own trust configuration; see
439-
> [Configuring a custom root of trust](#configuring-a-custom-root-of-trust-byo-pki).
440-
441-
During verification, there are two kinds of network access that `sigstore-python`
442-
*can* perform:
443-
444-
1. When verifying against "detached" materials (e.g. separate `.crt` and `.sig`
445-
files), `sigstore-python` can perform an online transparency log lookup.
446-
2. By default, during all verifications, `sigstore-python` will attempt to
447-
refresh the locally cached root of trust via a TUF update.
448-
449-
When performing bundle verification (i.e. `.sigstore` or `.sigstore.json`),
450-
(1) does not apply. However, (2) can still result in online accesses.
451-
452-
To perform **fully** offline verification, pass `--offline` to your
453-
`sigstore verify` subcommand:
454-
455-
```bash
456-
$ python -m sigstore verify identity foo.txt \
457-
--offline \
458-
--cert-identity '[email protected]' \
459-
--cert-oidc-issuer 'https://github.com/login/oauth'
460-
```
461-
462-
Alternatively, users may choose to bypass TUF entirely by passing
463-
an entire trust configuration to `sigstore-python` via `--trust-config`:
464-
465-
```bash
466-
$ python -m sigstore --trust-config public.trustconfig.json verify identity ...
467-
```
468-
469-
This will similarly result in fully offline operation, as the trust
470-
configuration contains a full trust root.
471-
472-
### Verifying a digest instead of a file
473-
474-
`sigstore-python` supports verifying digests directly, without requiring the artifact to be
475-
present. The digest should be prefixed with the `sha256:` string:
476-
477-
```console
478-
$ python -m sigstore verify identity sha256:ce8ab2822671752e201ea1e19e8c85e73d497e1c315bfd9c25f380b7625d1691 \
479-
--cert-identity '[email protected]' \
480-
--cert-oidc-issuer 'https://github.com/login/oauth'
481-
--bundle 'foo.txt.sigstore.json'
482-
```
483-
484-
### Verifying signatures from GitHub Actions
485-
486-
`sigstore verify github` can be used to verify claims specific to signatures coming from GitHub
487-
Actions. `sigstore-python` signs releases via GitHub Actions, so the examples below are working
488-
examples of how you can verify a given `sigstore-python` release.
489-
490-
When using `sigstore verify github`, you must pass `--cert-identity` or `--repository`, or both.
491-
Unlike `sigstore verify identity`, `--cert-oidc-issuer` is **not** required (since it's
492-
inferred to be GitHub Actions).
493-
494-
Verifying with `--cert-identity`:
495-
496-
```console
497-
$ python -m sigstore verify github sigstore-0.10.0-py3-none-any.whl \
498-
--bundle sigstore-0.10.0-py3-none-any.whl.bundle \
499-
--cert-identity https://github.com/sigstore/sigstore-python/.github/workflows/release.yml@refs/tags/v0.10.0
500-
```
501-
502-
Verifying with `--repository`:
503-
504-
```console
505-
$ python -m sigstore verify github sigstore-0.10.0-py3-none-any.whl \
506-
--bundle sigstore-0.10.0-py3-none-any.whl.bundle \
507-
--repository sigstore/sigstore-python
508-
```
509-
510-
Additional GitHub Actions specific claims can be verified like so:
511-
512-
```console
513-
$ python -m sigstore verify github sigstore-0.10.0-py3-none-any.whl \
514-
--bundle sigstore-0.10.0-py3-none-any.whl.bundle \
515-
--cert-identity https://github.com/sigstore/sigstore-python/.github/workflows/release.yml@refs/tags/v0.10.0 \
516-
--trigger release \
517-
--sha 66581529803929c3ccc45334632ccd90f06e0de4 \
518-
--name Release \
519-
--repository sigstore/sigstore-python \
520-
--ref refs/tags/v0.10.0
521-
```
290+
`sigstore` documentation is available on [https://sigstore.github.io/sigstore-python](https://sigstore.github.io/sigstore-python)
522291

523292
## Licensing
524293

@@ -544,9 +313,3 @@ Everyone interacting with this project is expected to follow the
544313

545314
Should you discover any security issues, please refer to sigstore's [security
546315
process](https://github.com/sigstore/.github/blob/main/SECURITY.md).
547-
548-
### SLSA Provenance
549-
This project emits a SLSA provenance on its release! This enables you to verify the integrity
550-
of the downloaded artifacts and ensured that the binary's code really comes from this source code.
551-
552-
To do so, please follow the instructions [here](https://github.com/slsa-framework/slsa-github-generator#verification-of-provenance).

docs/advanced/custom_trust.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Custom Root of Trust
2+
3+
### Configuring a custom root of trust ("BYO PKI")
4+
5+
Apart from the default and "staging" Sigstore instances, `sigstore` also
6+
supports "BYO PKI" setups, where a user maintains their own Sigstore
7+
instance services.
8+
9+
These are supported via the `--trust-config` flag, which accepts a
10+
JSON-formatted file conforming to the `ClientTrustConfig` message
11+
in the [Sigstore protobuf specs](https://github.com/sigstore/protobuf-specs).
12+
This file configures the entire Sigstore instance state, *including* the URIs
13+
used to access the CA and artifact transparency services as well as the
14+
cryptographic root of trust itself.
15+
16+
To use a custom client config, prepend `--trust-config` to any `sigstore`
17+
command:
18+
19+
```console
20+
$ sigstore --trust-config custom.trustconfig.json sign foo.txt
21+
$ sigstore --trust-config custom.trustconfig.json verify identity foo.txt ...
22+
```

0 commit comments

Comments
 (0)