Skip to content

fix: RESCUE_GAS_URL に https スキーム検証を追加し gosec G704 を解消#381

Merged
taminororo merged 1 commit into
developfrom
fix/kanba/317-ssrf-gas-url
Jun 25, 2026
Merged

fix: RESCUE_GAS_URL に https スキーム検証を追加し gosec G704 を解消#381
taminororo merged 1 commit into
developfrom
fix/kanba/317-ssrf-gas-url

Conversation

@taminororo

Copy link
Copy Markdown
Collaborator

概要

rescue_unified_usecase.goSendRescueToGAS で、gasURLos.Getenv 由来のため gosec G704(SSRF via taint analysis)が2件報告されていた。

変更内容

gasURL == "" チェックの直後に url.Parse で https スキームのみ許可する検証を追加した。

parsedURL, err := url.Parse(gasURL)
if err != nil || parsedURL.Scheme != "https" {
    return errors.New("RESCUE_GAS_URL が不正です(https のみ許可)")
}

gosec の taint analysis は検証後も os.Getenv 由来の変数を汚染追跡し続けるため、警告を完全に消すには //nolint:gosec を理由コメントつきで付与した。

対応の意図

  • url.Parse による https 検証: 設定ミスで http:// や不正な URL が入った場合にエラーで弾く(実際の安全性向上)
  • //nolint:gosec: 「上で https スキームを検証済みの環境変数」という理由を明記して静的解析を抑制

残るリスク

gasURL は環境変数(運用者だけが設定可能)なので、ユーザー入力による SSRF は発生しない。https 検証により設定ミスの事故も防ぐ。

Closes #317
Refs #314

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@taminororo, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 11 minutes and 27 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

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 credits.

🚦 How do rate 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 see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 64b62746-1aa5-4c81-8e2c-b13461a1976a

📥 Commits

Reviewing files that changed from the base of the PR and between b082882 and a359a48.

📒 Files selected for processing (1)
  • api/lib/usecase/rescue_unified_usecase.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/kanba/317-ssrf-gas-url

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.

@taminororo taminororo merged commit d3e569e into develop Jun 25, 2026
2 checks passed
@taminororo taminororo deleted the fix/kanba/317-ssrf-gas-url branch June 25, 2026 05:25
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.

[Go static] gosec G704: SSRF 指摘の対応 (2件・要レビュー)

1 participant