@@ -66,9 +66,9 @@ const (
6666)
6767
6868type token struct {
69- AccessToken string `json:"access_token"`
69+ AccessToken string `json:"access_token"` // #nosec G117 -- JSON property
7070 IDToken string `json:"id_token"`
71- RefreshToken string `json:"refresh_token"`
71+ RefreshToken string `json:"refresh_token"` // #nosec G117 -- JSON property
7272 ExpiresIn int `json:"expires_in"`
7373 TokenType string `json:"token_type"`
7474 Err string `json:"error,omitempty"`
@@ -571,13 +571,13 @@ type endpoint struct {
571571}
572572
573573var knownProviders = map [string ]endpoint {
574- "google" : {
574+ "google" : { // #nosec G101 -- no credentials; just well-known configuration values
575575 authorization : "https://accounts.google.com/o/oauth2/v2/auth" ,
576576 deviceAuthorization : "https://oauth2.googleapis.com/device/code" ,
577577 token : "https://www.googleapis.com/oauth2/v4/token" ,
578578 userInfo : "https://www.googleapis.com/oauth2/v3/userinfo" ,
579579 },
580- "github" : {
580+ "github" : { // #nosec G101 -- no credentials; just well-known configuration values
581581 authorization : "https://github.com/login/oauth/authorize" ,
582582 deviceAuthorization : "https://github.com/login/device/code" ,
583583 token : "https://github.com/login/oauth/access_token" ,
@@ -712,7 +712,7 @@ func disco(provider string) (map[string]interface{}, error) {
712712// application/json", without this header GitHub will use
713713// application/x-www-form-urlencoded.
714714func postForm (rawurl string , data url.Values ) (* http.Response , error ) {
715- req , err := http .NewRequest ("POST" , rawurl , strings .NewReader (data .Encode ()))
715+ req , err := http .NewRequest ("POST" , rawurl , strings .NewReader (data .Encode ())) // #nosec G704 -- request intentionally relies on user data
716716 if err != nil {
717717 return nil , fmt .Errorf ("create POST %s request failed: %w" , rawurl , err )
718718 }
@@ -722,7 +722,7 @@ func postForm(rawurl string, data url.Values) (*http.Response, error) {
722722
723723 req .Header .Set ("Content-Type" , "application/x-www-form-urlencoded" )
724724 req .Header .Set ("Accept" , "application/json" )
725- return http .DefaultClient .Do (req )
725+ return http .DefaultClient .Do (req ) // #nosec G704 -- request intentionally relies on user configuration
726726}
727727
728728// NewServer creates http server
@@ -1106,7 +1106,7 @@ func (o *oauth) ServeHTTP(w http.ResponseWriter, req *http.Request) {
11061106
11071107 code , state := q .Get ("code" ), q .Get ("state" )
11081108 if code == "" || state == "" {
1109- fmt .Fprintf (os .Stderr , "Invalid request received: http://%s%s\n " , req .RemoteAddr , req .URL .String ())
1109+ fmt .Fprintf (os .Stderr , "Invalid request received: http://%s%s\n " , req .RemoteAddr , req .URL .String ()) // #nosec G705 -- terminal output
11101110 fmt .Fprintf (os .Stderr , "You may have an app or browser plugin that needs to be turned off\n " )
11111111 http .Error (w , "400 bad request" , http .StatusBadRequest )
11121112 return
0 commit comments