test: 보안 크리티컬 함수 유닛 테스트 20개 추가

- extractZip: ZipSlip/NTFS ADS/Symlink 차단 검증 포함
- hashFile: 정상/빈파일/미존재 케이스
- redeemTicket: httptest 기반 서버 응답 처리
- URI 파싱: 정상/파라미터 누락/잘못된 스킴

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-18 16:58:53 +09:00
parent 19b4d4895f
commit 8759587e25
2 changed files with 404 additions and 1 deletions

View File

@@ -803,9 +803,13 @@ func fetchServerInfo() (*downloadInfo, error) {
// The ticket has a 30-second TTL on the server and can only be used once.
// 재시도 불필요 — ticket은 일회용이므로 한 번 사용(또는 만료)되면 소멸.
func redeemTicket(ticket string) (string, error) {
return redeemTicketFrom(redeemTicketURL, ticket)
}
func redeemTicketFrom(url, ticket string) (string, error) {
client := &http.Client{Timeout: 10 * time.Second}
body := fmt.Sprintf(`{"ticket":"%s"}`, ticket)
resp, err := client.Post(redeemTicketURL, "application/json", strings.NewReader(body))
resp, err := client.Post(url, "application/json", strings.NewReader(body))
if err != nil {
return "", fmt.Errorf("서버에 연결할 수 없습니다: %w", err)
}