-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fix(auth): include Gmail settings scope #794
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -264,6 +264,7 @@ pub const MINIMAL_SCOPES: &[&str] = &[ | |
| "https://www.googleapis.com/auth/drive", | ||
| "https://www.googleapis.com/auth/spreadsheets", | ||
| "https://www.googleapis.com/auth/gmail.modify", | ||
| "https://www.googleapis.com/auth/gmail.settings.basic", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding References
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point. I removed |
||
| "https://www.googleapis.com/auth/calendar", | ||
| "https://www.googleapis.com/auth/documents", | ||
| "https://www.googleapis.com/auth/presentations", | ||
|
|
@@ -289,6 +290,7 @@ pub const FULL_SCOPES: &[&str] = &[ | |
| "https://www.googleapis.com/auth/drive", | ||
| "https://www.googleapis.com/auth/spreadsheets", | ||
| "https://www.googleapis.com/auth/gmail.modify", | ||
| "https://www.googleapis.com/auth/gmail.settings.basic", | ||
| "https://www.googleapis.com/auth/calendar", | ||
| "https://www.googleapis.com/auth/documents", | ||
| "https://www.googleapis.com/auth/presentations", | ||
|
|
@@ -1549,6 +1551,10 @@ const SCOPE_ENTRIES: &[ScopeEntry] = &[ | |
| scope: "https://www.googleapis.com/auth/gmail.modify", | ||
| label: "Gmail", | ||
| }, | ||
| ScopeEntry { | ||
| scope: "https://www.googleapis.com/auth/gmail.settings.basic", | ||
| label: "Gmail Settings", | ||
| }, | ||
| ScopeEntry { | ||
| scope: "https://www.googleapis.com/auth/calendar", | ||
| label: "Google Calendar", | ||
|
|
@@ -1745,6 +1751,9 @@ mod tests { | |
| let scopes = run_resolve_scopes(ScopeMode::Default, None); | ||
| assert_eq!(scopes.len(), DEFAULT_SCOPES.len()); | ||
| assert_eq!(scopes[0], "https://www.googleapis.com/auth/drive"); | ||
| assert!( | ||
| scopes.contains(&"https://www.googleapis.com/auth/gmail.settings.basic".to_string()) | ||
| ); | ||
| } | ||
|
|
||
| #[test] | ||
|
|
@@ -1789,6 +1798,9 @@ mod tests { | |
| fn resolve_scopes_full_returns_full_scopes() { | ||
| let scopes = run_resolve_scopes(ScopeMode::Full, None); | ||
| assert_eq!(scopes.len(), FULL_SCOPES.len()); | ||
| assert!( | ||
| scopes.contains(&"https://www.googleapis.com/auth/gmail.settings.basic".to_string()) | ||
| ); | ||
| } | ||
|
|
||
| #[test] | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding
https://www.googleapis.com/auth/gmail.settings.basicto the default scope sets requires an update to thefilter_redundant_restrictive_scopesfunction (located around line 862). This function is designed to remove restrictive scopes that are redundant when broader scopes (likehttps://mail.google.com/) are present, preventing Google from enforcing the narrower scope's limitations on the access token. Please add an entry for this new scope to theRESTRICTIVE_SCOPESconstant within that function to ensure it is filtered out when full Gmail access is granted.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching this. I added
gmail.settings.basicto the redundant restrictive-scope filter whenhttps://mail.google.com/is present, with regression coverage for both filtering and keeping it when onlygmail.modifyis present.