Skip to content

보안: canonicalFile 심볼릭 링크 우회 취약점 수정#74

Open
seonghobae wants to merge 1 commit into
masterfrom
fix-symlink-resolution-vuln-647674770020108452
Open

보안: canonicalFile 심볼릭 링크 우회 취약점 수정#74
seonghobae wants to merge 1 commit into
masterfrom
fix-symlink-resolution-vuln-647674770020108452

Conversation

@seonghobae

Copy link
Copy Markdown
Collaborator

보안 취약점 수정 내역

File(topDir).canonicalFile를 사용하여 시작 디렉토리를 처리할 때, 사용자가 심볼릭 링크를 입력하면 canonicalFile이 의도치 않게 심볼릭 링크를 실제 경로로 해석해버리는 취약점이 존재했습니다. 이로 인해 후속 isDirectory(..., LinkOption.NOFOLLOW_LINKS) 검사가 우회되어 원래 제한하려던 심볼릭 링크 디렉토리가 허용될 수 있었습니다.

이 패치는 경로를 정규화만 하고 파일 시스템에서 실제 경로를 추적하지 않는 .toPath().toAbsolutePath().normalize().toFile() 방식을 사용하도록 코드를 변경합니다.

  • Vulnerability: 경로 탐색 및 심볼릭 링크 검사 우회
  • Fix: canonicalFile 제거 후 정규화 방식 사용
  • Tests: 누락된 분기에 대한 커버리지를 높이기 위해 새로운 단위 테스트를 추가했습니다.
  • Journal: Sentinel 규정에 따라 보안 학습 내용을 .jules/sentinel.md에 한국어로 추가 기록했습니다.

PR created automatically by Jules for task 647674770020108452 started by @seonghobae

canonicalFile이 심볼릭 링크를 실제 경로로 자동 변환하여 발생하는 경로 탐색 및 심볼릭 링크 제한 우회 취약점을 수정했습니다.
- File(topDir).canonicalFile 대신 File(topDir).toPath().toAbsolutePath().normalize().toFile()를 사용하여 심볼릭 링크를 유지하도록 변경.
- 테스트 커버리지를 높이기 위해 추가 단위 테스트 구현.
- .jules/sentinel.md에 해당 취약점에 대한 Sentinel 학습 기록 작성.
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@opencode-agent opencode-agent 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.

Pull request overview

OpenCode exhausted the configured model pool without a usable current-head review conclusion. This is not approval evidence, so the PR is blocked until a source-backed review can establish approval sufficiency or identify concrete fixes.

Findings

1. HIGH .jules/sentinel.md:1 - OpenCode could not establish approval sufficiency

  • Problem: every configured model path failed to produce a usable current-head control block.
  • Root cause: model execution, timeout, export, normalization, or approval-gate validation did not complete after exponential retry across the configured model pool.
  • Impact: approving from deterministic check state alone would miss PR-intent mismatches, missing files, edge-case bugs, robustness gaps, UX/DX regressions, security issues, and CodeGraph-backed base/head flow changes.
  • Fix: rerun OpenCode after model availability recovers, or update the PR with the missing files, tests, docs, generated artifacts, and verification evidence needed for a source-backed review conclusion.
  • Regression test: keep the approval gate posting REQUEST_CHANGES, not APPROVE or check-only failure, when no model produces a valid current-head review.

Summary

  • Result: REQUEST_CHANGES
  • Reason: coverage-evidence passed and peer GitHub Checks completed without failures, but no model produced a valid review control block.
  • Deterministic evidence checked but not used for approval: current-head changed-file evidence (.jules/sentinel.md, patch_test.diff, src/main/kotlin/html4tree/main.kt, src/test/kotlin/html4tree/MainTest.kt); coverage-evidence result success; peer checks from statusCheckRollup excluding this OpenCode check.
  • Model outcome: model_pool=exhausted; selected_model=none.
  • Head SHA: 192c1dc866f60f89f829c3c59073636313d811f7
  • Workflow run: 28476711148
  • Workflow attempt: 1

No PR approval was posted because model-output failure is not evidence that the PR has no blockers.

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Changed file (4 files)"]
  S1 --> I1["repository behavior"]
  I1 --> R1["Review risk: Changed file (4 files)"]
  R1 --> V1["required checks"]
Loading

Comment thread .jules/sentinel.md
**Vulnerability:** Defense in Depth (CSP Missing)
**Learning:** Even when inputs are properly escaped, statically generated HTML that displays file/directory structures should implement a Content Security Policy (CSP) to provide an extra layer of defense against potential XSS bypasses.
**Prevention:** Include a strict CSP meta tag (e.g., `default-src 'none'; style-src 'unsafe-inline';`) in auto-generated HTML headers when external scripts or resources are not required.

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 OpenCode could not establish approval sufficiency

  • Problem: the model pool exhausted without a valid current-head review control block, so this changed line cannot be approved from deterministic check state alone.
  • Impact: PR-intent mismatches, missing files, robustness bugs, UX/DX regressions, and CodeGraph-backed flow changes could be missed.
  • Fix: rerun OpenCode after model availability recovers, or add the missing source/test/docs/generated verification evidence needed for a source-backed approval.
  • Verification: rerun the OpenCode Review workflow and confirm it emits APPROVE or source-backed REQUEST_CHANGES for this head SHA.

@opencode-agent

Copy link
Copy Markdown

OpenCode Review Overview

  • Head SHA: 192c1dc866f60f89f829c3c59073636313d811f7
  • Workflow run: 28476711148
  • Workflow attempt: 1
  • Gate result: REQUEST_CHANGES (approval step)

Pull request overview

OpenCode exhausted the configured model pool without a usable current-head review conclusion. This is not approval evidence, so the PR is blocked until a source-backed review can establish approval sufficiency or identify concrete fixes.

Findings

1. HIGH .jules/sentinel.md:1 - OpenCode could not establish approval sufficiency

  • Problem: every configured model path failed to produce a usable current-head control block.
  • Root cause: model execution, timeout, export, normalization, or approval-gate validation did not complete after exponential retry across the configured model pool.
  • Impact: approving from deterministic check state alone would miss PR-intent mismatches, missing files, edge-case bugs, robustness gaps, UX/DX regressions, security issues, and CodeGraph-backed base/head flow changes.
  • Fix: rerun OpenCode after model availability recovers, or update the PR with the missing files, tests, docs, generated artifacts, and verification evidence needed for a source-backed review conclusion.
  • Regression test: keep the approval gate posting REQUEST_CHANGES, not APPROVE or check-only failure, when no model produces a valid current-head review.

Summary

  • Result: REQUEST_CHANGES
  • Reason: coverage-evidence passed and peer GitHub Checks completed without failures, but no model produced a valid review control block.
  • Deterministic evidence checked but not used for approval: current-head changed-file evidence (.jules/sentinel.md, patch_test.diff, src/main/kotlin/html4tree/main.kt, src/test/kotlin/html4tree/MainTest.kt); coverage-evidence result success; peer checks from statusCheckRollup excluding this OpenCode check.
  • Model outcome: model_pool=exhausted; selected_model=none.
  • Head SHA: 192c1dc866f60f89f829c3c59073636313d811f7
  • Workflow run: 28476711148
  • Workflow attempt: 1

No PR approval was posted because model-output failure is not evidence that the PR has no blockers.

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Changed file (4 files)"]
  S1 --> I1["repository behavior"]
  I1 --> R1["Review risk: Changed file (4 files)"]
  R1 --> V1["required checks"]
Loading

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