brew: pin cask signers; verify before install

Đang mở
#65 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
45/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
macos, shell
Lĩnh vực
cli, security

Hướng nghiên cứu

Start by reading install/brew, the Brewfiles it uses, and the existing install scripts; check the installed apps in /Applications to confirm each vendor's Team ID before adding pins to install/brew.d/signers. Implement the checks described for install/verify-casks and integrate them into install/brew. Done means every Brewfile cask is pinned or refused, a one-character-wrong pin fails --before, and unverified apps are never copied into /Applications.

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

Mô tả

A cask is a URL and a hash. The hash proves the bytes did not change.
It does not prove who made them. Apple code signing does.

Every Developer ID app carries a Team ID. Pin one Team ID per cask.
Check the pin before the app reaches /Applications.

Files

install/brew.d/signers holds the pins. One cask per line:

# <cask> <Team ID>   # vendor
slack       BQR82RBBHL   # Slack Technologies
1password   2BUA8C4S2C   # AgileBits Inc.

The Team IDs for the casks installed today come from the copies in
/Applications. That is trust on first use. Check each vendor name.

install/verify-casks checks the pins. It has three modes:

  • --before <Brewfile>: fetch each cask not yet installed. Unpack it
    in a temp directory. Verify it there. Install nothing.
  • --installed <Brewfile>: verify the apps in /Applications.
  • --record <cask>: print the signer of an installed app. Ask.
    Append a pin.

The check

One requirement does most of the work:

anchor apple generic
and certificate 1[field.1.2.840.113635.100.6.2.6] exists
and certificate leaf[field.1.2.840.113635.100.6.1.13] exists
and certificate leaf[subject.OU] = "<Team ID>"

It requires an Apple root, a Developer ID intermediate, a Developer ID
Application leaf, and the pinned team. Pass it to codesign --verify --deep --strict -R=. Then run spctl --assess --type execute to require
notarization.

In install/brew

verify-casks --before "$BREWFILE" || exit 1
brew bundle --verbose --file="$BREWFILE"
verify-casks --installed "$BREWFILE"

A cask with no pin is refused. To trust a new vendor, add one line to
signers. The diff is the review.

Details

  • codex is a bare binary in /opt/homebrew/bin. Gatekeeper cannot assess
    it. Run the codesign check only.
  • google-chrome uses sha256 :no_check. Brew may download it again at
    install time. Then the verified file and the installed file can differ.
    Find out. If so, install Chrome from the verified copy.
  • A .pkg cask needs pkgutil --check-signature. None exist in the
    desktop set today.
  • The four hand-installed apps (Brave, Chrome, Slack, 1Password) need
    brew install --cask --adopt first.
  • Pass --no-upgrade to brew bundle. The apps update themselves.

Done when

  • Each cask in each Brewfile has a pin, or the install refuses it.
  • A cask signed by the wrong team fails --before. Test with a pin
    changed by one character.
  • Nothing unverified is copied into /Applications.
Ngôn ngữ chính
Shell
Star
1
Fork
0
Merge trung bình
9 giờ 5 phút
Pull request đã merge (30 ngày)
5

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

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

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 indexzero/dotfiles

Tất cả issue của indexzero/dotfiles

Issue tương tự

Thêm issue về Shell/Bash

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.