-
Notifications
You must be signed in to change notification settings - Fork 181
fix: rename devnet and reduce scope for Google Drive #1418
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
dc6d3b6
refactor: move schnapps to devnet (flavor)
HashEngineering 5c19ba9
fix: use DRIVE_FILES scope
HashEngineering 122540e
fix: don't cache google tokens, ask everytime
HashEngineering 23717a9
Revert "fix: don't cache google tokens, ask everytime"
HashEngineering File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,14 @@ | ||
| package de.schildbach.wallet.ui.dashpay.utils | ||
|
|
||
| import android.content.Context | ||
| import com.google.android.gms.auth.api.identity.AuthorizationRequest | ||
| import com.google.android.gms.common.api.Scope | ||
| import com.google.api.client.http.ByteArrayContent | ||
| import com.google.api.client.http.HttpRequestInitializer | ||
| import com.google.api.client.http.javanet.NetHttpTransport | ||
| import com.google.api.client.json.gson.GsonFactory | ||
| import com.google.api.services.drive.Drive | ||
| import com.google.api.services.drive.DriveScopes | ||
| import com.google.api.services.drive.model.File | ||
| import com.google.api.services.drive.model.Permission | ||
| import dagger.hilt.android.qualifiers.ApplicationContext | ||
|
|
@@ -91,4 +94,10 @@ class GoogleDriveService( | |
| } | ||
| } | ||
| } | ||
|
|
||
| fun getAuthRequest() = AuthorizationRequest | ||
| .builder() | ||
| .setRequestedScopes( | ||
| listOf(Scope(DriveScopes.DRIVE_FILE)) | ||
| ).build() | ||
|
Comment on lines
+97
to
+102
Collaborator
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. Scopes reduced from |
||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
🛠️ Refactor suggestion
Secrets exposure & property fallback consistency
Great to see sandbox-specific
TOPPER_*fields added. Two minor points:These keys end up in the generated
BuildConfig.java. Even for devnet, avoid putting real secrets in plain text; double-check thatservice.propertiesis git-ignored and that CI injects them via secure variables.Immediately above (Lines 367-376) the flavour fetches sandbox Uphold credentials into
imgurClientId/Secret, but then discards them and hard-codes"UPHOLD_CLIENT_ID"/"UPHOLD_CLIENT_SECRET". That looks like a stale copy-paste.If you actually want the sandbox values, wire them into
buildConfigFieldsimilarly to what you just did for theTOPPER_*keys.🤖 Prompt for AI Agents
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.
What is the alternative? How can I avoid plain text secrets in BuildConfig? @coderabbitai
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.
@HashEngineering Great question! Here are several alternatives to avoid plain text secrets in
BuildConfig:1. Encrypted SharedPreferences + Runtime Injection
Store secrets encrypted and decrypt at runtime:
2. Android Keystore + Server Injection
Most secure approach - fetch secrets from your backend at runtime:
3. ProGuard Obfuscation (Minimal Protection)
Better than nothing, but still reversible:
4. Native Library Storage
Store in C++ with some obfuscation:
5. Hybrid Approach (Recommended)
BuildConfigfor convenienceBuildConfig(less sensitive)Reality check: Client-side apps inherently expose some data. Focus on:
For your devnet flavor, using sandbox keys in
BuildConfigis probably acceptable since they're not production credentials.🧠 Learnings used
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.
Thank you. This will be considered in a future story.
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.
@HashEngineering You're welcome! That makes perfect sense - keeping this PR focused on the devnet renaming and Google Drive scope changes is the right approach. The security improvements can definitely be addressed in a dedicated story where they can get proper attention and testing.
Thanks for considering the suggestions for future implementation!
🧠 Learnings used