awslabs / tough

Rust libraries and tools for using and generating TUF repositories
191 stars 43 forks source link

fix dependency hell: hide foreign types from public interface #733

Open webern opened 7 months ago

webern commented 7 months ago

We have created a dependency hell where tough, pubsys, and testsys all need to update the aws-sdk libraries in lockstep. This is because we have exposed types from these libraries in our public interface. Here is one such example:

https://github.com/awslabs/tough/blob/571d1556221d83a02cdd2020ad645edf01da9fd5/tough-kms/src/lib.rs#L65

We need to replace these types with types of our own that hide the underlying type. In other words, in the above example, instead of exposing a KmsClient as the input, we need to take a tough_kms::Client object that wraps and hides the foreign type.

We should scrub for additional exposed types and consider whether or not they should be hidden. Sometimes libraries are so stable on a major version that it is considered fine/idiomatic to expose them (Url for example), but as a general principle it is a very bad idea to leak someone else's types in a public interface.

Related: https://github.com/awslabs/coldsnap/issues/301