"Manifest 의 모든 host pattern 이 만지려고 permission 요청하는 인터넷의 한 평방마일. Lesson 3 가 syntax, install prompt 비용, 가장 무서운 경고 최소로 가장 큰 reach 위해 ClipDeck design 하는 법."
URL match pattern syntax
Match pattern 이 세 부분: scheme / host / path. :// 와 / 로 join:
<scheme>://<host>/<path>
예:
https://github.com/*— github.com root 과 모든 path, HTTPS only.https://*.github.com/*— github.com AND 모든 subdomain (gist.github.com, api.github.com, ...).https://github.com/anthropics/*— anthropics org 아래 repository 만.*://*/*— Chrome 이 제한하는 거 (chrome://, 등) 외 모든 scheme, 모든 host, 모든 path. 몇 edge case 빼고<all_urls>와 동등.<all_urls>— explicit wildcard. HTTP / HTTPS / FTP / file: 매칭.
규칙:
- Scheme:
http,https,file,ftp, 또는*. 일반 extension 에서chrome://와chrome-extension://절대 매칭 안 됨. - Host: literal, OR
*혼자 (모든 host), OR*.prefix (subdomain wildcard). Host 가운데 wildcard (foo*.example.com) 안 허용. - Path: literal 문자와
*wildcard. Path 필수; "모든 path" 면/*사용.
Install 경고 사다리
Chrome 의 prompt 가 host 가 얼마나 넓은지에 따라 scale:
- 한 특정 host (
https://github.com/*) → "Read and change your data on github.com." - Subdomain wildcard (
https://*.github.com/*) → "Read and change your data on sites in the github.com domain." - 여러 특정 host (
https://github.com/*,https://gitlab.com/*) → "Read and change your data on github.com and gitlab.com." Chrome 이 작은 한계까지 list, 다음 collapse. <all_urls>나*://*/*→ 시끄러운 "Read and change all your data on all websites."
"3 host" 와 "all websites" 사이 user 신뢰 drop 이 가파름. 가능하면 host 좁게 cluster, 정말로 everywhere 동작해야 할 케이스에 <all_urls> 예약.
Chrome 의 'Runtime Host Permission' twist
Chrome 70 쯤부터, user 가 puzzle-piece menu 나 chrome://extensions 통해 installed extension 의 site access 변경 가능: "On click," "On host_permissions: ["<all_urls>"] 선언해도, user 가 "On click" 만으로 제한할 수 있어 — extension 이 activeTab 처럼 동작하게 만듦.
함의: 코드가 manifest-declare host permission 이 runtime 상태라고 가정 못 함. 중요할 때 chrome.permissions.contains 사용, 또는 모든 host-touch feature 가 denial 에 resilient 하도록 design (scripting 호출에서 'Cannot access contents of the page' error 돌아옴; catch 하고 설명).
Content-script match pattern
Content script 가 content_scripts 아래 자체 matches 배열 가짐. 같은 syntax 사용하지만 host_permissions 와는 분리된 grant:
host_permissions가 programmatic inject (chrome.scripting), fetch, request 관찰할 권한 부여.content_scripts.matches가 매 page load 시 static, automatic injection 선언.
Chrome 이 경고 목적으로 둘 union: host_permissions: ["<all_urls>"] OR content_scripts.matches: ["<all_urls>"] 가 같은 무서운 경고 trigger. Host 좁히려면 두 field 함께 좁히기.
ClipDeck 의 선택
ClipDeck v0.9 가 content_scripts.matches: ["<all_urls>"] 가짐 — floating 버튼과 selection capture 가 user 방문 모든 page 에서 동작해야 해서. 경고 부드럽게 하는 두 방법:
- 항상-on content script 완전 drop. Toolbar click 이나 hotkey 시
activeTab+ programmaticchrome.scripting.executeScript사용. 비용: 매 page 의 floating 버튼 없음, user 가 부른 후만. 이득: install 경고 없음, 훨씬 친절. - Content script 유지하되 민감 host 명시적 exclude. 넓은 reach 유지, 일부 카테고리 off-limit 인 거 user 한테 signal. 경고는 변함없지만, 신뢰 신호가 더 강함.
ClipDeck v1 은 두 번째 경로 — floating 버튼이 discovery 이야기 일부라서. v2 가 privacy-minded 무리 위해 activeTab-only mode 로 전환하는 per-user toggle 추가할 수도.
<all_urls> 가 어떤 prompt 의 가장 시끄러운 줄 — 자격을 얻어. User 가 runtime 에 host downgrade 가능; 그것 위해 design.