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 3 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

All modified and coverable lines are covered by tests ✅

Project coverage is 96.98%. Comparing base (435fa0c) to head (3953a54).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3765   +/-   ##
=======================================
  Coverage   96.98%   96.98%           
=======================================
  Files         420      420           
  Lines        8717     8717           
=======================================
  Hits         8454     8454           
  Misses        263      263           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@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
Development

Successfully merging this pull request may close these issues.

3 participants