Skip to content

Commit 204e0f4

Browse files
woodruffwjku
andauthored
refactor: begin to remove sigstore_protobuf_specs (#1470)
* refactor: begin to remove sigstore_protobuf_specs * fixup tests, use wrapper APIs * burn down changes * burn down tests * more burndown * get more tests passing * fixup test * replace more protobuf models * port rekor v2 models, get tests passing locally * pyproject: drop sigstore-protobuf-specs dependency * pyproject: add sigstore-models * sign: b64 wrapping * fix more API errors * more fixes * fix two last tests * bump sigstore-models * fmt * fmt * pyproject: bump sigstore-models to 0.0.3 * hush some CI findings * more CI cleanup * typecheck fixes, burndown * more typecheck burndown * squash more typecheck findings * bump embedded signing configs * test: fixup * fixup operator fields everywhere * lint * fmt * operator, operator everywhere * pyproject: bump sigstore-models to 0.0.5 * fixup content Signed-off-by: William Woodruff <[email protected]> * another missing b64 Signed-off-by: William Woodruff <[email protected]> --------- Signed-off-by: William Woodruff <[email protected]> Co-authored-by: Jussi Kukkonen <[email protected]>
1 parent a2e7a4c commit 204e0f4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+613
-735
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ on:
77
- series/*
88
pull_request:
99
schedule:
10-
- cron: '0 12 * * *'
10+
- cron: "0 12 * * *"
11+
12+
permissions: {}
1113

1214
jobs:
1315
test:
@@ -98,7 +100,7 @@ jobs:
98100
if: always()
99101

100102
needs:
101-
- test
103+
- test
102104

103105
runs-on: ubuntu-latest
104106

@@ -121,7 +123,7 @@ jobs:
121123

122124
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
123125
with:
124-
python-version: '3.x'
126+
python-version: "3.x"
125127

126128
- run: pip install coverage[toml]
127129

.github/workflows/conformance.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ on:
77
workflow_dispatch:
88
pull_request:
99

10+
permissions: {}
11+
1012
jobs:
1113
conformance:
1214
runs-on: ubuntu-latest

.github/workflows/docs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55
branches:
66
- main
77

8+
permissions: {}
9+
810
jobs:
911
build:
1012
runs-on: ubuntu-latest

.github/workflows/lint.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
- main
77
pull_request:
88

9+
permissions: {}
10+
911
jobs:
1012
lint:
1113
runs-on: ubuntu-latest
@@ -87,10 +89,10 @@ jobs:
8789
if: always()
8890

8991
needs:
90-
- lint
91-
- check-readme
92-
- licenses
93-
- x509-testcases
92+
- lint
93+
- check-readme
94+
- licenses
95+
- x509-testcases
9496

9597
runs-on: ubuntu-latest
9698

.github/workflows/release.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ on:
55
types:
66
- published
77

8-
permissions: # added using https://github.com/step-security/secure-workflows
9-
contents: read
8+
permissions: {}
109

1110
jobs:
1211
build:
@@ -99,7 +98,7 @@ jobs:
9998
- name: Generate build provenance
10099
uses: actions/attest-build-provenance@v2
101100
with:
102-
subject-path: 'built-packages/*'
101+
subject-path: "built-packages/*"
103102

104103
release-pypi:
105104
needs: [build, generate-provenance]

.github/workflows/requirements.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ on:
1212
required: true
1313
pull_request:
1414
schedule:
15-
- cron: '0 12 * * *'
15+
- cron: "0 12 * * *"
16+
17+
permissions: {}
1618

1719
jobs:
1820
test_requirements:

.github/workflows/staging-tests.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ on:
55
branches:
66
- main
77
schedule:
8-
- cron: '0 */8 * * *'
8+
- cron: "0 */8 * * *"
9+
10+
permissions: {}
911

1012
jobs:
1113
staging-tests:
@@ -27,7 +29,6 @@ jobs:
2729
cache: "pip"
2830
cache-dependency-path: pyproject.toml
2931

30-
3132
- name: staging tests
3233
env:
3334
SIGSTORE_LOGLEVEL: DEBUG

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ lint: $(VENV)/pyvenv.cfg
6868
ruff check $(ALL_PY_SRCS) && \
6969
mypy $(PY_MODULE) && \
7070
bandit -c pyproject.toml -r $(PY_MODULE) && \
71-
interrogate --fail-under 100 -c pyproject.toml $(PY_MODULE) && \
7271
python docs/scripts/gen_ref_pages.py --check
7372

7473
.PHONY: reformat

pyproject.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ dependencies = [
3737
"rich >= 13,< 15",
3838
"rfc8785 ~= 0.1.2",
3939
"rfc3161-client >= 1.0.3,< 1.1.0",
40-
# NOTE(ww): Both under active development, so strictly pinned.
41-
"sigstore-protobuf-specs == 0.5.0",
40+
# Both sigstore-models and sigstore-rekor types are unstable
41+
# so we pin them conservatively.
42+
"sigstore-models == 0.0.5",
4243
"sigstore-rekor-types == 0.0.18",
4344
"tuf ~= 6.0",
4445
"platformdirs ~= 4.2",
@@ -58,7 +59,7 @@ Documentation = "https://sigstore.github.io/sigstore-python/"
5859
test = ["pytest", "pytest-cov", "pretend", "coverage[toml]"]
5960
lint = [
6061
"bandit",
61-
"interrogate >= 1.7.0",
62+
# "interrogate >= 1.7.0",
6263
"mypy ~= 1.1",
6364
# NOTE(ww): ruff is under active development, so we pin conservatively here
6465
# and let Dependabot periodically perform this update.

sigstore/_cli.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,8 @@
3030
from pydantic import ValidationError
3131
from rich.console import Console
3232
from rich.logging import RichHandler
33-
from sigstore_protobuf_specs.dev.sigstore.bundle.v1 import (
34-
Bundle as RawBundle,
35-
)
36-
from sigstore_protobuf_specs.dev.sigstore.common.v1 import HashAlgorithm
33+
from sigstore_models.bundle.v1 import Bundle as RawBundle
34+
from sigstore_models.common.v1 import HashAlgorithm
3735
from typing_extensions import TypeAlias
3836

3937
from sigstore import __version__, dsse
@@ -670,7 +668,7 @@ def _sign_file_threaded(
670668
raise exp_certificate
671669

672670
_logger.info(
673-
f"Transparency log entry created at index: {result.log_entry.log_index}"
671+
f"Transparency log entry created at index: {result.log_entry._inner.log_index}"
674672
)
675673

676674
if outputs.signature is not None:
@@ -1236,7 +1234,7 @@ def _fix_bundle(args: argparse.Namespace) -> None:
12361234

12371235
rekor = RekorClient.staging() if args.staging else RekorClient.production()
12381236

1239-
raw_bundle = RawBundle.from_dict(json.loads(args.bundle.read_bytes()))
1237+
raw_bundle = RawBundle.from_json(args.bundle.read_bytes())
12401238

12411239
if len(raw_bundle.verification_material.tlog_entries) != 1:
12421240
_fatal("unfixable bundle: must have exactly one log entry")
@@ -1249,8 +1247,8 @@ def _fix_bundle(args: argparse.Namespace) -> None:
12491247
inclusion_proof = tlog_entry.inclusion_proof
12501248
if not inclusion_proof.checkpoint:
12511249
_logger.info("fixable: bundle's log entry is missing a checkpoint")
1252-
new_entry = rekor.log.entries.get(log_index=tlog_entry.log_index)._to_rekor()
1253-
raw_bundle.verification_material.tlog_entries = [new_entry]
1250+
new_entry = rekor.log.entries.get(log_index=tlog_entry.log_index)
1251+
raw_bundle.verification_material.tlog_entries = [new_entry._inner]
12541252

12551253
# Try to create our invariant-preserving Bundle from the any changes above.
12561254
try:

0 commit comments

Comments
 (0)