Skip to content

lookup repo permissions from SRC_ACCESS_TOKEN for LSIF upload

Administrator requested to merge nsc/src-access-token-upload-auth into main

Created by: Strum355

This PR allows determining whether a user can upload LSIF for a repository from the SRC_ACCESS_TOKEN, instead of having to provide a Github Access Token

Test plan

TODO: we tried locally, but couldn't figure out how 2

What we tried:

  1. set allowSignup to true in extsvc config for the Github service
  2. Signup with my/this account
  3. https://sourcegraph.test:3443/users/Strum355/settings/repositories says "The authenticated user does not have access to this external service", yet I can view the repo in search results
  4. Postgres output is as follows, where user_id 2 = strum355 and not a site-admin:
postgres=# select * from user_permissions ;
 user_id | permission | object_type |          updated_at          |          synced_at           | object_ids_ints 
---------+------------+-------------+------------------------------+------------------------------+-----------------
       2 | read       | repos       | 2022-04-14 17:48:57.03302+00 | 2022-04-14 17:48:57.03302+00 | {}
  1. I also cant add a github codehost for Strum355 as we're not in dotcom mode
  2. 🤷 confused

Merge request reports

Loading