Skip to content

fix(security): resolve open Dependabot and CodeQL alerts#21

Merged
adityathebe merged 2 commits into
mainfrom
claude/session-6w2in1
Jul 21, 2026
Merged

fix(security): resolve open Dependabot and CodeQL alerts#21
adityathebe merged 2 commits into
mainfrom
claude/session-6w2in1

Conversation

@adityathebe

@adityathebe adityathebe commented Jul 21, 2026

Copy link
Copy Markdown
Member

Fixes the two open CodeQL alerts and all three open Dependabot alerts:

go build ./... and go test ./pkg/cli/ pass.


Generated by Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Strengthened protection against directory traversal in catalog path handling, including normalized paths containing ...
    • Updated spreadsheet and document processing components for improved compatibility and reliability.
  • Documentation

    • Updated the documentation site framework and tightened a YAML parser version requirement.
  • Tests

    • Expanded coverage for path traversal attempts that remain within the workspace.

- Bump github.com/xuri/excelize/v2 from 2.10.1 to 2.11.0 (checkSheet
  unbounded row allocation DoS, Dependabot #10)
- Bump astro to 7.1.3 in docs (reflected XSS via View Transition
  animation properties, Dependabot #11)
- Force js-yaml >=4.3.0 in docs via pnpm override (quadratic CPU from
  merge-key chains, CVE-2026-59869, Dependabot #12)
- Reject ".." traversal sequences in the permission catalog dir
  parameter before building paths (CodeQL #16, #17)
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@adityathebe, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 30 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 56b7c313-7df0-451a-8dbe-31e971abfdda

📥 Commits

Reviewing files that changed from the base of the PR and between 02a7955 and d2debc3.

📒 Files selected for processing (2)
  • pkg/cli/ai.go
  • pkg/cli/prompt_run_stream.go

Walkthrough

Dependency constraints are updated for documentation and Go modules. Catalog directory resolution now rejects raw .. path segments, with expanded tests covering normalized traversal inputs.

Changes

Dependency updates

Layer / File(s) Summary
Update dependency constraints
docs/package.json, go.mod
Astro, js-yaml, mscfb, and excelize dependency constraints are updated.

Catalog path validation

Layer / File(s) Summary
Reject traversal segments
pkg/cli/permission_catalog.go, pkg/cli/permission_catalog_test.go
resolveCatalogDir rejects raw inputs containing ..; tests add coverage for traversal that normalizes within the workspace.

Possibly related PRs

Suggested reviewers: moshloop

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main security-focused dependency and path-validation fixes in this PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/session-6w2in1
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch claude/session-6w2in1

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.

@socket-security

socket-security Bot commented Jul 21, 2026

Copy link
Copy Markdown

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

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​astro@​7.1.3661008798100

View full report

@socket-security

socket-security Bot commented Jul 21, 2026

Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn High
Obfuscated code: npm astro is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: docs/package.jsonnpm/astro@7.1.3

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/astro@7.1.3. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 `@pkg/cli/permission_catalog.go`:
- Around line 49-53: Update the traversal validation in the directory-handling
function to reject only exact ".." path components after splitting or
normalizing the input, rather than any substring match. Preserve rejection of
actual traversal segments while allowing legitimate names such as
"reports..archive", and add a regression test covering that valid directory
name.
🪄 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: CHILL

Plan: Pro

Run ID: 9b312728-6a64-476d-9fc6-c58a3e3676e6

📥 Commits

Reviewing files that changed from the base of the PR and between bf94d0c and 02a7955.

⛔ Files ignored due to path filters (2)
  • docs/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (4)
  • docs/package.json
  • go.mod
  • pkg/cli/permission_catalog.go
  • pkg/cli/permission_catalog_test.go

Comment on lines +49 to +53
// Reject traversal sequences in the raw input before any path is built;
// the prefix check below is defense in depth.
if strings.Contains(dir, "..") {
return "", fmt.Errorf("dir %q contains a path traversal sequence", dir)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Reject .. path segments, not arbitrary substrings.

strings.Contains rejects valid directory names such as reports..archive, even though they do not perform traversal. Check normalized path components for an exact .. segment and add a regression test for a legitimate double-dot directory name.

Proposed fix
-	if strings.Contains(dir, "..") {
-		return "", fmt.Errorf("dir %q contains a path traversal sequence", dir)
+	for _, segment := range strings.Split(filepath.ToSlash(dir), "/") {
+		if segment == ".." {
+			return "", fmt.Errorf("dir %q contains a path traversal sequence", dir)
+		}
 	}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Reject traversal sequences in the raw input before any path is built;
// the prefix check below is defense in depth.
if strings.Contains(dir, "..") {
return "", fmt.Errorf("dir %q contains a path traversal sequence", dir)
}
// Reject traversal sequences in the raw input before any path is built;
// the prefix check below is defense in depth.
for _, segment := range strings.Split(filepath.ToSlash(dir), "/") {
if segment == ".." {
return "", fmt.Errorf("dir %q contains a path traversal sequence", dir)
}
}
🤖 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 `@pkg/cli/permission_catalog.go` around lines 49 - 53, Update the traversal
validation in the directory-handling function to reject only exact ".." path
components after splitting or normalizing the input, rather than any substring
match. Preserve rejection of actual traversal segments while allowing legitimate
names such as "reports..archive", and add a regression test covering that valid
directory name.

@adityathebe
adityathebe merged commit 9d7723f into main Jul 21, 2026
10 of 11 checks passed
@adityathebe
adityathebe deleted the claude/session-6w2in1 branch July 21, 2026 10:36
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.

2 participants