콘텐츠로 이동

macOS App Sandbox 자동화

Mac App Store 진출에는 com.apple.security.app-sandbox entitlement가 필수. CEF는 메인 프로세스 + 4개 Helper (Browser/GPU/Renderer/Plugin) 구조라 각 helper마다 적절한 entitlements를 별도 부착해야 한다. Suji는 config.app.sandbox: true 한 줄로 자동 처리.

자동 — 별도 설정 불필요. suji build 실행 시 <App>.app/ 번들의 메인 + 4개 Helper 모두 helper별 entitlements로 자동 codesign. 모든 plist에 com.apple.security.app-sandbox 포함.

{ "app": { "name": "My App", "version": "1.0.0" } }
위치파일핵심 key
메인 앱 + 메인 binaryassets/entitlements/main.plistapp-sandbox + cs.allow-jit + network.client/server + files.user-selected.read-write
Helper (Browser)assets/entitlements/helper.plistapp-sandbox + cs.inherit
Helper (GPU)assets/entitlements/helper-gpu.plistapp-sandbox + cs.allow-jit + cs.allow-unsigned-executable-memory + cs.disable-library-validation
Helper (Renderer)assets/entitlements/helper-renderer.plistapp-sandbox + cs.allow-jit + cs.disable-library-validation
Helper (Plugin)assets/entitlements/helper-plugin.plistapp-sandbox + cs.allow-jit + cs.allow-unsigned-executable-memory

CEF docs (Wiki — Additional Configuration) 권장 따름.

앱별 추가 권한 (예: 카메라/마이크/USB 접근, Apple Pay 등) 필요 시 app.entitlements로 사용자 plist 경로 지정. 그 파일이 모든 binary에 단독 적용 (helper별 분기 대신).

{
"app": {
"entitlements": "my-app.entitlements"
}
}

codesign --entitlements my-app.entitlements 가 모든 binary에 적용.

  • App Sandbox 활성 시: 사용자가 ~/Documents/myapp 같은 임의 경로에 직접 쓸 수 없음 (UI 통한 user-selected만). 명시 권한 필요.
  • 외부 dylib 로드: cs.disable-library-validation이 helper에는 있지만 메인에는 없음 (보안 강화). 메인에서 third-party dylib 로드하려면 app.entitlements로 추가.
  • Network: 메인만 network.client/server enabled. Helper는 inherit으로 받음.
Terminal window
# 번들 빌드 후 entitlements 확인
codesign --display --entitlements - "My App.app/Contents/MacOS/My App"
codesign --display --entitlements - "My App.app/Contents/Frameworks/My App Helper (GPU).app"
# Sandbox 동작 확인 — sandbox-exec 같은 도구는 macOS 13+에서 deprecated.
# Apple 권장: Apple Configurator 또는 Xcode Console 로그.

현재 suji build는 ad-hoc 서명(-)만 적용한다. Mac App Store 또는 Gatekeeper 통과를 위한 프로덕션 배포 시에는 codesign --sign "Developer ID Application: ..." 으로 재서명하고 notarize + DMG 패키징 단계를 별도로 수행해야 한다.