本文へスキップ
Skillpedia
セキュリティ10k · #11933

android-permissions-security

できること

このスキルは、Androidの権限と、他のアプリから到達できるコンポーネントのセキュリティを監査します。実行時の権限の要求も扱います。アプリに最小権限の原則を適用したいAndroid開発者向けです。

使う場面

  • ✓AndroidManifestの権限を見直し、アプリが必要としない権限を取り除きたいとき。
  • ✓アプリの外部公開されたコンポーネントを守るために、カスタム権限を定義したいとき。
  • ✓サービスやプロバイダーで、呼び出し元のアプリの身元を確認する必要があるとき。

スキルのリンク

https://github.com/android/skills/blob/main/security/android-permissions-security/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/android/skills/blob/main/security/android-permissions-security/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“AndroidManifestの権限を見直し、ほかのアプリから呼び出せるサービスとレシーバーを保護してください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

このスキルは、マニフェストの危険な権限の設定と、外部公開されたコンポーネントを確認します。そのうえで、カスタム権限、呼び出し元の署名の確認、適切な実行時の権限の流れなどの修正を提案します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Guidelines for auditing permission vulnerabilities, enforcing least privilege, securing IPC boundaries, and handling runtime permissions across the Android ecosystem.

Glossary

  • Runtime Permission: Dangerous permission (e.g., Camera, Location) that must be granted by the user at runtime on Android 6.0+ (API 23+).
  • Custom Permission: A permission defined by an app (<permission>) to restrict access to its exported components.
  • Protection Level: Attribute defining how the OS grants the permission (normal, dangerous, signature, knownSigner).
  • knownSigner: Protection flag (API 31+) granting signature-level access to partner apps matching trusted certificate digests.
  • SigningInfo: Object (API 28+) providing signing history and multiple signer certificates for an application.
  • Binder Calling Identity: Reliable UID representing the calling process obtained using Binder.getCallingUid().
  • URI Permission: Temporary, granular access granted to a content URI using grantUriPermissions and intent flags.

Prerequisites

  • Add androidx.core:core-ktx and androidx.activity:activity-ktx (or androidx.fragment:fragment-ktx) dependencies to the app-level build.gradle file for ContextCompat and ActivityResultContracts.
  • For knownSigner partner permissions (android:knownCerts), ensure the project compileSdk and targetSdk are at least 31 (Android 12).
  • For broadcast identity sharing (BroadcastOptions.setShareIdentityEnabled), ensure compileSdk and targetSdk are at least 34 (Android 14).

1. Security audit and permission gap detection playbook

When auditing an Android project for permission and IPC security vulnerabilities, systematically inspect each area:

Vulnerability Area Search In / Pattern Risk Remediation Action
Weak Custom Permission Protection AndroidManifest.xml with android:protectionLevel="normal", "dangerous", or "signatureOrSystem" Unauthorized apps request or claim permission without restriction Upgrade to signature or signature with knownSigner and android:knownCerts.
Overly Broad URI Permission Grants <grant-uri-permission android:pathPrefix="/" /> or pathPrefix="" in <provider> Leaks all provider data to third parties Replace with explicit scoped subpath (e.g. android:pathPrefix="/shared/"). Retain android:grantUriPermissions="true". Remove any wildcard pathPrefix="/".
Missing ContentProvider Split Permissions <provider> with only generic android:permission or missing android:readPermission and android:writePermission Read-only callers execute write operations or write-only callers access read operations Configure granular android:readPermission="...READ_DATA" and android:writePermission="...WRITE_DATA", AND declare the custom <permission> tags with android:protectionLevel="signature" (or signature with knownSigner) at the <manifest> root.
Spoofable Caller Identity Checks intent.getStringExtra("calling_package"), intent.getStringExtra("sender"), callingPackage == "..." in Services Malicious callers forge intent extras or strings Remove string checks; authenticate caller UID cryptographically using Binder.getCallingUid() and pm.hasSigningCertificate().
Bound Service Permission Bypass checkCallingOrSelfPermission() or enforceCallingOrSelfPermission() in Binder AIDL stubs Falls back to host app UID outside IPC or when identity is cleared, causing Confused Deputy bypass Replace with enforceCallingPermission("...WRITE_DATA", ...) or checkCallingPermission("...WRITE_DATA").
Missing Method-Level Checks in Bound Services Bound Service AIDL methods mutating state without enforcing write permissions Callers with read-only binding access invoke mutating write operations Add enforceCallingPermission("...WRITE_DATA", "Caller lacks WRITE_DATA permission") inside mutating AIDL methods.
Flawed Runtime Permission Flow Missing shouldShowRequestPermissionRationale(), missing permanent denial handling, or re-requesting in loops Poor user experience, infinite loops, or inability to recover permissions Implement 3-state flow: check grant -> check rationale dialog -> launch contract. On permanent denial, redirect to Settings.ACTION_APPLICATION_DETAILS_SETTINGS.
Simultaneous Location Requests `arrayOf(ACCESS_FINE_LOCATION, ACCESS_BACKGROUN
よくある質問

署名の権限とは何ですか?

同じ開発者の鍵で署名されたアプリにだけ与えられる権限で、このスキルはアクセスを制限するためにそれを使えます。

実行時の権限の表示も扱いますか?

はい。Android 6.0以上の危険な権限について、実行時の権限の流れを扱います。

追加のライブラリが必要ですか?

はい。このスキルが追加するコードには、一部のAndroidXライブラリが必要だと注意しています。

詳細

作者による元の説明

Audits, detects gaps, and remediates Android permissions and IPC component security vulnerabilities. Use when reviewing AndroidManifest.xml, defining custom permissions, securing Services, Receivers, and Providers, verifying caller signatures and UID using Binder, or implementing runtime permission flows.

repo: android/skills

人気

GitHubのスター
10k
ランキング
#11933
ライセンス
Apache-2.0
更新日
2026/10/29

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル