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

Add external types CI check + config #183

Merged
merged 10 commits into from
Dec 9, 2023

Commits on Dec 8, 2023

  1. Configuration menu
    Copy the full SHA
    21471c9 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    0aab261 View commit details
    Browse the repository at this point in the history
  3. key_pair: consistent inter-member whitespace

    Previously this file had some places where members of a type were
    separated by whitespace, and some places where they weren't. In my
    experience it's more common to use whitespace here, and I think it reads
    better, so this commit standardizes on that (at least within
    key_pair.rs).
    cpu committed Dec 8, 2023
    Configuration menu
    Copy the full SHA
    8672d84 View commit details
    Browse the repository at this point in the history
  4. error: add ExternalError extension trait

    This trait offers a way to convert errors from dependencies into
    `rcgen::Error` instances without manually mapping the error in each
    instance, or leaking the error type into the public API with a `From<x>
    for Error` impl.
    cpu committed Dec 8, 2023
    Configuration menu
    Copy the full SHA
    28272ad View commit details
    Browse the repository at this point in the history
  5. error: avoid leaking ring::error::KeyRejected into api

    Having `From<ring::error::KeyRejected>` defined on the public `Error`
    type means that the `*ring*` type leaks into rcgen's public API,
    complicating semver incompatible updates.
    
    This commit takes the simple approach of using the crate-internal
    `ExternalError` trait to convert from the `*ring*` error type to our
    generic rcgen `Error::RingKeyRejected` type as needed. This allows the
    `From` impl on `Error` to be removed, fixing the type leak.
    cpu committed Dec 8, 2023
    Configuration menu
    Copy the full SHA
    b2d5e68 View commit details
    Browse the repository at this point in the history
  6. error: avoid leaking ring::error::Unspecified into api

    Having `From<ring::error::Unspecified>` defined on the public `Error`
    type means that the `*ring*` type leaks into rcgen's public API,
    complicating semver incompatible updates.
    
    This commit updates the sites that previously used this trait to
    instead use a crate internal `ExternalError` trait implementation
    to map to the generic rcgen `Error::RingUnspecified` err.
    This allows the `From` impl on `Error` to be removed, fixing the type
    leak.
    cpu committed Dec 8, 2023
    Configuration menu
    Copy the full SHA
    c584880 View commit details
    Browse the repository at this point in the history
  7. error: avoid leaking pem::PemError into api

    Having `From<pem::PemError>` defined on the public `Error`
    type means that the `pem` type leaks into rcgen's public API,
    complicating semver incompatible updates.
    
    This commit updates the sites that previously used this trait to
    use the crate internal `ExternalError` extension trait to map the
    `PemError` err to the generic rcgen `Error::PemError` err.
    
    Additionally, the `rcgen::Error::PemError` variant is changed to hold
    a `String` with the `pem::PemError` error string instead of the type
    itself. This allows the `From` impl on `Error` to be removed, fixing the
    type leak.
    cpu committed Dec 8, 2023
    Configuration menu
    Copy the full SHA
    a53aa2f View commit details
    Browse the repository at this point in the history
  8. ci: add cargo-check-external-types, config

    This commit adds configuration and a CI task for checking that no
    types from dependencies are accidentally leaked through the Rcgen public
    API unintentionally.
    
    The previous commits in this branch fixed the `*ring*` type leaks, so
    our configuration only has two white-listed types as of this branch:
    
    1. `time::offset_date_time::OffsetDateTime`
    
    It's unclear whether usage of that type should be adjusted, so for now
    we explicitly allow-list it in the cargo-check-external-types config. We
    can deal with this type (or not) in the future.
    
    2. `zeroize::Zeroize`
    
    We could probably avoid leaking this type by implementing `Drop` and
    calling `zeroize` on fields directly from the `drop` impl. In the
    meantime we add this type to the allow list.
    cpu committed Dec 8, 2023
    Configuration menu
    Copy the full SHA
    796ccc7 View commit details
    Browse the repository at this point in the history
  9. Cargo: rcgen v0.11.3 -> v0.12.0

    This commit bumps the rcgen version from `0.11.3` to `0.12.0` to reflect
    there are breaking changes in `main`.
    cpu committed Dec 8, 2023
    Configuration menu
    Copy the full SHA
    17b0b50 View commit details
    Browse the repository at this point in the history
  10. CI: add cargo-semver-checks

    This commit adds `cargo-semver-checks`[0] to CI. This tool helps detect
    when semver incompatible changes are being made without properly
    incrementing the `Cargo.toml` version.
    
    Note that this is necessary, but not sufficient, for ensuring semver
    compatibility. This tool is helpful, but not perfect, and can miss
    some breakages.
    
    [0]: https://github.com/obi1kenobi/cargo-semver-checks
    cpu committed Dec 8, 2023
    Configuration menu
    Copy the full SHA
    11f31a2 View commit details
    Browse the repository at this point in the history