android-intent-security
ما الذي تفعله
تقدّم هذه المهارة إرشادات لتأمين أنشطة Android والخدمات والمستقبِلات والموفّرين، ولمعالجة الـ intents الواردة بأمان. وهي موجهة لمطوري Android الذين يريدون منع التطبيقات الأخرى من إساءة استخدام مكوناتهم.
متى تستخدمها
- ✓عندما تريد مراجعة الأنشطة أو الخدمات أو المستقبِلات المُصدَّرة في ملف manifest الخاص بـ Android.
- ✓عندما يقرأ تطبيقك بيانات intent واردة وتريد منع إعادة توجيهها.
- ✓عندما تريد فحص استخدام PendingIntent وموفّري المحتوى للوصول غير المصرّح به.
رابط المهارة
https://github.com/android/skills/blob/main/security/android-intent-security/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“راجع AndroidManifest لدي والشيفرة التي تقرأ الـ intents الواردة بحثًا عن مشكلات أمنية.”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
تشرح المهارة الأنماط الخطرة، مثل المكونات المُصدَّرة وPendingIntent القابل للتعديل، وتعرض أنماطًا آمنة تحل محلها. ثم تطبقها على ملف manifest والشيفرة التي تعالج الـ intents الواردة.
المحتوى التقني (ملف SKILL.md الأصلي)
النص الأصلي من المؤلف، مباشرة من GitHub.
This skill provides guidelines and patterns to secure Android components (Activities, Services, Broadcast Receivers, Content Providers) and handle Intents safely, preventing privilege escalation and unauthorized access.
Glossary
- Intent: An asynchronous messaging object used to request an action from another app component.
- Exported component: A component (
android:exported="true") that can be launched by other apps on the device. - Sticky intent: A broadcast intent that remains in the system cache after it's sent, allowing any app to retrieve its contents.
- Signature permission: A permission whose protection level is set to
signature, granted only to apps signed with the same developer key. - onNewIntent: An activity lifecycle callback invoked when an activity is launched with
FLAG_ACTIVITY_SINGLE_TOPand is already running at the top of the history stack. - PendingIntent: A token granted to a foreign application (for example, system services) allowing it to execute a predefined Intent with the creator's permissions.
- Mutable PendingIntent: A PendingIntent whose underlying Intent parameters can be modified by the receiving application.
- ContentProvider: A component that encapsulates data and provides it to other applications via standard query/insert interfaces.
- IntentSanitizer: A utility class in AndroidX Core used to build a safe, sanitized copy of an incoming Intent by filtering out unauthorized components, actions, or extras.
- Intent redirection (forwarding): A vulnerability where an application receives an intent from an untrusted source and uses it to launch a private, non-exported component.
Prerequisites
- The agent MUST be able to describe the function and security implications of
onCreate,onNewIntent, and thesingleToplaunch mode. - The agent MUST be able to declare
<activity>,<service>,<receiver>, and<provider>tags inAndroidManifest.xmland define theirandroid:exportedandandroid:permissionattributes. - The agent MUST be able to implement signature verification checks using
PackageManager.
Limitations
- This skill focuses on local inter-component and inter-app communication security on the Android platform.
- This skill doesn't cover network security, web integration, or host-to-server security.
Setup and dependencies
- Android SDK: Minimum API Level 23 (Android 6.0) is required for standard hardware-backed keystore operations and component validation.
- AndroidX Core Library:
androidx.core:core:1.9.0or higher is mandatory to leverageIntentSanitizer. - Standard API access: Standard Android
PackageManagerAPIs are required for runtime component verification.
Intent security logic and decisions
1. Intent routing comparison
Evaluate the security features of different intent delivery methods:
| Intent Delivery Method | Scope | Recommended Use Case |
|---|---|---|
| Explicit Intent (Internal) | App Private | Launching internal activities/services |
| Implicit Intent | System Wide | Launching system camera, dialer, or sharing |
| Local Broadcasts (LocalBroadcastManager) (DEPRECATED) | App Private | Internal asynchronous event routing. Deprecated: Use in-app observers like Kotlin Flows/SharedFlow, LiveData, or reactive patterns instead. |
| System Broadcasts | System Wide | Receiving system events (NFC, Bluetooth) |
2. PendingIntent mutability flag options
Evaluate the security implications of PendingIntent mutability flags:
| Flag Name | Mutability | Recommended Use Case |
|---|---|---|
PendingIntent.FLAG_IMMUTABLE |
Immutable | Default for almost all PendingIntents, such as alarms and notifications |
PendingIntent.FLAG_MUTABLE |
Mutable | Inline notifications replies, slice actions (requires explicit target intent) |
3. Intent handling and redirection logic
IF (the component receives a nested Intent as an extra) {
IF (AndroidX Core 1.9.0+ and higher is available) {
MUST construct an IntentSanitizer to explicitly allowlist components, actions, data, and extras.
MUST call sanitizeByThrowing() or sanitizeByFiltering() before launching.
} ELSE {
MUST reject or strip URI permission grant flags (FLAG_GRANT_READ_URI_PERMISSION, FLAG_GRANT_WRITE_URI_PERMISSION, FLAG_GRANT_PERSISTABLE_URI_PERMISSION, FLAG_GRANT_PREFIX_URI_PERMISSION).
MUST resolve the target component using resolveActivity() and verify that b
الأسئلة الشائعة
ما المكوّن المُصدَّر؟
هو مكوّن يستطيع تطبيق آخر تشغيله على الجهاز، لذلك يجب حمايته بعناية.
ما الـ PendingIntent القابل للتعديل؟
هو PendingIntent يستطيع التطبيق المستقبِل تغيير محتواه، وتحذّر المهارة منه.
هل تغطي الأذونات أيضًا؟
الأذونات تغطيها مهارة مرتبطة، أما هذه المهارة فتركّز على الـ intents والمكونات.
التفاصيل
الوصف الأصلي من المؤلف
Best practices for Android Intent security. Use this skill when auditing component configurations in AndroidManifest.xml activities, services, receivers) or source code handling incoming Intents (getIntent, getParcelableExtra) to prevent Intent Redirection and unauthorized access.
repo: android/skills
الشعبية
- نجوم GitHub
- 10k
- الترتيب
- #11932
- الترخيص
- Apache-2.0
- آخر تحديث
- 29/10/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
agp-9-upgrade
10kيساعد وكيلك على ترقية تطبيق Android إلى Android Gradle Plugin 9 ومعالجة التغييرات الجذرية فيه. لا يناسب مشاريع Multiplatform.
camerax
10kيساعد وكيلك على بناء ميزات الكاميرا في Android باستخدام CameraX، بما في ذلك تسجيل الفيديو وأدوات الأجهزة وتأثيرات ML Kit وMedia3.
android-for-cars-parked-apps
10kيساعد وكيلك على تكييف تطبيق فيديو أو لعبة أو متصفح في Android ليعمل كتطبيق متوقف على Android Auto وAndroid Automotive.
appfunctions
10kيساعد وكيلك على إيجاد أهم المسارات في تطبيق Android وعرضها كـ AppFunctions يمكن لوكلاء الذكاء الاصطناعي وأوامر الصوت تشغيلها.
مهارات مشابهة
reverse-engineer-anything
422kيساعد وكيلك على فحص التطبيقات والحزم المنشورة من الداخل ليشرح الميزات ويقارن الإصدارات ويرشد إلى إعادة البناء، باستخدام أداة REA.
1password
394kيساعد وكيلك على إعداد واجهة سطر أوامر 1Password وتسجيل الدخول، وقراءة الأسرار أو حقنها دون طباعة قيمها في المحادثة.
healthcheck
394kيساعد وكيلك على تدقيق جهاز OpenClaw أو خادمه أمنيًا، مثل SSH والجدار الناري والتحديثات، ويقترح إصلاحات آمنة قابلة للتراجع.