@@ -11,7 +11,6 @@ import (
1111 "io"
1212 "net/http"
1313 "os"
14- "os/exec"
1514 "path/filepath"
1615 "runtime"
1716 "sort"
@@ -236,17 +235,10 @@ func downloadAndVerify(rawURL, expectedSHA string) (string, error) {
236235 return "" , fmt .Errorf ("failed to create HTTP request: %w" , err )
237236 }
238237
239- if strings .Contains (rawURL , "github.com" ) {
240- if token := githubToken (); token != "" {
241- req .Header .Set ("Authorization" , "Bearer " + token )
242- // GitHub requires this header to download release assets as binary.
243- req .Header .Set ("Accept" , "application/octet-stream" )
244- }
245- }
238+ // GitHub requires this header to download release assets as binary.
239+ req .Header .Set ("Accept" , "application/octet-stream" )
246240
247- // TODO: Once plugin repos are public, remove the token logic above and
248- // replace with a plain http.Get(rawURL).
249- resp , err := http .DefaultClient .Do (req ) //nolint:gosec // G107: URL is from config/env, not user input
241+ resp , err := http .DefaultClient .Do (req ) //nolint:gosec // G704: request originates from plugin manifest
250242 if err != nil {
251243 return "" , fmt .Errorf ("HTTP request failed: %w" , err )
252244 }
@@ -375,22 +367,6 @@ func extractZipEntry(zf *zip.File, destPath string) error {
375367 return out .Close ()
376368}
377369
378- // githubToken returns a GitHub token for authenticating release asset
379- // downloads from private repositories. It checks GH_TOKEN, GITHUB_TOKEN,
380- // then falls back to `gh auth token`. Returns empty string if unavailable.
381- func githubToken () string {
382- if token := os .Getenv ("GH_TOKEN" ); token != "" {
383- return token
384- }
385- if token := os .Getenv ("GITHUB_TOKEN" ); token != "" {
386- return token
387- }
388- out , err := exec .Command ("gh" , "auth" , "token" ).Output ()
389- if err != nil {
390- return ""
391- }
392- return strings .TrimSpace (string (out ))
393- }
394370
395371func defaultPluginCachePath () string {
396372 dir , err := os .UserCacheDir ()
0 commit comments