ronjunevaldoz/kmp-agent-skills/kmp-security
Claude Code and agent skill by ronjunevaldoz/kmp-agent-skills
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Mobile app security for Kotlin Multiplatform beyond Android-only R8 obfuscation — certificate/SSL pinning (expect/actual, no cross-platform Ktor support exists natively), root/jailbreak/tamper detection via freeRASP's real KMP variant, encrypted local storage via KSafe, iOS/ Kotlin-Native release-binary symbol stripping, and an OWASP Mobile Top 10 2024 coverage map across this collection. Does NOT cover Android-specific R8/ProGuard obfuscation — that's kmp-proguard-r8's own scope, cross- referenced here rather than duplicated. Does NOT cover secrets-in-source scanning (gitleaks pre-commit) — that's kmp-setup-hooks Option F.
Install
npx vskill@latest install ronjunevaldoz/kmp-agent-skills/kmp-securitySemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as ronjunevaldoz/kmp-agent-skills/kmp-security.
When to Use This Skill
Use when you need to:
- Pin a server's certificate/public key so the app rejects a MITM proxy even
with a trusted root CA installed on the device
- Detect a rooted/jailbroken device, an active debugger, or Frida/Xposed
hooking at runtime
- Store a token/credential encrypted at rest, not in plain
SharedPreferences/NSUserDefaults - Strip debug symbols from a release iOS/Kotlin-Native binary
- Check this collection's coverage against the real OWASP Mobile Top 10
Do NOT use this skill for Android-specific obfuscation/minification — load kmp-proguard-r8 instead, this skill cross-references it rather than duplicating it.
Trigger keywords: certificate pinning, SSL pinning, public key pinning, root detection, jailbreak detection, tamper detection, freeRASP, RASP, runtime application self-protection, secure storage, encrypted storage, KSafe, OWASP Mobile Top 10, binary stripping, symbol stripping, strip debug symbols, reverse engineering, Frida detection, MITM.
Freshness rule: freeRASP's KMP variant and KSafe are both actively developed, real third-party libraries, not part of JetBrains' own KMP release train — recheck their current versions before pinning; OWASP Mobile Top 10 was last released in 2024 (still current as of this writing, verified directly against owasp.org, not assumed).
Recommendation First
freeRASP (Talsec) for root/jailbreak/tamper detection — real, dedicated KMP variant (com.aheaditec.talsec.security:freeRASP_KMP), one shared codebase across Android+iOS instead of hand-rolling two expect/actual detectors. KSafe for encrypted local storage — encryption on by default, a single code path with no expect/actual needed, and built-in root/jailbreak WARN/BLOCK policy on top. Certificate pinning has no native cross-platform Ktor support — verified, not assumed: it requires expect/actual, OkHttp's CertificatePinner on the Android engine and a NSURLSessionDelegate challenge handler on the Darwin (iOS) engine.
Why: detection alone is never sufficient on its own — every client-side check is bypassable by a sufficiently motivated attacker. The real posture is layered: client-side detection (freeRASP) raises the cost of tampering, pinning + encrypted storage protect data in transit and at rest, and anything security-critical (entitlement checks, purchase validation) still gets verified server-side — a rooted device can manipulate any purely local verification logic.
Certificate / SSL Pinning
Ktor's client engines differ per platform, so pinning is genuinely expect/actual, not a shared Ktor plugin:
Test with a broken pin first — configure an intentionally wrong hash, confirm the connection is rejected, then switch to the real pin. Confirms the pinning logic actually runs before trusting it in production. Do this on a trusted network, not through a MITM proxy tool (Charles/Fiddler) — those are exactly what pinning should reject.
Root / Jailbreak / Tamper Detection — freeRASP
Detects rooting/jailbreak (Magisk, Dopamine), Frida/Xposed hooking, repackaging/tampering, and emulators — call SecurityManager.start() once from app entry (LaunchedEffect in the root composable, or platform onCreate/AppDelegate equivalent). iOS needs TalsecRuntime.xcframework/ TalsecBridge.xcframework linked in Xcode with "Embed & Sign"; Android needs the manifest permissions its integration guide lists (DETECT_SCREEN_CAPTURE among them) — both are one-time setup steps, not runtime code.
Layer detection methods, don't rely on one. File-system checks alone are easily hooked with Frida/Substrate at the Kotlin/Swift layer — freeRASP's own value is combining multiple signals (file system, API behavior, native-level checks) instead of one easily-bypassed check.
Secure Local Storage — KSafe
One code path, no expect/actual needed for the storage layer itself — KSafe owns the platform dispatch (Android Keystore-backed encryption, iOS Keychain) internally. Prefer this over hand-rolling EncryptedSharedPreferences/raw Keychain calls per platform unless the project has a reason KSafe doesn't cover.
Release Binary Protection
Android: R8/ProGuard obfuscation — load kmp-proguard-r8, this skill doesn't duplicate it.
iOS/Kotlin-Native: strip debug symbols from the release .framework. Verified Xcode Archive build settings, not the dev-build defaults:
-T strips Swift symbols specifically; the combination applies to any bundled .framework, including the Kotlin/Native-produced one — debugging information and descriptive function names in an unstripped binary make reverse engineering meaningfully easier. Most crash-reporting tools (Sentry, Crashlytics) support uploading symbols separately for stack-trace symbolication, so stripping the shipped binary doesn't cost you crash diagnosis — same tradeoff kmp-proguard-r8 already documents for Android's mapping.txt.
Server-Side Verification — the Principle Underneath All of This
A rooted/jailbroken device can manipulate any client-side check, including freeRASP's own signals if the attacker is determined enough. The real security boundary for anything valuable (entitlements, purchase validation, sensitive data access) is server-side verification — client-side detection raises the cost of an attack, it doesn't replace backend validation. See kmp-in-app-purchases's server-side receipt validation for the concrete example this collection already applies the same principle to.
OWASP Mobile Top 10 (2024) — Coverage Map
Verified directly against owasp.org, not assumed:
| Category | Covered by | |
|---|---|---|
| M1: Improper Credential Usage | kmp-flavor-environment (secrets never in source), this skill's KSafe section | |
| M2: Inadequate Supply Chain Security | kmp-setup-hooks (gitleaks), kmp-ci-github-actions | |
| M3: Insecure Authentication/Authorization | kmp-ktor-auth-service, kmp-biometric-auth | |
| M4: Insufficient Input/Output Validation | kmp-form-validation | |
| M5: Insecure Communication | This skill's Certificate/SSL Pinning section | |
| M6: Inadequate Privacy Controls | kmp-legal-docs | |
| M7: Insufficient Binary Protections | This skill's Release Binary Protection + Root/Jailbreak sections, kmp-proguard-r8 | |
| M8: Security Misconfiguration | kmp-ci-github-actions, kmp-code-quality (Detekt gates) | |
| M9: Insecure Data Storage | This skill's Secure Local Storage section | |
| M10: Insufficient Cryptography | This skill's KSafe section (delegates crypto to the library, doesn't hand-roll it) |
Every category has a real home somewhere in this collection — this table exists so a reviewer can find it without re-deriving the mapping.
Common Anti-Patterns
- **Trusting client-side root/jailbreak detection as the actual security
boundary** — it's a cost-raising signal, not a guarantee; verify anything valuable server-side too.
- **Pinning against a leaf certificate instead of a public key or
intermediate CA** — a leaf cert rotates on renewal and silently breaks the app; pin the public key (SPKI hash) or an intermediate that survives rotation.
- No pin-rotation plan — shipping a pinned app with no way to update the
pins (a remote config fallback, or a hard app-store update requirement) means a legitimate certificate rotation locks users out.
- **Hand-rolling
EncryptedSharedPreferences/rawKeychaincalls per
platform** when KSafe already covers the common case with less code and matching encryption guarantees on both.
- Assuming R8 obfuscation covers iOS too — it doesn't; the release
binary needs its own, separate stripping step.
- A single un-layered detection check (just a
subinary file check, for
example) — easily defeated; combine multiple signals, or use a library that already does (freeRASP).
Testing
Certificate pinning and freeRASP integration are best verified manually per the intentional-broken-pin technique above — both depend on real platform TLS/OS-level behavior that a JVM unit test can't meaningfully fake.
Related Skills
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/kmp-security/SKILL.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/ronjunevaldoz/kmp-agent-skills/kmp-security)