Xuanwo opened a new issue, #8879:
URL: https://github.com/apache/opendal/issues/8879

   ## Problem
   
   `core/services/gdrive/src/core.rs:832-905` maintains a hand-rolled 
`GdriveSigner` protected by `Arc<Mutex<GdriveSigner>>` that refreshes OAuth2 
access tokens against `https://oauth2.googleapis.com/token`.
   
   Notably, `GdriveSigner::sign` (`core/services/gdrive/src/core.rs:861-864`) 
embeds **`refresh_token`, `client_id`, and `client_secret` directly in the URL 
query string** without form encoding:
   
   ```rust
   let url = format!(
       
"https://oauth2.googleapis.com/token?refresh_token={}&client_id={}&client_secret={}&grant_type=refresh_token";,
       self.refresh_token, self.client_id, self.client_secret
   );
   ```
   
   Placing OAuth2 secrets in the query string violates RFC 6749 token endpoint 
conventions and risks exposing credentials in HTTP client/proxy/server URL logs.
   
   ## Proposal
   
   Migrate `services/gdrive` to `reqsign-google` (`3.4.0`, via #8871):
   
   - For `access_token`: use 
`reqsign_google::TokenCredentialProvider::new(access_token)`.
   - For `refresh_token` + `client_id` + `client_secret`: use 
`reqsign_google::AuthorizedUserCredentialProvider::new(OAuth2Credentials { 
client_id, client_secret, refresh_token })`, which sends standard `POST` 
`application/x-www-form-urlencoded` bodies, provides singleflight caching with 
120s early refresh, and redacts sensitive fields in errors/debug output.
   - Sign requests with `reqsign_google::RequestSigner::new("drive")`.
   - Remove `GdriveSigner` and `GdriveTokenResponse` from 
`core/services/gdrive/src/core.rs` (and update `GdrivePathQuery` accordingly).
   - Preserve existing config validation semantics (`access_token` vs 
`refresh_token` + `client_id` + `client_secret`).
   
   ## Coordination
   
   - Depends on #8871 (upgrading `reqsign-google` to `3.4.0` / `0.20.9` line).
   - Mind the upcoming `reqsign 0.21.0` `Signer::with_context` cache isolation 
change when wiring `HttpTransport`.
   
   ---
   *Drafted with AI assistance (Gemini 4 Neon) and verified against 
`core/services/gdrive/src/{backend.rs,core.rs,config.rs}` and `reqsign-google` 
`v0.20.9`.*


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to