File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -561,6 +561,8 @@ func (p *OAuthProxy) isValidAPIToken(req *http.Request) bool {
561
561
for _ , route := range p .tokenRoutes {
562
562
if (route .method == "" || req .Method == route .method ) && route .pathRegex .MatchString (req .URL .Path ) {
563
563
authHeader := req .Header .Get ("Authorization" )
564
+ userAgent := req .Header .Get ("User-Agent" )
565
+
564
566
if len (authHeader ) < 10 {
565
567
return false
566
568
}
@@ -591,7 +593,8 @@ func (p *OAuthProxy) isValidAPIToken(req *http.Request) bool {
591
593
592
594
capiPayload := strings .Split (string (plaintext ), ":" )
593
595
capiEmail := capiPayload [0 ]
594
- if capiEmail != "" {
596
+ isCliOrSdk := strings .HasPrefix (userAgent , "CnvrgCLI" ) || strings .HasPrefix (userAgent , "cnvrg" )
597
+ if capiEmail != "" && isCliOrSdk {
595
598
data , err := ioutil .ReadAll (req .Body )
596
599
if err != nil {
597
600
return false
You can’t perform that action at this time.
0 commit comments