Fix gitlab token length requirements (#176)

This commit is contained in:
Jay Gabriels
2022-01-13 08:47:10 -08:00
committed by GitHub
parent 18cc8a360e
commit d7f79c86fe
3 changed files with 6 additions and 2 deletions

View File

@@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
### Deprecated
### Removed
### Fixed
- Gitlab token length requirements; thanks @dschafhauser
### Security
## [1.7.5] - 12/11/21

View File

@@ -228,8 +228,11 @@ func VerifyTokenSet() error {
token = os.Getenv("GHORG_GITLAB_TOKEN")
if strings.HasPrefix(token, "glpat-") {
tokenLength = 26
} else if len(token) > 0 {
// gitlab admins can change token prefixes so we dont know the exact length
tokenLength = len(token)
} else {
tokenLength = 20
tokenLength = -1
}
}

View File

@@ -26,7 +26,7 @@ func TestVerifyTokenSet(t *testing.T) {
err := configs.VerifyTokenSet()
if err != configs.ErrNoGitLabToken {
tt.Errorf("Expected ErrNoGitHubTokenError, got: %v", err)
tt.Errorf("Expected ErrNoGitLabTokenError, got: %v", err)
}
})