Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

fix: remove hardcoded Google OAuth credentials + clean repo#6

Open
iberi22 wants to merge 5 commits intomainfrom
fix/integration-1774210414034
Open

fix: remove hardcoded Google OAuth credentials + clean repo#6
iberi22 wants to merge 5 commits intomainfrom
fix/integration-1774210414034

Conversation

@iberi22
Copy link
Copy Markdown
Owner

@iberi22 iberi22 commented Mar 22, 2026

Summary

  • Replaced hardcoded Google OAuth Client ID/Secret with env var getters
  • Removed 3 large .txt files (5MB combined) containing unrelated Swift test code
  • History rewritten to remove secrets from GitHub secret scanning block list

Changes

  • Credentials now loaded from GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET env vars
  • ESLint + Vitest configured (from previous commits)
  • Security: Blocked push issue resolved

SWAL Agent added 2 commits March 22, 2026 17:00
…ed .txt files

- Replaced ANTIGRAVITY_CLIENT_ID/SECRET with env var getters
- Removed 5MB of unrelated Swift test code files
- These were flagged by GitHub secret scanning as containing false positives
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 22, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e53ca400-e879-447e-99b6-69c15b8d66aa

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/integration-1774210414034

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on enhancing the security and cleanliness of the repository. It addresses the critical issue of hardcoded credentials by switching to environment variables, removes unnecessary files to reduce the repo size, and ensures that no secrets are exposed in the repository's history.

Highlights

  • Security: Hardcoded Google OAuth credentials have been replaced with environment variable getters, enhancing security.
  • Repository Cleanup: Removed three large, unrelated .txt files, reducing the repository size by 5MB.
  • Configuration: ESLint and Vitest configurations have been added (from previous commits).
  • History: Rewrote history to remove secrets from the GitHub secret scanning block list.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request successfully removes hardcoded Google OAuth credentials, replacing them with environment variables, which is a great security improvement. It also adds new documentation and a large Rust module for monitoring API usage. My review focuses on improving the robustness and maintainability of the new Rust code and fixing some issues in the new documentation files. Specifically, I've pointed out areas with brittle error handling, hardcoded values that should be constants, and incorrect information in the documentation.

