Description
Currently neither the crates index nor the carates io api attribute published versions to users who published them.
When a crate has multiple owners it's not possible to establish who published what.
This attribution is needed for:
-
Auditing and monitoring. In case something unexpected gets published it's important to know whose credentials were stolen or misused.
-
Evaluation. On crates.rs I'm experimenting with several ideas - detecting abandoned crates (inactive authors) and finding trusted users based on relationships between crates, but the data is incomplete without knowing who exactly published each crate.
Ideally I'd like to see username GitHub User ID for every published version. It could be as part of the crates index. If bloating of the index should be avoided, it'd be ok as crates.io API call as well.
Implementation instructions
(added by @carols10cents)
Backend changes:
-
Create a migration (using
diesel migration generate
, as explained in this guide) that adds a new column namedpublished_by
to theversions
table. It should reference users.id and be nullable because we don't have the published by information for any versions published before this change. -
Add a published_by field to the NewVersion struct
-
Within the crate publish transaction, add to the new version record created a published_by field set to user.id
-
Add to the EncodableVersion type a field named
published_by
that's an instance of EncodableOwner, which should allow for display in the frontend if we want and should give enough information to API users.