-
Notifications
You must be signed in to change notification settings - Fork 0
fix(vuln): PR #64 리뷰 후속 — per-repo 격리 강화 + expanduser + 타입힌트 #65
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
Merged
+76
−17
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -206,7 +206,7 @@ def resolve_semgrep_binary(binary: str) -> str | None: | |||||||||||||
| resolved = shutil.which(binary) | ||||||||||||||
| if resolved is not None: | ||||||||||||||
| return resolved | ||||||||||||||
| candidate = Path(binary) | ||||||||||||||
| candidate = Path(binary).expanduser() | ||||||||||||||
| if candidate.is_absolute() and candidate.exists(): | ||||||||||||||
| return str(candidate) | ||||||||||||||
|
Comment on lines
+209
to
211
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. 바이너리 경로가 디렉토리가 아닌 실제 파일인지 확인하기 위해
Suggested change
|
||||||||||||||
| return None | ||||||||||||||
|
|
@@ -312,12 +312,12 @@ def _scan_one_catalog_repo( | |||||||||||||
| artifact_path = ( | ||||||||||||||
| artifact_root / _safe_repo_dir(entry.repo_id) / f"{request.scan_run_id}.jsonl" | ||||||||||||||
| ) | ||||||||||||||
| if artifact_path.exists(): | ||||||||||||||
| raise ValueError( | ||||||||||||||
| f"refusing to clobber existing vuln artifact: {artifact_path}" | ||||||||||||||
| ) | ||||||||||||||
|
|
||||||||||||||
| try: | ||||||||||||||
| if artifact_path.exists(): | ||||||||||||||
| raise ValueError( | ||||||||||||||
| f"refusing to clobber existing vuln artifact: {artifact_path}" | ||||||||||||||
| ) | ||||||||||||||
| result = run_vulnerability_scan( | ||||||||||||||
| ScanVulnerabilityRequest( | ||||||||||||||
| root=cache_path, | ||||||||||||||
|
|
@@ -337,6 +337,15 @@ def _scan_one_catalog_repo( | |||||||||||||
| status=status, | ||||||||||||||
| detail=_short_detail(exc), | ||||||||||||||
| ) | ||||||||||||||
| except Exception as exc: # noqa: BLE001 - per-repo isolation: one repo's | ||||||||||||||
| # unexpected failure (clobber guard, import/SARIF errors, ...) must never | ||||||||||||||
| # abort the whole catalog pass; record it as a scan-error outcome. | ||||||||||||||
| return RepoScanOutcome( | ||||||||||||||
| repo_id=entry.repo_id, | ||||||||||||||
| repo_url=entry.repo_url, | ||||||||||||||
| status="scan-error", | ||||||||||||||
| detail=_short_detail(exc), | ||||||||||||||
| ) | ||||||||||||||
|
|
||||||||||||||
| return RepoScanOutcome( | ||||||||||||||
| repo_id=entry.repo_id, | ||||||||||||||
|
|
||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
일반 규칙에 따르면, 주 트랜잭션에 영향을 주지 않는 베스트 에포트(best-effort) 성격의 비트랜잭션 보조 작업(예: 알림 파일 추가, 로그 기록 등)은 개별적으로 인라인 try-except 블록을 반복하기보다, 일시적인 실패를 잡아내고 exc_info와 함께 로그를 남긴 후 메인 프로세스를 계속 진행시키는 중앙 집중식 헬퍼 함수를 통해 라우팅해야 합니다.
_append_freshness_notification작업을 이러한 공통 헬퍼 함수를 사용하도록 수정하는 것을 권장합니다.References