Comment thread src-tauri/src/monitor.rs
match response {
Ok(res) => {
if res.status().is_success() {
let body = res.text().await.unwrap_or_default();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Using unwrap_or_default() here hides potential errors when reading the response body. If res.text().await fails, the function will proceed with an empty string, which will then cause serde_json::from_str to fail (though that error is also suppressed by unwrap_or). This can lead to silent failures where the function appears to succeed but returns mock data, even when a real error occurred. The error should be handled explicitly.


## Project Overview

**Location:** `E:/scripts-python/ai-monitor`
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The file path E:/scripts-python/ai-monitor is a hardcoded absolute path specific to a local machine. This is not portable and exposes information about the local file system. It should be replaced with a relative path, a placeholder, or removed if not essential.

Suggested change
**Location:** `E:/scripts-python/ai-monitor`
**Location:** `<project-root>`

Comment thread CLAUDE.md

```bash
# Instalar dependencias
npm test
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The command under # Instalar dependencias (Install dependencies) should be npm install to install dependencies, not npm test which runs tests.

Suggested change
npm test
npm install

Comment thread src-tauri/src/monitor.rs
Comment on lines +50 to +68
if diff > 10.0 {
Some(UsagePace {
percentage: diff,
label: "ahead".to_string(),
emoji: "Ôåæ".to_string(),
})
} else if diff < -10.0 {
Some(UsagePace {
percentage: diff.abs(),
label: "behind".to_string(),
emoji: "Ôåô".to_string(),
})
} else {
Some(UsagePace {
percentage: 0.0,
label: "on_track".to_string(),
emoji: "Ô£ô".to_string(),
})
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The emoji strings appear to be garbled, likely due to an encoding issue. These will not render as the intended emojis. They should be replaced with the actual Unicode emoji characters for 'ahead', 'behind', and 'on_track'.

Suggested change
if diff > 10.0 {
Some(UsagePace {
percentage: diff,
label: "ahead".to_string(),
emoji: "Ôåæ".to_string(),
})
} else if diff < -10.0 {
Some(UsagePace {
percentage: diff.abs(),
label: "behind".to_string(),
emoji: "Ôåô".to_string(),
})
} else {
Some(UsagePace {
percentage: 0.0,
label: "on_track".to_string(),
emoji: "Ô£ô".to_string(),
})
}
if diff > 10.0 {
Some(UsagePace {
percentage: diff,
label: "ahead".to_string(),
emoji: "🚀".to_string(),
})
} else if diff < -10.0 {
Some(UsagePace {
percentage: diff.abs(),
label: "behind".to_string(),
emoji: "🐢".to_string(),
})
} else {
Some(UsagePace {
percentage: 0.0,
label: "on_track".to_string(),
emoji: "".to_string(),
})
}

Comment thread src-tauri/src/monitor.rs
let response = client
.get("https://chatgpt.com/backend-api/accounts/check/v4-2023-04-27")
.header("Authorization", format!("Bearer {}", token))
.header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This User-Agent string is hardcoded. It's better to define it as a constant to improve maintainability and avoid magic strings. This also makes it easier to update if needed.

Comment thread src-tauri/src/monitor.rs
Comment on lines +266 to +271
fn get_google_client_id() -> String {
std::env::var("GOOGLE_CLIENT_ID").unwrap_or_else(|_| "YOUR_GOOGLE_CLIENT_ID".to_string())
}
fn get_google_client_secret() -> String {
std::env::var("GOOGLE_CLIENT_SECRET").unwrap_or_else(|_| "YOUR_GOOGLE_CLIENT_SECRET".to_string())
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using unwrap_or_else to provide placeholder credentials when environment variables are not set can lead to confusing runtime errors, as the application will try to authenticate with invalid credentials. It's better to fail fast at startup if these environment variables are required. Using .expect() will cause the application to panic with a clear error message, immediately indicating the configuration issue.

Suggested change
fn get_google_client_id() -> String {
std::env::var("GOOGLE_CLIENT_ID").unwrap_or_else(|_| "YOUR_GOOGLE_CLIENT_ID".to_string())
}
fn get_google_client_secret() -> String {
std::env::var("GOOGLE_CLIENT_SECRET").unwrap_or_else(|_| "YOUR_GOOGLE_CLIENT_SECRET".to_string())
}
fn get_google_client_id() -> String {
std::env::var("GOOGLE_CLIENT_ID").expect("GOOGLE_CLIENT_ID must be set")
}
fn get_google_client_secret() -> String {
std::env::var("GOOGLE_CLIENT_SECRET").expect("GOOGLE_CLIENT_SECRET must be set")
}

Comment thread src-tauri/src/monitor.rs
match refresh_google_token(token_or_refresh, &get_google_client_id(), &get_google_client_secret()).await {
Ok(t) => t,
Err(e) => {
let is_unauthorized_client = e.to_lowercase().contains("unauthorized_client");
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Checking for substrings in a formatted error string (e.to_lowercase().contains("unauthorized_client")) is brittle and can break if the error message format changes. A more robust approach would be to have refresh_google_token return a structured error. The error response from Google's token endpoint is typically JSON, which can be parsed to extract a specific error code (e.g., unauthorized_client). This would allow for more reliable error handling.

Comment thread src-tauri/src/monitor.rs
token_or_refresh.to_string()
};

let user_agent = "antigravity/1.11.3 Darwin/arm64";
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This User-Agent string is hardcoded. It's better to define it as a constant to improve maintainability and avoid magic strings. This also makes it easier to update if needed.

@socket-security
Copy link
Copy Markdown

socket-security Bot commented Mar 23, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​@​typescript-eslint/​parser@​8.57.11001007198100
Addednpm/​@​typescript-eslint/​eslint-plugin@​8.57.1991008098100
Updatednpm/​vite@​6.4.1 ⏵ 8.0.194 +81008299100
Addednpm/​eslint-config-prettier@​10.1.810010010087100
Addednpm/​eslint@​10.1.08910010097100

View full report

SWAL Agent added 2 commits March 23, 2026 08:12
- ESLint configured via security-quality-fixer
- npm audit fix applied
- Daily security fix 2026-03-23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant