Skip to content

fix(security): resolve open code scanning and Dependabot alerts - #77

Merged
yacosta738 merged 1 commit into
mainfrom
maintenance
Jun 1, 2026
Merged

yacosta738 merged 1 commit into
mainfrom
maintenance

Conversation

@yacosta738

@yacosta738 yacosta738 commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

What

Security hardening pass — resolves open GitHub Security alerts (Code Scanning + Dependabot).

Changes

Category Alert File Fix
Dockerfile DS-0026 No HEALTHCHECK Dockerfile.dev Added HEALTHCHECK + curl to runtime stage
Semgrep path traversal tainted-path apps/rook/src/main.rs Moved nosemgrep from RookConfig::load to the two CLI-level call sites (load_config, load_config_with_path)
Gitleaks Generic secrets in tests .gitleaks.toml Narrowed allowlist to test-only paths; removed manage_connections.rs and set_admin_password.rs (production code now fully scanned)
Gitleaks Generic secrets in tests manage_connections.rs Test OAuth fixtures kept with inline nosemgrep
Dependabot atty unmaintained (GHSA-g98v-hv3f-hcfr) Cargo.toml, main.rs Replaced atty = "0.2" with is-terminal = "0.4", idiomatic stderr().is_terminal() with use std::io::IsTerminal

Already resolved (no action needed)

Alert Reason
CodeQL #144-146 hard-coded crypto in bootstrap_status.rs Alert references commit c06d517 — file now has 214 lines and no credentials
Dependabot #1-3 (time, js-yaml, markdown-it) Already FIXED per Dependabot dashboard
Semgrep #137 temp_dir Test-only helper in shared_test_db(), not security-sensitive

Why

  • atty is unmaintained; replaced with stdlib IsTerminal (Rust 1.70+, project uses 1.89)
  • nosemgrep moved to call sites so RookConfig::load remains a clean general-purpose API
  • Gitleaks allowlist narrowed to test-only paths so production code in manage_connections.rs and set_admin_password.rs is fully scanned

Testing

  • cargo check --workspace — pre-existing dashboard/dist missing error (unrelated to these changes)
  • semgrep scan --config=auto . — 0 findings
  • git diff --stat shows only targeted changes

Related Issues

Fixes GitHub Security alerts:

@coderabbitai

coderabbitai Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR updates static analysis tooling configuration to exclude test files from gitleaks and Semgrep scanning, modernizes TTY detection to use Rust's standard library instead of the atty crate, and adds a Docker health check to the development container.

Changes

Tooling configuration and code modernization

