권한 및 호스트 일치
필요한 권한을 선언하고 요청하는 방법과 호스트 권한이 웹사이트 액세스를 제어하는 방식을 이해합니다.
권한 및 호스트 일치은(는) CoddyKit의 무료 Browser Extensions Development (Chrome & Edge) 강의입니다. 이것은 4개 중 3번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Browser Extensions Development (Chrome & Edge) 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Browser Extensions Development (Chrome & Edge) 강의에는 총 4개의 강의가 포함되어 있습니다.
이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.
Why Extensions Need Permissions
Just like apps on your phone, browser extensions often need special 'permissions' to do their job. These permissions define what your extension can and cannot do.
This system is crucial for user security and privacy. It prevents extensions from accessing information or performing actions they don't need, without your explicit consent.
Two Core Permission Types
In Manifest V3, permissions generally fall into two categories:
- API Permissions: Access to specific browser features (e.g., managing tabs, saving data).
- Host Permissions: Access to specific websites (e.g., reading content on example.com).
We'll look at how to declare both in your manifest.json file.
Declaring API Permissions
API permissions are listed under the "permissions" key in your manifest.json. Each string in the array corresponds to a specific browser API.
For example, "storage" lets your extension save user data, and "tabs" allows it to interact with browser tabs (like getting their URLs).
{
"manifest_version": 3,
"name": "My Extension",
"version": "1.0",
"permissions": [
"storage",
"tabs"
]
}The 'activeTab' Permission
The "activeTab" permission is unique. It's an API permission that grants your extension temporary host permissions to the currently active tab.
This access is granted only when the user *invokes* your extension (e.g., clicks its toolbar icon). It's a great way to reduce initial permission warnings, as access is only given when needed.
{
"manifest_version": 3,
"name": "ActiveTab Demo",
"version": "1.0",
"permissions": [
"activeTab"
]
}Understanding Host Permissions
Host permissions are crucial for defining which websites your extension can interact with. Without them, your extension cannot read or modify content on web pages.
This is a major security boundary. An extension with host permission for google.com cannot access facebook.com, protecting user data and ensuring privacy.
Specifying Host Permissions
Host permissions are declared in the "host_permissions" array in your manifest.json. You use URL match patterns to specify the domains.
A match pattern like "*://*.example.com/*" means access to all subdomains of example.com over HTTP or HTTPS.
{
"manifest_version": 3,
"name": "Host Access",
"version": "1.0",
"host_permissions": [
"*://developer.chrome.com/*",
"https://www.example.org/*"
]
}Match Pattern Wildcards
Match patterns use special characters:
*: Matches any string (except/in scheme/host, or#in path).<all_urls>: A special pattern that matches any URL (http,https,ftp,file). Use this with extreme caution as it grants wide access.
For example, "https://*.google.com/search?*" would match Google search results pages.
Combining API & Host Permissions
Often, your extension will need both API and host permissions. Here's an example for an extension that wants to execute a script on Wikipedia pages.
It needs the "scripting" API permission to run code, and host permission for Wikipedia to define where that code can run.
{
"manifest_version": 3,
"name": "Wiki Enhancer",
"version": "1.0",
"permissions": [
"scripting"
],
"host_permissions": [
"*://*.wikipedia.org/*"
]
}User Consent & Trust
When a user installs your extension, the browser displays a list of all requested permissions. This is their chance to understand what your extension can do.
Always request the minimum necessary permissions. Over-requesting can make users distrust your extension and choose not to install it. Be transparent!
Check Your Understanding
Which statements accurately describe host permissions in Manifest V3 extensions?
Permissions & Host Matching Recap
Great job! You've learned about the vital role of permissions in Manifest V3 extensions.
- API Permissions: Access browser features (e.g.,
"storage","tabs"). - Host Permissions: Control website access using URL match patterns (e.g.,
"*://*.google.com/*"). "activeTab"is a special API permission that grants temporary host access.- Always request the minimum necessary permissions to build user trust.
Understanding these concepts is key to building secure and functional extensions!
자주 묻는 질문
“권한 및 호스트 일치” 강의는 무료인가요?
네 — “권한 및 호스트 일치” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 Browser Extensions Development (Chrome & Edge) 강의 전체를 잠금 해제할 수 있습니다. Browser Extensions Development (Chrome & Edge) 강의에는 총 4개의 강의가 포함되어 있습니다.
“권한 및 호스트 일치”에서 뭘 배우나요?
필요한 권한을 선언하고 요청하는 방법과 호스트 권한이 웹사이트 액세스를 제어하는 방식을 이해합니다. 브라우저에서 직접 실행하는 실습 코드로 Browser Extensions Development (Chrome & Edge)을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.
Browser Extensions Development (Chrome & Edge)을(를) 시작하는 데 경험이 필요한가요?
사전 경험은 필요하지 않습니다. CoddyKit의 Browser Extensions Development (Chrome & Edge)은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 3번째 강의입니다.
“권한 및 호스트 일치” 강의는 얼마나 걸리나요?
대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.
이 Browser Extensions Development (Chrome & Edge) 강의에서 코드를 작성하고 실행할 수 있나요?
네. 모든 Browser Extensions Development (Chrome & Edge) 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.