Improve post-quantum signature test coverage - #4542
Conversation
69f63b1 to
086057b
Compare
| self, | ||
| packages: list[MetaPackage], | ||
| base_path: Optional[str] = None, | ||
| real_packages: bool = False, |
There was a problem hiding this comment.
The PR doesn't actually use this option, I just thought it would be cool to add.
| rpm_path.write_bytes(requests.get(RPM_UNSIGNED_URL).content) | ||
|
|
||
| # TODO: generate a new PQC key in-place to make it truly unique, avoid conflicts with other tests | ||
| _sign_package(rpm_path, KEY_V6_MLDSA65_ED25519.private_url) |
There was a problem hiding this comment.
Can't do this until my PySequoia PR merges and is released.
fbf4bfd to
c39bed2
Compare
|
Note: this is ready for review now, but isn't ready to merge yet, since I'm writing tests that rely on pulp/pulpcore#7946 Also relies on wiktor-k/pysequoia#84 |
|
Some more fun notes:
|
0fb5071 to
d5fdba0
Compare
| raise RuntimeError("Server does not have domains enabled.") | ||
| kwargs["pulp_domain"] = pulp_domain | ||
|
|
||
| return gen_object_with_cleanup(rpm_package_api, **upload_attrs, **kwargs) |
There was a problem hiding this comment.
Any reason do not keep cleaning up the temporary files here? (as with NamedTemporaryFile did).
It's already uploaded to Pulp's storage and apparently we don't ever need that tmp file again.
There was a problem hiding this comment.
It probably happened just because we gave the temp file a name.
| strict=True, | ||
| reason="add-signing-service uses GPG internally," | ||
| " which cannot handle ML-DSA / v6 keys", | ||
| ), |
There was a problem hiding this comment.
Let's see if I get it.
pulpcore has merged this PR adding support for pysquoia, but the pqc support was just merged into pysequoia now. So once pulpcore requires the appropriate pysequoia version Pulp will be able to handle PQC signing services. Is that right? If yes, will this PR wait for the chain of events to finish?
| self, | ||
| packages: list[MetaPackage], | ||
| base_path: Optional[str] = None, | ||
| real_packages: bool = False, |
| nevra = Nevra(name="upload-signed-test", epoch=0, version="1.0", release="1", arch="noarch") | ||
| rpm_path = tmp_path / f"{nevra.to_nvra()}.rpm" | ||
| build_rpm(nevra, rpm_path) | ||
| _sign_package(rpm_path, KEY_V4_RSA4K.private_url) |
| Verifies that signing_keys contains both v4 and v6 prefixed fingerprints. | ||
| """ | ||
| rpm_path = tmp_path / "multi-signed.rpm" | ||
| rpm_path.write_bytes(requests.get(RPM_FIXTURE_MULTI_SIGNED).content) |
There was a problem hiding this comment.
Could we also multi-sign on the fly? Just curious
There was a problem hiding this comment.
We definitely could but we do probably want to use rpmbuild-built packages in at least some tests and I figured this was an important enough case to do so.
| assert synced_package.version == nevra.version | ||
|
|
||
| # signing_keys is None after sync (known limitation, see synchronizing.py:1470-1471) | ||
| assert synced_package.signing_keys is None |
| def pqc_package_signing_service(tmp_path, has_rpmv6_support, pulpcore_bindings): | ||
| """Create a PQC (ML-DSA) package signing service using Sequoia.""" | ||
| if not has_rpmv6_support: | ||
| pytest.skip("rpmsign --rpmv6 not available") |
There was a problem hiding this comment.
Is there a legit environment we expect this to not be available? If there isn't, I would prefer this to be an assert than a skip.
I assume the rpm v6 is provided in centos stream 10, which is well established now, right? At least on the branches where we are need PQC support.
2d2d92e to
cdbf164
Compare
Add tests for ML-DSA signed RPM packages across upload, sync, and signing service paths. Extend RepositoryBuilder with an option to build real packages from metadata, and build_from_files() for creating repos with existing RPMs. New tests: - Upload with ML-DSA87+Ed448 key - Upload pre-built multi-signed fixture (v4 RSA + v6 ML-DSA87) - signing_key filter API with v6 fingerprints - Sync of ML-DSA signed packages (documents signing_keys=None limitation) - Using a signing service with ML-DSA keys for package signing (xfail) - Using a signing service with ML-DSA keys for metadata signing (xfail) Assisted-By: Claude Opus 4.6
The pattern we were using did not consistently raise errors on 404
cdbf164 to
e8abe52
Compare
b6995c0 to
5659db9
Compare
Use rpm-rs to build (and optionally sign) RPMs in the test suite rather than downloading fixture packages. Local generation is faster and lets tests use unique per-test packages, so many upload/signing tests no longer need delete_orphans_pre and can run in parallel. - build_rpm() gains an optional signer to produce signed packages - rpm_package_factory/rpm_artifact_factory default to local generation - drop now-unused fixtures/constants (signed_artifact, LEGACY_SIGNING_KEY, RPM_*_URL2, RPM_PACKAGE_FILENAME2) - downloading key assets is avoided where possible Assisted-By: Claude Opus 4.8
Fetch each public/private signing-key file once per session instead of once per test, and parameterize the signer and verifier fixtures over any FixtureKey via rpm_signer_factory and rpm_verifier_factory. Assisted-By: Claude Opus 4.8
Assisted-By: Claude Opus 4.6
430db08 to
509e932
Compare
Override rpm's gpg signing command (%__gpg_sign_cmd) with a shim that shells out to `sq`, which works on both old and new rpm. Also fix the script's JSON output quoting and assert the signing subkey fingerprint (signatures are issued by the subkey, not the primary key). Assisted-By: Claude Opus 4.8
509e932 to
f32a693
Compare
Add tests for ML-DSA signed RPM packages across upload, sync, and signing service paths.
Extend RepositoryBuilder with an option to build real packages from metadata, and build_from_files() for creating repos with existing RPMs.
New tests:
Assisted-By: Claude Opus 4.6