-
Notifications
You must be signed in to change notification settings - Fork 0
feat(plugins): setup skips credentials when the machine env file holds a key (FIRE-2135) #56
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 all commits
acc1986
690d112
0c53872
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 |
|---|---|---|
|
|
@@ -12,6 +12,12 @@ rogue_env_is_trusted() ( | |
| [ "$((0$mode & 022))" = 0 ] | ||
| ) | ||
|
|
||
| # A candidate file "holds a key" when ROGUE_API_KEY is assigned a non-empty | ||
| # value - the same test every reader makes before selecting it. | ||
| rogue_env_has_key() { # rogue_env_has_key <file> | ||
| [ -r "$1" ] && grep -Eq "^[[:space:]]*(export[[:space:]]+)?ROGUE_API_KEY=[\"']?[^\"'[:space:]]" "$1" | ||
|
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. 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift Make machine-file detection use the final effective The shell detectors accept any non-empty assignment. A later The PowerShell detectors and Make each setup detector evaluate the final effective assignment. Update the shell hook loaders to use the same check before sourcing and stopping. Apply this to the corresponding shell, PowerShell, and Gemini detector copies. Add coverage for a non-empty assignment followed by 🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
| rogue_source_env() { | ||
| if rogue_env_is_trusted "$1" "${2:-0}"; then | ||
| . "$1" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,15 @@ Help the user set up their Rogue Security AIDR integration for Google Antigravit | |
|
|
||
| ## Step 1: Check existing configuration | ||
|
|
||
| Check the machine env file first: | ||
|
|
||
| - macOS / Linux: `grep -q ROGUE_API_KEY /etc/rogue/env 2>/dev/null && echo machine || echo none` | ||
|
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. 🟠 High The machine probe treats any occurrence of Also found in 5 other location(s)
🚀 Reply "fix it for me" or copy this AI Prompt for your agent: |
||
| - Windows: `if (Test-Path "$env:ProgramData\rogue\env") { Select-String -Path "$env:ProgramData\rogue\env" -Pattern ROGUE_API_KEY -Quiet } else { $false }` | ||
|
Comment on lines
+16
to
+17
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. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win Validate trust and a non-empty key before machine-file precedence. Each command only finds the text
🧰 Tools🪛 SkillSpector (2.9.6)[error] 10: [AS1] Agent Config Directory Access: Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access. Remediation: Remove all code or instructions that access agent configuration directories (.claude/, .codex/, .gemini/). If configuration values are needed, pass them explicitly as parameters or environment variables — never read the agent's own config files. (Agent Snooping (AS1)) [warning] 41: [E1] External Transmission: Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended. Remediation: Verify the destination URL is trusted and necessary. Remove or replace with documented APIs. Ensure no secrets, tokens, or PII are transmitted. (Data Exfiltration (E1)) [warning] 47: [E1] External Transmission: Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended. Remediation: Verify the destination URL is trusted and necessary. Remove or replace with documented APIs. Ensure no secrets, tokens, or PII are transmitted. (Data Exfiltration (E1)) 📍 Affects 3 files
🤖 Prompt for AI Agents |
||
|
|
||
| A machine env file that holds `ROGUE_API_KEY` and is owned by root (SYSTEM/Administrators on Windows) is the file the hooks read, alone, so credentials are already configured: say so and stop, without writing the user env file. | ||
|
|
||
| Otherwise check the user env file: | ||
|
|
||
| - macOS / Linux: `test -f ~/.rogue-env && echo "exists" || echo "not found"` | ||
| - Windows: `if (Test-Path "$env:USERPROFILE\.rogue-env") { 'exists' } else { 'not found' }` | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -34,6 +34,19 @@ function Test-RogueEnvFile { | |||||
| } catch { return $false } | ||||||
| } | ||||||
|
|
||||||
| # A candidate file "holds a key" when ROGUE_API_KEY is assigned a non-empty | ||||||
| # value - the same test every reader makes before selecting it. | ||||||
| function Test-RogueEnvFileHasKey { | ||||||
| param([string]$Path) | ||||||
| # Guard the read: -Encoding is a FileSystem-provider dynamic parameter, and a | ||||||
| # Windows machine path evaluated off Windows resolves to no provider at all. | ||||||
| if (-not (Test-Path -LiteralPath $Path -PathType Leaf)) { return $false } | ||||||
| foreach ($line in (Get-Content -LiteralPath $Path -Encoding UTF8 -ErrorAction SilentlyContinue)) { | ||||||
| if ($line -match '^\s*(?:export\s+)?ROGUE_API_KEY=["'']?[^"''\s]') { return $true } | ||||||
|
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. 🟡 Medium
Suggested change
Also found in 2 other location(s)
🚀 Reply "fix it for me" or copy this AI Prompt for your agent: |
||||||
| } | ||||||
| return $false | ||||||
| } | ||||||
|
|
||||||
| function Read-RogueEnvFile { | ||||||
| param([string]$Path) | ||||||
| if (Test-RogueEnvFile $Path -System:($Path -eq 'C:\ProgramData\rogue\env')) { | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,15 @@ Help the user set up their Rogue Security AIDR integration for Cursor. Follow th | |
|
|
||
| ## Step 1: Check existing configuration | ||
|
|
||
| Check the machine env file first: | ||
|
|
||
| - macOS / Linux: `grep -q ROGUE_API_KEY /etc/rogue/env 2>/dev/null && echo machine || echo none` | ||
| - Windows: `if (Test-Path "$env:ProgramData\rogue\env") { Select-String -Path "$env:ProgramData\rogue\env" -Pattern ROGUE_API_KEY -Quiet } else { $false }` | ||
|
Comment on lines
+16
to
+17
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. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Use the runtime key and trust checks in setup guidance. Both command variants search only for the
📍 Affects 2 files
🤖 Prompt for AI Agents |
||
|
|
||
| A machine env file that holds `ROGUE_API_KEY` and is owned by root (SYSTEM/Administrators on Windows) is the file the hooks read, alone, so credentials are already configured: say so and stop, without writing the user env file. | ||
|
|
||
| Otherwise check the user env file: | ||
|
|
||
| - macOS / Linux: `test -f ~/.rogue-env && echo exists || echo missing` | ||
| - Windows: `if (Test-Path "$env:USERPROFILE\.rogue-env") { 'exists' } else { 'missing' }` | ||
|
|
||
|
|
||
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.
🟠 High
scripts/env-file.ps1:45Test-RogueEnvFileHasKeyreturnstruefor any earlier non-empty assignment, soROGUE_API_KEY=oldfollowed byROGUE_API_KEY=makes setup skip the user file even though the readers use the final empty value and find no credentials. Parse the assignments using last-value semantics and test the effective value instead.Also found in 4 other location(s)
plugins/gemini/scripts/shared.mjs:63plugins/rogue/scripts/env-file.ps1:45scripts/shared/env-file.ps1:45scripts/shared/env-file.sh:18🚀 Reply "fix it for me" or copy this AI Prompt for your agent: