Pin Hugging Face commit revisions for AuK weight downloads and eliminate post-download SHA TOCTOU

Đang mở Phù hợp với người mới
#18,141 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
62/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
git, huggingface, javascript, node.js, python
Lĩnh vực
ai, backend, security

Hướng nghiên cứu

Bắt đầu từ server/services/voice/aukRuntime.js: AUK_WEIGHT_SOURCES quanh các dòng 21-24 cần một revision hex 40 ký tự cho mỗi repo, còn lệnh gọi Python snapshot_download quanh các dòng 81-87 cần nhận giá trị đó qua sys.argv[3]. Sau đó xóa lần tra cứu thứ hai HfApi().model_info(repo).sha và ghi revision đã ghim vào portos-source.json. Cập nhật server/services/voice/aukRuntime.test.js để kiểm tra rằng mọi lần tải xuống đều truyền một revision hex 40 ký tự và ghi nhận cùng giá trị đó. Hoàn thành khi các test đều đạt và không còn lệnh gọi model_info nào.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

area:voice better-dependency-freedom dependencies effort:low in-progress model:medium plan planner:gemini-4-neon-high priority:2 security

Problem

server/services/voice/aukRuntime.js pins the AuK git checkout (AUK_REVISION at line 18), private uv, and hash-locked Python packages (auk-mlx at line 76), but AUK_WEIGHT_SOURCES (aukRuntime.js:21-24) omits commit revision pins for tencent/AuK-Flash and Qwen/Qwen2.5-Omni-3B. At lines 81-87 it runs snapshot_download(repo_id=repo, local_dir=str(dest)) against floating main, then makes a separate post-download HfApi().model_info(repo).sha call to stamp portos-source.json (TOCTOU mismatch risk).

Impact

New AuK setups pull unreviewed floating main model files from two external Hugging Face repositories directly into auk_mlx.convert despite locking the git repo and Python closure, and the post-download model_info call can record a different SHA than the snapshot actually downloaded.

Decided Fix

Add an immutable 40-char hex revision field to each entry in AUK_WEIGHT_SOURCES (server/services/voice/aukRuntime.js:21-24), pass it as sys.argv[3] into snapshot_download(repo_id=repo, revision=rev, local_dir=str(dest)) (aukRuntime.js:81-87), and write that exact rev directly into portos-source.json instead of making a second post-download HfApi().model_info(repo).sha query. Update server/services/voice/aukRuntime.test.js to verify the pinned revision argument.

Affected Files

  • server/services/voice/aukRuntime.js
  • server/services/voice/aukRuntime.test.js

Acceptance Criteria

  • Each entry in AUK_WEIGHT_SOURCES in server/services/voice/aukRuntime.js declares an immutable 40-char hex Hugging Face commit SHA (revision).
  • startAukSetup passes revision=sys.argv[3] directly to snapshot_download(repo_id=repo, revision=rev, local_dir=str(dest)) and writes that exact pinned revision to portos-source.json without a second post-download HfApi().model_info(repo) network call.
  • server/services/voice/aukRuntime.test.js asserts that every AuK weight download passes a 40-char hex revision to snapshot_download and records that same revision.

Origin: PortOS better-dependency-freedom baseline audit (2026-11-24) · Severity: 6/10

Ngôn ngữ chính
JavaScript
Star
38
Fork
32
Merge trung bình
20 phút
Pull request đã merge (30 ngày)
996

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của atomantic/PortOS

Tất cả issue của atomantic/PortOS

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.