Skip to content

Commit fba0cf6

Browse files
committed
Move OAuth/GitHub secrets to environment variables
Replace hardcoded Google, Microsoft, and GitHub OAuth client IDs and secrets with Environment.GetEnvironmentVariable() reads. Add .env.example documenting the required variables. Update .gitignore to allow .env.example while keeping .env ignored. This eliminates secret exposure in source control and unblocks GitHub push protection. Bump version: 1.46.2 → 1.46.3
1 parent 201b319 commit fba0cf6

5 files changed

Lines changed: 16 additions & 5 deletions

File tree

.env.example

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# OAuth provider credentials — required for Google, Microsoft, and GitHub connections.
2+
# Copy this file to .env and fill in the values.
3+
PRIVSTACK_GOOGLE_CLIENT_ID=
4+
PRIVSTACK_GOOGLE_CLIENT_SECRET=
5+
PRIVSTACK_MICROSOFT_CLIENT_ID=
6+
PRIVSTACK_GITHUB_CLIENT_ID=

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ test-data/
5757
# Secrets / env
5858
.env
5959
.env.*
60+
!.env.example
6061
*.pem
6162
*.key
6263
*.pfx

desktop/PrivStack.Desktop/PrivStack.Desktop.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<CFBundleDisplayName>PrivStack</CFBundleDisplayName>
1616
<AssemblyTitle>PrivStack</AssemblyTitle>
1717
<Product>PrivStack</Product>
18-
<Version>1.46.2</Version>
18+
<Version>1.46.3</Version>
1919
</PropertyGroup>
2020

2121
<ItemGroup>

desktop/PrivStack.Desktop/Services/Connections/GitHubDeviceFlowService.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ public sealed class GitHubDeviceFlowService
3434

3535
// GitHub App client ID — permissions (issues:write, contents:write) are
3636
// configured on the app itself at https://github.com/settings/apps
37-
private const string ClientId = "***REMOVED***";
37+
private static readonly string ClientId =
38+
Environment.GetEnvironmentVariable("PRIVSTACK_GITHUB_CLIENT_ID")
39+
?? throw new InvalidOperationException("PRIVSTACK_GITHUB_CLIENT_ID env var not set");
3840

3941
private static HttpClient CreateHttpClient()
4042
{

desktop/PrivStack.Desktop/Services/Connections/OAuthProviderConfig.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ public static bool IsOAuthProvider(string providerId) =>
3636
{
3737
ProviderId = "google",
3838
ProviderDisplayName = "Google",
39-
ClientId = "***REMOVED***",
40-
ClientSecret = "***REMOVED***",
39+
ClientId = Environment.GetEnvironmentVariable("PRIVSTACK_GOOGLE_CLIENT_ID")
40+
?? throw new InvalidOperationException("PRIVSTACK_GOOGLE_CLIENT_ID env var not set"),
41+
ClientSecret = Environment.GetEnvironmentVariable("PRIVSTACK_GOOGLE_CLIENT_SECRET"),
4142
AuthorizeEndpoint = "https://accounts.google.com/o/oauth2/v2/auth",
4243
TokenEndpoint = "https://oauth2.googleapis.com/token",
4344
Scopes = "https://mail.google.com/ https://www.googleapis.com/auth/calendar email openid",
@@ -49,7 +50,8 @@ public static bool IsOAuthProvider(string providerId) =>
4950
{
5051
ProviderId = "microsoft",
5152
ProviderDisplayName = "Microsoft",
52-
ClientId = "***REMOVED***",
53+
ClientId = Environment.GetEnvironmentVariable("PRIVSTACK_MICROSOFT_CLIENT_ID")
54+
?? throw new InvalidOperationException("PRIVSTACK_MICROSOFT_CLIENT_ID env var not set"),
5355
AuthorizeEndpoint = "https://login.microsoftonline.com/common/oauth2/v2.0/authorize",
5456
TokenEndpoint = "https://login.microsoftonline.com/common/oauth2/v2.0/token",
5557
Scopes = "https://outlook.office365.com/IMAP.AccessAsUser.All https://outlook.office365.com/SMTP.Send offline_access openid email",

0 commit comments

Comments
 (0)