선택적 권한과 실행 중 요청
처음부터 권한을 요구하는 대신 필요할 때 권한을 요청해 신뢰를 쌓고 심사를 빠르게 통과하며 공격 표면을 최소화합니다.
선택적 권한과 실행 중 요청은(는) CoddyKit의 무료 Browser Extensions Development (Chrome & Edge) 강의입니다. 이것은 4개 중 4번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Browser Extensions Development (Chrome & Edge) 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Browser Extensions Development (Chrome & Edge) 강의에는 총 4개의 강의가 포함되어 있습니다.
이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.
The Problem With Asking for Everything
Requesting many permissions at install time scares users and slows store review. The principle of least privilege says request only what you need, when you need it.
Optional permissions let you ask at runtime, in context.
Required vs Optional
The manifest separates permissions (granted at install) from optional_permissions (requested later). Move anything non-essential into optional.
{
"permissions": ["storage"],
"optional_permissions": ["bookmarks", "history"]
}Optional Host Permissions
Site access can also be optional. Declare it under optional_host_permissions so users grant access to specific sites only when they choose.
{
"optional_host_permissions": ["https://*/*"]
}Requesting at Runtime
Call permissions.request in response to a user gesture, such as a button click. The browser shows a prompt.
const granted = await chrome.permissions.request({
permissions: ['bookmarks']
})
console.log('Granted: ' + granted)Must Come From a User Gesture
The request prompt only appears if triggered by a direct user action. Calling it on startup or from a timer will silently fail.
Wire it to a click handler.
button.addEventListener('click', async () => {
await chrome.permissions.request({ permissions: ['history'] })
})Checking Before Using
Before calling an API, check whether the permission is currently granted with permissions.contains.
const has = await chrome.permissions.contains({
permissions: ['bookmarks']
})
if (has) loadBookmarks()Removing Permissions
Let users revoke access they no longer want with permissions.remove. This shrinks your attack surface.
await chrome.permissions.remove({ permissions: ['history'] })Reacting to Grants and Revokes
Listen for onAdded and onRemoved to enable or disable features as permissions change.
chrome.permissions.onRemoved.addListener((p) => {
console.log('Removed: ' + p.permissions)
})Designing the Request Flow
Explain why you need a permission before prompting. A short sentence and a clear button earns far more grants than a surprise system dialog.
Faster Store Review
Extensions with broad install-time permissions face deeper review. Moving sensitive scopes to optional often speeds approval and reduces warning banners.
Graceful Degradation
Always handle the case where a permission is denied. Disable or hide the feature rather than throwing errors, so the rest of the extension keeps working.
if (!granted) showFallbackMessage()Quick Check
Test your optional permissions knowledge.
Recap
You learned runtime permission requests:
- Split required and
optional_permissions - Request from a user gesture with
permissions.request - Check with
contains, revoke withremove - React to
onAddedandonRemoved - Degrade gracefully when denied
Least-privilege design builds trust and eases store review.
자주 묻는 질문
“선택적 권한과 실행 중 요청” 강의는 무료인가요?
네 — “선택적 권한과 실행 중 요청” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 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개 중 4번째 강의입니다.
“선택적 권한과 실행 중 요청” 강의는 얼마나 걸리나요?
대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.
이 Browser Extensions Development (Chrome & Edge) 강의에서 코드를 작성하고 실행할 수 있나요?
네. 모든 Browser Extensions Development (Chrome & Edge) 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.
이 강의의 모든 강의
- 고급 권한 이해하기
- 안전한 코딩 관행
- 콘텐츠 보안 정책(CSP)
- 선택적 권한과 실행 중 요청