본문으로 건너뛰기
Skillpedia
보안10k · #11932

android-intent-security

하는 일

이 스킬은 Android 액티비티, 서비스, 리시버, 프로바이더를 보호하고 들어오는 인텐트를 안전하게 처리하는 방법을 안내합니다. 다른 앱이 자기 구성 요소를 잘못 사용하지 못하게 하려는 Android 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓Android 매니페스트에서 외부에 노출된 액티비티, 서비스, 리시버를 검토하고 싶을 때.
  • ✓앱이 들어오는 인텐트 데이터를 읽고 있어 인텐트 리디렉션을 막고 싶을 때.
  • ✓PendingIntent 사용과 콘텐츠 프로바이더에 무단 접근이 없는지 확인하고 싶을 때.

스킬 링크

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

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/android/skills/blob/main/security/android-intent-security/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“내 AndroidManifest와 들어오는 인텐트를 읽는 코드에 보안 문제가 있는지 점검해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

이 스킬은 외부에 노출된 구성 요소나 변경 가능한 PendingIntent 같은 위험한 패턴을 설명하고, 이를 대신할 안전한 패턴을 보여 줍니다. 이를 매니페스트와 들어오는 인텐트를 처리하는 코드에 적용합니다.

기술 내용 (원본 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_TOP and 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 the singleTop launch mode.
  • The agent MUST be able to declare <activity>, <service>, <receiver>, and <provider> tags in AndroidManifest.xml and define their android:exported and android:permission attributes.
  • 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.0 or higher is mandatory to leverage IntentSanitizer.
  • Standard API access: Standard Android PackageManager APIs 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

자주 묻는 질문

외부 노출(exported) 구성 요소는 무엇인가요?

다른 앱이 기기에서 실행할 수 있는 구성 요소이므로 신중하게 보호해야 합니다.

변경 가능한 PendingIntent는 무엇인가요?

받는 앱이 내용을 바꿀 수 있는 PendingIntent로, 스킬이 이에 대해 경고합니다.

권한도 다루나요?

권한은 관련 스킬에서 다루고, 이 스킬은 인텐트와 구성 요소에 집중합니다.

상세 정보

작성자의 원본 설명

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
업데이트
2026. 10. 29.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