Skip to content

Commit 9abb557

Browse files
committed
fix: don't add user(write/read) permission by default
1 parent 7496505 commit 9abb557

2 files changed

Lines changed: 5 additions & 11 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ providing a more secure way for users to access protected routes.
6363
|------------------------------|-------------------------------------------------------------------------------|---------|----------|
6464
| `GITHUB_OAUTH_CLIENT_ID` | The GitHub OAuth App client id | | Yes |
6565
| `GITHUB_OAUTH_CLIENT_SECRET` | The GitHub OAuth App client secret | | Yes |
66-
| `GITHUB_OAUTH_SCOPES` | Additional scopes to be added to the Oauth workflow. "user" is always added. | "user" | No |
66+
| `GITHUB_OAUTH_SCOPES` | Additional scopes to be added to the Oauth workflow. | | No |
6767
| `API_BASE_URL` | The base URL of the Traefik GitHub OAuth server | | Yes |
6868
| `API_SECRET_KEY` | The api secret key. You can ignore this if you are using the internal network | | No |
6969
| `SERVER_ADDRESS` | The server address | `:80` | No |
@@ -107,8 +107,8 @@ You can follow the steps in the [GitHub documentation](https://docs.github.com/e
107107

108108
#### OAuth Scopes
109109
- For `ids` and `logins` you don't need extra scopes.
110-
- For `teams` you will need to request the `read:org`, `user` or `repo` scopes from the user. See the [documentation](https://docs.github.com/en/rest/teams/teams?apiVersion=2022-11-28#list-teams-for-the-authenticated-user).
111-
- You can do so by updating the `GITHUB_OAUTH_SCOPES` environment variable with the desired additional scopes, e.g. `GITHUB_OAUTH_SCOPES="repo,read:org"` via the **Server Configuration**.
110+
- For `teams` you might need to request the `read:org` scope from the user. See the [documentation](https://docs.github.com/en/rest/teams/teams?apiVersion=2022-11-28#list-teams-for-the-authenticated-user).
111+
- You can do so by updating the `GITHUB_OAUTH_SCOPES` environment variable with the desired additional scopes, e.g. `GITHUB_OAUTH_SCOPES="read:org"` via the **Server Configuration**.
112112

113113

114114
## License

internal/app/traefik-github-oauth-server/config.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package traefik_github_oauth_server
22

33
import (
44
"os"
5-
"slices"
65
"strings"
76

87
"github.com/spf13/cast"
@@ -29,17 +28,12 @@ func envWithDefault(key string, defaultValue string) string {
2928
}
3029

3130
func githubOauthScopeConfigs() []string {
32-
// Default scopes
33-
scopes := []string{"user"}
34-
35-
// Add additional scopes
3631
scopesFromEnv := os.Getenv("GITHUB_OAUTH_SCOPES")
3732
if scopesFromEnv != "" {
38-
sp := strings.Split(scopesFromEnv, ",")
39-
scopes = slices.Concat(scopes, sp)
33+
return strings.Split(scopesFromEnv, ",")
4034
}
4135

42-
return scopes
36+
return []string{}
4337
}
4438

4539
func NewConfigFromEnv() *Config {

0 commit comments

Comments
 (0)