Skip to content

Harden release artifact extraction#202

Merged
seonghobae merged 1 commit into
developfrom
fix/build-baseline-artifact-warning
May 1, 2026
Merged

Harden release artifact extraction#202
seonghobae merged 1 commit into
developfrom
fix/build-baseline-artifact-warning

Conversation

@seonghobae
Copy link
Copy Markdown
Owner

Summary

  • Switch build-baseline release artifact downloads to skip-decompress: true and extract with repo-owned validation before release asset selection.
  • Add a release artifact ZIP extractor that rejects unsafe members, symlinks, oversized files, aggregate extraction DoS, duplicate names, and unexpected filenames.
  • Extend supply-chain policy verification and tests so action-owned decompression and spoofed extractor/skip-decompress guards cannot return silently.

Validation

  • uv run --project services/analysis-engine pytest services/analysis-engine/tests/test_supply_chain_policy.py -q → 102 passed
  • uv run --project services/analysis-engine ruff check scripts/release/extract_release_artifacts.py scripts/checks/verify_supply_chain.py services/analysis-engine/tests/test_supply_chain_policy.py → All checks passed
  • python3 scripts/checks/verify_supply_chain.py → Supply-chain verification passed
  • python3 scripts/checks/security_gates.py → Security pattern gate passed
  • git diff --check → no output

Security Notes

  • Release artifact ZIPs are untrusted CI supply-chain inputs until repo-owned extraction and select_release_assets.py validation complete.
  • Extraction fails closed on absolute paths, traversal, directories, ZIP symlink entries, symlinked input/output paths, duplicate members, per-member size overrun, aggregate size overrun, and excessive file count.
  • Workflow guard checks require skip-decompress: true under the download-artifact with: mapping and a required, non-conditional extractor step before release asset validation.

Closes #201.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 1, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: ef022ae4-2443-4e4d-9b8e-a9f5a7b44556

📥 Commits

Reviewing files that changed from the base of the PR and between 18a6c31 and 02962b5.

📒 Files selected for processing (4)
  • .github/workflows/build-baseline.yml
  • scripts/checks/verify_supply_chain.py
  • scripts/release/extract_release_artifacts.py
  • services/analysis-engine/tests/test_supply_chain_policy.py

📝 Walkthrough

Summary by CodeRabbit

릴리스 노트

  • 개선사항
    • 릴리스 아티팩트 다운로드 및 검증 프로세스가 강화되었습니다.
    • 공급망 보안 검증이 향상되어 더욱 안전한 릴리스 배포를 보장합니다.
    • 아티팩트 추출 및 검사 로직이 추가되어 릴리스 품질이 높아졌습니다.

Walkthrough

빌드 워크플로우에서 actions/download-artifact 작업을 사용한 아티팩트 다운로드 처리 방식을 변경합니다. 이제 아티팩트를 압축된 상태로 다운로드한 후, 새로운 저장소 자체 검증 및 추출 스크립트를 통해 엄격한 파일 목록 검증, 경로 이동 방지, 심볼릭 링크 거부 등의 보안 검사를 수행합니다.

Changes

Cohort / File(s) Summary
워크플로우 수정
.github/workflows/build-baseline.yml
publish-immutable-release 작업이 아티팩트를 압축된 상태로 downloaded-artifacts 디렉토리에 다운로드한 후, 새로운 추출 스크립트를 호출하여 최종 artifacts 디렉토리로 변환하도록 변경됨.
공급망 검증 로직
scripts/checks/verify_supply_chain.py
릴리스 아티팩트 다운로드에 대한 skip-decompress: true 강제 요구, 추출기 단계의 필수 배치, 추출기가 자산 검증 이전에 실행되는지 확인하는 새로운 공급망 체크 추가 (+137 줄)
아티팩트 추출 스크립트
scripts/release/extract_release_artifacts.py
ZIP 파일 검증 및 안전한 추출을 수행하는 새로운 CLI: 파일명 목록 검증, 경로 이동 방지, 심볼릭 링크 거부, 파일 크기 제한 강제, 중복 파일명 탐지 (+150 줄)
보안 테스트
services/analysis-engine/tests/test_supply_chain_policy.py
공급망 정책 위반 시도(압축 해제 우회, skip-decompress 잘못된 배치) 및 추출기의 경로 이동 거부, 크기 제한 검증 등을 포함한 새로운 테스트 추가 (+274 줄)

Sequence Diagram

sequenceDiagram
    participant Workflow as build-baseline.yml
    participant Artifact as actions/download-artifact
    participant Extractor as extract_release_artifacts.py
    participant Validator as verify_supply_chain.py
    participant Output as artifacts/

    Workflow->>Artifact: 요청 (skip-decompress: true)
    Artifact-->>Workflow: ZIP 파일 반환 (압축된 상태)
    
    Workflow->>Extractor: 다운로드된 ZIP 전달
    activate Extractor
    Extractor->>Extractor: 파일명 목록 검증
    Extractor->>Extractor: 경로 이동 및 심볼릭 링크 확인
    Extractor->>Extractor: 파일 크기 제한 검증
    Extractor->>Output: 검증된 파일 추출
    Extractor-->>Workflow: 추출 완료
    deactivate Extractor
    
    Validator->>Workflow: 워크플로우 검증
    Validator->>Validator: skip-decompress: true 확인
    Validator->>Validator: 추출기 단계 실행 확인
    Validator-->>Validator: 검증 성공
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related issues

Possibly related PRs

Suggested labels

codex, aardvark

Poem

🐰 아티팩트 묶음을 풀기 전에,
부호화된 경로와 심볼릭 링크를 차단하고,
엄격한 목록으로 파일을 검증한다면,
공급망은 안전하고 깨끗해진다.
저장소의 손으로 직접 풀어야 진정 믿을 수 있다! 🔒✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Harden release artifact extraction' directly describes the main security-focused change in this PR: implementing stricter validation and security checks for artifact extraction.
Description check ✅ Passed The description clearly outlines the three main changes: switching to skip-decompress with repo-owned extraction, adding a ZIP extractor with security validations, and extending supply-chain policy verification.
Linked Issues check ✅ Passed The PR fully addresses issue #201 requirements: captures the Buffer exposure, implements skip-decompress with repo-owned safe extraction, adds strict file validation with security checks for paths/symlinks/sizes, and extends supply-chain guards and regression tests.
Out of Scope Changes check ✅ Passed All changes are directly scoped to addressing the Buffer exposure and hardening artifact extraction as specified in issue #201: workflow updates, extractor implementation, supply-chain verification extensions, and corresponding test coverage.
Docstring Coverage ✅ Passed Docstring coverage is 81.25% which is sufficient. The required threshold is 80.00%.

✏️ 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 fix/build-baseline-artifact-warning

Review rate limit: 4/5 reviews remaining, refill in 12 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

@seonghobae seonghobae marked this pull request as ready for review May 1, 2026 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Security] Remove build-baseline download-artifact Buffer exposure

1 participant