နားလည်ထားရမယ့် အချက်
ဒီအခန်းထဲက mobile security သင်ခန်းစာတိုင်းက root idea တစ်ခုတည်းကို ပြန်ညွှန်းနေကြပါတယ် - client ကို ဘယ်တော့မှ မယုံပါနဲ့။ mobile app တစ်ခုဟာ user ကိုယ်တိုင် ထိန်းချုပ်တဲ့ hardware နဲ့ operating system ပေါ်မှာ run နေတဲ့ software တစ်ခုပါပဲ။
တကယ်အရေးကြီးတဲ့ rule ဘယ်တစ်ခုမဆို - price, permission, user authenticate ဖြစ်မဖြစ်, action တစ်ခု ခွင့်ပြုမပြု - app က ဘာစစ်ထားပြီးသားဖြစ်ဖြစ် သင့် backend မှာ ထပ်ပြီး enforce ပြန်လုပ်ရပါတယ်။ client-side check ဆိုတာ ရိုးသားတဲ့ user တွေအတွက် အဆင်ပြေစေချက်ပါပဲ၊ security boundary ဘယ်တော့မှ မဖြစ်နိုင်ပါဘူး။
| Data အမျိုးအစား | ဘယ်နေရာမှာ ထားသင့်လဲ |
|---|---|
| Harmless preference | theme ရွေးချယ်ချက်လိုမျိုး - ရိုးရိုး local storage မှာ ရှိနေလို့ ရပါတယ်။ |
| Access token | credential အတွက် ဒီဇိုင်းလုပ်ထားတဲ့ secure, platform-appropriate storage လိုအပ်ပြီး ရိုးရိုး preference file မဟုတ်ပါဘူး။ |
| Sensitive personal data | ဖြစ်နိုင်သမျှ လျှော့ချသင့်ပြီး ထားရမယ်ဆိုရင် architecture နဲ့ သက်ဆိုင်ရာ စည်းမျဉ်းအလိုက် ကာကွယ်ပါ။ |
အသေးစိတ်အတွက် Digital Privacy & Modern Security ကို ကြည့်ပါ
token, session security အသေးစိတ်နဲ့ API security ယေဘူယျအတွက် Digital Privacy & Modern Security tutorial ကို ကြည့်ပါ - ဒီသင်ခန်းစာကတော့ အပိုင်းတွေကို ပြန်ချိတ်ဆက်ပေးရုံပါပဲ။
logging discipline ကလည်း logic တူတူပါပဲ - password, access ဒါမှမဟုတ် refresh token, payment detail, sensitive personal data တစ်ခုမှ log file ထဲ ခေတ္တလောက်ပဲဖြစ်ဖြစ်, development ထဲမှာဖြစ်ဖြစ် ဘယ်တော့မှ ရောက်မသွားပါစေနဲ့။
root ဒါမှမဟုတ် jailbreak လုပ်ထားတဲ့ device တွေအကြောင်း လက်တွေ့ကျကျ ရှုမြင်ပါ - client-side security ယူဆချက် အချို့ ပြင်ဆင်ထားတဲ့ device ပေါ်မှာ ပိုအားနည်းသွားပါတယ်၊ ဒါကြောင့် device-level trust ထက် server-side validation က ပိုအရေးကြီးရတာပါ၊ ဒီကာကွယ်မှုတွေကို ဖြတ်ကျော်နည်း ဖော်ပြရမယ့် အကြောင်းရင်း မဟုတ်ပါဘူး။
LAYERED MOBILE SECURITY MODEL
-----------------------------
LAYERED MOBILE SECURITY MODEL
-------------------------------
Layer 1: Never Trust the Client
Layer 2: Secure Storage Classification
Layer 3: Logging Discipline
Layer 4: Server-Side Validation (final authority)
Each layer backs up the one above it.
Server-Side Validation cannot be skipped by any layer.လက်တွေ့ scenario နဲ့ ချိတ်ကြည့်မယ်
သင့် app ရဲ့ အထိခိုက်လွယ်ဆုံး action တွေကို လှည့်ကြည့်ပြီး တစ်ခုချင်းစီအတွက် ရိုးရိုးသားသား မေးပါ - client က မမျှော်လင့်ထားတာတစ်ခု ပို့လိုက်ရင် server က ဖမ်းမိမလား, ဒါမှမဟုတ် app ရဲ့ စကားကို ယုံကြည်ရုံပဲလား။
- order တင်ခြင်း, discount သုံးခြင်း, feature ဖွင့်ခြင်း, account setting ပြောင်းခြင်း။
- 'app ကို ယုံကြည်တယ်' ဆိုတဲ့ အဖြေရလာတဲ့နေရာတိုင်းကို server-side check အစစ်တစ်ခုနဲ့ ပိတ်ပါ။
သင့် app က local မှာ တကယ်သိမ်းထားတာတွေကို list လုပ်ပြီး ရိုးသားစွာ classify လုပ်ပါ၊ credential category ထဲက ဘာမဆို သင့်လျော်တဲ့ secure storage ဆီ ရွှေ့ပါ။
Root Device ဆိုတာ Server ကို ပိုအားထားရမယ့် အကြောင်းရင်း
root ဒါမှမဟုတ် jailbreak လုပ်ထားတဲ့ device ကို server-side check တွေကို ပိုအားထားရမယ့် အကြောင်းရင်းအဖြစ် သဘောထားပါ၊ အားနည်းအောင်လုပ်ပြီး ဖြေရှင်းရမယ့် ပဟေဠိတစ်ခု အဖြစ် ဘယ်တော့မှ မသဘောထားပါနဲ့။
Mobile Security အခြေခံ Checklist
အတူတူ စမ်းရေးကြည့်မယ်
function evaluateTrustBoundary(check) {
if (check.validatedServerSide) {
return {
verdict: "safe",
reason: `${check.checkName} is enforced server-side, so a modified client can't bypass it.`
};
}
if (check.validatedClientSide && !check.validatedServerSide) {
return {
verdict: "risky",
reason: `${check.checkName} is only checked client-side -- a modified client could bypass it entirely.`
};
}
return { verdict: "unknown", reason: "No validation described for this check." };
}
const riskyCheck = { checkName: "Discount price validation", validatedClientSide: true, validatedServerSide: false };
const safeCheck = { checkName: "Discount price validation", validatedClientSide: true, validatedServerSide: true };
console.log("Risky check:", evaluateTrustBoundary(riskyCheck));
console.log("Safe check:", evaluateTrustBoundary(safeCheck));risky check (client-side ပဲ validate လုပ်ထား) က { verdict: 'risky' } ကို modified client ဖြင့် bypass နိုင်ကြောင်း reason နဲ့ ပြန်ပေးပါတယ်။ safe check (နှစ်ဖက်စလုံး validate) ကတော့ { verdict: 'safe' } ကို server-side enforce လုပ်ထားလို့ modified client က bypass မလုပ်နိုင်ကြောင်း reason နဲ့ ပြန်ပေးပါတယ်။၅ မိနစ် စမ်းကြည့်
စိတ်ကူးထားတဲ့ app တစ်ခုမှာ discount code သုံးခြင်း ဒါမှမဟုတ် premium content ဖွင့်ခြင်းလို action တစ်ခု ရွေးပါ။ client-only-validated version နဲ့ server-validated version နှစ်ခုလုံးအတွက် evaluateTrustBoundary-စတိုင် function ကို run ကြည့်ပြီး risky case ကို ဖြေရှင်းဖို့ backend မှာ ဘာပြောင်းရမလဲ ရေးချပါ။
သတိလေးတစ်ချက်
ငွေကြေး, access, permission ကို ထိခိုက်စေတဲ့ အရာတွေအတွက် client-side check တစ်ခုတည်းကို အားကိုးလိုက်တာ။
debug လုပ်နေစဉ် token, password, payment detail ကို log ချထားပြီး release မလုပ်ခင် ဖယ်ရှားဖို့ မေ့သွားတာ။
OWASP Mobile Top 10 — How Mobile Apps Work