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 support for token auth to download raw yml config from private repo #9827

Closed
AirWick219 opened this issue May 26, 2021 · 6 comments
Closed

Comments

@AirWick219
Copy link
Contributor

Is your feature request related to a problem?

We are requiring auth for all internal Github repos, we will need a way to inherit and cache the raw yaml shared configs with auth so that RuboCop's existing download and cache logic would work the same way with minimal overall impact.

Describe the solution you'd like

Since inherit_from supports ERB pre-precessing, we can set .rubocop.yml

# .rubocop.yml

inherit_from:
  - <%= "https://#{ENV['GITHUB_PERSONAL_ACCESS_TOKEN']}@raw.github.com/AirWick219/../rubocop-main.yml" %>

and the token is in the uri.user
Screen Shot 2021-05-26 at 12 20 50 PM

Seems like we can do this here

request['Authorization'] = "token #{uri.user}" if uri.user

Describe alternatives you've considered

The above solution would be the simplest way to tap into existing logic. if not we will have to.

  1. hack it with a new rake task to first download the shared config with curl and inherit_from that file
    • we lost the cache supports and dev will need to run a separate rake task just for rubocop
  2. hack a binstub to download the shared config with curl and replace the bin/rubocop
    • still hacky but easier for dev to integrate
@AirWick219 AirWick219 changed the title Add support for token auth Add support for token auth to download raw yml config from private repo May 26, 2021
@fgoyer
Copy link

fgoyer commented May 26, 2021

This could be helpful for when Github forces token-based authentication https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/

@AirWick219
Copy link
Contributor Author

Here is the PR: #9828

@AirWick219
Copy link
Contributor Author

cc. @koic

AirWick219 pushed a commit to AirWick219/rubocop that referenced this issue Jun 1, 2021
@bbatsov bbatsov closed this as completed in 5d6c085 Jun 9, 2021
@nickpith
Copy link

nickpith commented Jun 9, 2021

@bbatsov or @koic - Thanks for accepting this. When were you all thinking of releasing the next version with this fix?

@bbatsov
Copy link
Collaborator

bbatsov commented Jun 10, 2021 via email

@nickpith
Copy link

Thanks

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

No branches or pull requests

4 participants