Layer / File(s) Summary
Static analysis configuration
.gitleaks.toml, .semgrepignore, apps/rook/src/config.rs, crates/application/rook-usecases/src/manage_connections.rs
Gitleaks allowlist is extended with test file patterns, Semgrep ignores build artifacts and test directories, and code-level Semgrep suppressions are added for the tainted-path and oauth token rules.
Runtime infrastructure and dependency modernization
apps/rook/Cargo.toml, apps/rook/src/main.rs, Dockerfile.dev
The atty dependency is replaced with is-terminal, stderr TTY detection now uses std::io::IsTerminal::is_terminal(), and the development container gains a health check probe on /health.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🐰 With scan rules and health checks so fine,
Dependencies updated in line,
TTY detection grows more wise,
Tests skip Semgrep's scanning eyes,
Infrastructure code, clean and bright!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix(security): resolve open code scanning and Dependabot alerts' accurately reflects the main objective of the PR, which is addressing multiple security-related alerts across different scanning tools.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The pull request description clearly documents security hardening changes across multiple categories (Dockerfile, Semgrep, Gitleaks, Dependabot) with specific files and fixes that align with the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch maintenance

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.gitleaks.toml:
- Around line 38-39: Remove the broad allowlist entries that silence gitleaks
for entire source modules and instead target only the test fixtures or literals;
specifically, delete the patterns that reference
crates/application/rook-usecases/src/manage_connections\.rs and
crates/application/rook-usecases/src/auth/set_admin_password\.rs from
.gitleaks.toml and add narrow exceptions for the exact fake-token strings or
move those fixtures into dedicated test-only files or modules (e.g., a tests/ or
#[cfg(test)]-only file) so that production code in manage_connections.rs and
set_admin_password.rs remains scanned by gitleaks.

In `@apps/rook/Cargo.toml`:
- Line 46: Update the pinned is-terminal dependency declaration to a current
release (change the is-terminal = "0.2" entry to is-terminal = "0.4.17") so the
project uses the latest crate; alternatively, if the project's MSRV is Rust 1.70
or newer, remove the is-terminal crate usage and switch call sites referencing
the is-terminal crate to the std::io::IsTerminal trait (replace uses of the
external crate's API with std::io::IsTerminal on Read/Write types) and remove
the is-terminal entry from Cargo.toml.

In `@apps/rook/src/config.rs`:
- Around line 112-113: The nosemgrep suppression is placed inside the reusable
RookConfig::load function, which hides tainted-path findings for all callers;
remove the inline suppression from RookConfig::load (the line above let content
= std::fs::read_to_string(path)? ) so the loader remains a general-purpose API,
and instead add the nosemgrep suppression at the specific CLI-controlled call
site that constructs/passes the trusted config path (the function that parses
CLI args or the entrypoint that calls RookConfig::load with the CLI-derived
path) so only that boundary is exempted.

In `@apps/rook/src/main.rs`:
- Line 206: Import the IsTerminal trait (use std::io::IsTerminal;) near the top
of the file, then replace the fully-qualified call
IsTerminal::is_terminal(&std::io::stderr()) with the idiomatic method call
std::io::stderr().is_terminal() so the is_terminal method is invoked directly on
the stderr stream (referencing the IsTerminal trait and the stderr() call).

In `@Dockerfile.dev`:
- Around line 57-58: The HEALTHCHECK uses curl but the runtime stage based on
debian:bookworm-slim doesn't include it, so update the runtime stage in the
Dockerfile to install curl (e.g., add apt-get update && apt-get install -y
--no-install-recommends curl and cleanup /var/lib/apt/lists) so the HEALTHCHECK
CMD curl -f http://localhost:8080/health || exit 1 can run; modify the runtime
stage block that sets FROM debian:bookworm-slim and the HEALTHCHECK line to
include the curl install step and keep layers minimal.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: c309b63c-0f0c-45cf-8782-5805a8c585b9

📥 Commits

Reviewing files that changed from the base of the PR and between 10453a2 and 37e6a50.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (7)
  • .gitleaks.toml
  • .semgrepignore
  • Dockerfile.dev
  • apps/rook/Cargo.toml
  • apps/rook/src/config.rs
  • apps/rook/src/main.rs
  • crates/application/rook-usecases/src/manage_connections.rs

Comment thread .gitleaks.toml Outdated
Comment on lines +38 to +39
'''crates/application/rook-usecases/src/auth/set_admin_password\.rs''',
'''crates/application/rook-usecases/src/manage_connections\.rs''',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Don't allowlist entire source modules under src/.

These entries disable gitleaks for every line in those files, not just the fake test tokens. crates/application/rook-usecases/src/manage_connections.rs already mixes production code with #[cfg(test)] blocks, so future real secrets in the non-test path would be silently ignored by CI. Prefer a narrower suppression on the specific fixture literals or move those fixtures into dedicated test-only files.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.gitleaks.toml around lines 38 - 39, Remove the broad allowlist entries that
silence gitleaks for entire source modules and instead target only the test
fixtures or literals; specifically, delete the patterns that reference
crates/application/rook-usecases/src/manage_connections\.rs and
crates/application/rook-usecases/src/auth/set_admin_password\.rs from
.gitleaks.toml and add narrow exceptions for the exact fake-token strings or
move those fixtures into dedicated test-only files or modules (e.g., a tests/ or
#[cfg(test)]-only file) so that production code in manage_connections.rs and
set_admin_password.rs remains scanned by gitleaks.

Comment thread apps/rook/Cargo.toml Outdated
Comment thread apps/rook/src/config.rs Outdated
Comment on lines 112 to 113
// nosemgrep: rust.actix.path-traversal.tainted-path.tainted-path
let content = std::fs::read_to_string(path)?;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Keep the suppression at the trust boundary, not inside RookConfig::load.

RookConfig::load is a reusable file-reading API. Putting nosemgrep here suppresses tainted-path findings for every current and future caller, not just the CLI-controlled one that motivated this change. Prefer suppressing at the specific call site that passes the trusted config path.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/rook/src/config.rs` around lines 112 - 113, The nosemgrep suppression is
placed inside the reusable RookConfig::load function, which hides tainted-path
findings for all callers; remove the inline suppression from RookConfig::load
(the line above let content = std::fs::read_to_string(path)? ) so the loader
remains a general-purpose API, and instead add the nosemgrep suppression at the
specific CLI-controlled call site that constructs/passes the trusted config path
(the function that parses CLI args or the entrypoint that calls RookConfig::load
with the CLI-derived path) so only that boundary is exempted.

Comment thread apps/rook/src/main.rs Outdated
Comment thread Dockerfile.dev
@yacosta738
yacosta738 merged commit a4ad9d4 into main Jun 1, 2026
11 checks passed
@yacosta738
yacosta738 deleted the maintenance branch June 1, 2026 18:47
@dallay-bot dallay-bot Bot mentioned this pull request Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant