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 pusher_id to /api/v1/:gem/versions/:version #3765

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

JackMcDataGrail
Copy link

Summary

As part of my research into gem supply chain security I would like to access the pusher_id field on the Version model via the API. This field is useful as it is a non-forgeable record of which user pushed the gem.

Risks

I don't believe this presents additional security or operational risk that did not already exist. User IDs are, for the most part, opaque in RubyGems. This information is already present on the gem page, as shown below.

image

@@ -281,6 +281,7 @@ def downloads_count
def payload
{
"authors" => authors,
"pusher_id" => pusher_id,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we include raw IDs elsewhere in API responses? Would this make more sense to embed "pusher" => @pusher&.payload or something like that?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 Interesting - I definitely would prefer that we have more data on the user (at least what's exposed on the RubyGems gem page right now), but I wasn't sure what information the team would like to expose, since we currently don't include any user fields. Do you have any opinions on that front?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, raw ID is already at profiles API like https://rubygems.org/api/v1/profiles/simi.json and it accepts ID as well https://rubygems.org/api/v1/profiles/42601.json.

@codecov
Copy link

codecov bot commented May 5, 2023

Codecov Report

Merging #3765 (739cffe) into master (77e3421) will increase coverage by 0.00%.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #3765   +/-   ##
=======================================
  Coverage   98.80%   98.81%           
=======================================
  Files         212      213    +1     
  Lines        5198     5223   +25     
=======================================
+ Hits         5136     5161   +25     
  Misses         62       62           
Impacted Files Coverage Δ
app/models/version.rb 98.12% <ø> (ø)

... and 5 files with indirect coverage changes

@simi simi self-requested a review May 5, 2023 20:18
@simi
Copy link
Member

simi commented May 13, 2023

Is this related to V2 versions as well aka https://rubygems.org/api/v2/rubygems/coulda/versions/0.7.1.json? Would it be possible to add also some assertions to related API tests?

@simi
Copy link
Member

simi commented May 13, 2023

Would it be possible to open PR also to update API docs payloads at https://github.com/rubygems/guides/?

@simi
Copy link
Member

simi commented Oct 31, 2023

@JackMcDataGrail hello! Are you still interested in moving this forward?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants