"선언하는 모든 permission 이 user 가 읽는 install prompt 의 한 문장. Lesson 1 이 모델 — 세 카테고리, 두 grant 순간, manifest 그대로에서 경고 텍스트 계산하는 하나의 Chrome."
세 카테고리
- API permission —
permissions배열에 선언. 각자chrome.*namespace 해금:"storage"가chrome.storage.*활성화,"scripting"이chrome.scripting.*활성화,"contextMenus"가 menu 활성화 등. - Host permission —
host_permissions배열에 선언. 각자 URL match pattern (https://*.github.com/*,<all_urls>). 그 origin 에 script inject, DOM read, request intercept 권한 부여. - Optional permission —
optional_permissionsAND/ORoptional_host_permissions배열에 선언. 위 둘과 같은 shape, 하지만 install 시 user 한테 prompt 안 함. 코드가 runtime 에chrome.permissions.request통해 요청.
MV3 가 host permission 을 API permission 에서 분리한 이유는 Chrome 이 더 깔끔한 install 경고 표시할 수 있게. User 가 "This extension can: read your data on github.com AND use storage AND use tabs" 가 아닌 "This extension can: read your data on github.com" 봄 — 구별된 줄, 구별된 시각 무게.
두 grant 순간
- Install-time:
permissions와host_permissions의 모든 것이 user 가 extension install 시 grant. Install dialog 가 선언한 모든 것 요약; user 가 Add click 하면 영구 (uninstall 까지) 가짐. - Runtime:
optional_permissions나optional_host_permissions의 모든 것은 user-gesture handler 에서chrome.permissions.request호출할 때만 grant. 작은 dialog 나타남; user 가 Allow 나 Deny click. Deny 면 API 가 unavailable 유지; Allow 면 session 나머지 동작하고 browser restart 너머 persist.
Chrome 이 install 경고 계산하는 법
각 permission 이 몇 가지 경고 카테고리 중 하나로 매핑. Permission 결합이 경고 collapse (예: 'tabs' 가 일부 약한 permission 흡수) 하거나 무서운 거 추가 가능 (<all_urls> 가진 어떤 것이든 'Read and change all your data on all websites' 아래로). 정확한 매핑은 Chrome Developers docs 에 있지만, rule of thumb:
storage,activeTab,contextMenus,sidePanel,commands,omnibox— 조용, 자체 install 경고 없음.tabs— moderate, "Read your browsing history."scripting,<all_urls>보다 좁은 host permission — "Read and change your data on specific site."- host_permissions 나 content_scripts.matches 의
<all_urls>— 시끄러운 "Read and change all your data on all websites." downloads,notifications,identity,history,geolocation,cookies— 각자 자체 dedicated 경고 줄 추가.
최소 권한 원칙
Chrome Web Store review (와 informed user) 가 extension 을 install 경고로 판단. 제거할 수 있는 모든 줄이 거부할 이유 하나 덜 줌. ClipDeck 의 실제 니즈:
storage— essential, 항상 선언, 무서운 경고 없음.tabs— SW 에서 tab.url read 위해. Mildly 무서운 경고지만 방문 카운터와 per-site clip filter 에 필요.scripting+activeTab— toolbar click 시 programmatic injection 위해.activeTab이 on-demand 경로에host_permissions: [<all_urls>]건너뛰게 해 줌.sidePanel,contextMenus— 조용.matches: [<all_urls>]로 선언된 content script — ClipDeck 한테 'all websites' 경고 주는 것. Track 6 Lesson 3 이 이걸 좁히는 거 논의.- Export 위한
downloads—optional_permissions로 가서 user 가 Export click 할 때만 요청해야.
세 카테고리: API, host, optional. 두 grant 순간: install 이나 on-demand. Install 경고가 trust 예산 — 신중히 써.
MV2 permissions-array 호환성 함정. Chrome 이 API 와 host permission 이 한 배열에 사는 옛 MV2 shape 도 여전히 받음. Load 되지만, 경고 요약 더 읽기 어렵고 Chrome Web Store reviewer 가 smell 로 다룸. 항상 MV3 shape 으로 split — API 엔 `permissions`, URL 엔 `host_permissions`, lazy 버전엔 optional_*.