DevSecOps: Pipeline တွေထဲမှာ လုံခြုံရေးကို အလုံပိတ်ထားခြင်း
Developer တွေ Github ပေါ် Code တင်လိုက်တာနဲ့ Secrets တွေ (API Keys, Passwords) မတော်တဆ ပါသွားတာတွေ၊ Docker image မှာ Vulnerabilities တွေ ပါလာတာတွေကို CI/CD Pipeline ထဲမှာ Auto ဘယ်လို ဖမ်းမလဲဆိုတာ ပြထားပါတယ်။
အရင်တုန်းကဆိုရင် System တစ်ခုလုံး ရေးပြီးသွားပြီ (Production တင်တော့မယ်) ဆိုမှ Security Team ကနေ Penetration Test အမြန်လာလုပ်ပြီး Error တွေ တစ်ပုံကြီး ပြလေ့ရှိတယ်။ ဒါမျိုးက အချိန်လည်း အလကားကုန်သလို၊ Developer တွေအတွက်လည်း ပြင်ရတာ အရမ်း Pain ဖြစ်ပါတယ်။
ဒါကြောင့်မို့လို့ Security ကို Code စရေးကတည်းက စစ်ဆေးမယ့် "Shift-Left" Approach (DevSecOps) ကို လက်ရှိခေတ်မှာ မဖြစ်မနေ သုံးလာကြရပါတယ်။
CI/CD Pipeline တစ်ခုထဲမှာ အဓိက ဘာတွေ စစ်သင့်လဲ?
၁။ Secret Scanning (TruffleHog / GitLeaks)
Developer တွေက testing လုပ်ရင်း AWS_ACCESS_KEY တွေ၊ DB_PASSWORD တွေကို Code ထဲမှာ Hardcode လုပ်ပြီး မေ့ကျန်တတ်ပါတယ်။ Github မှာ Push မလုပ်ခင် (Pre-commit hooks) နဲ့ Github Actions တွေမှာ Secret Scanner လေးတွေ တပ်ထားလိုက်ရင်၊ Password ပါလာတာနဲ့ Build ကို Fail ပစ်လိုက်လို့ ရပါတယ်။
၂။ SAST (Static Application Security Testing)
Code (Source Code) ကြီးကို ဖတ်ပြီး SQL Injection ဖြစ်နိုင်လား? XSS အပေါက် ပါနေလား? ဆိုတာကို scan ဖတ်တာပါ။
ဥပမာ- Semgrep လို tool ကို သုံးရင် semgrep --config auto . ဆိုပြီး Pipeline ထဲမှာ ထည့်ထားလိုက်ရုံနဲ့ အန္တရာယ်ရှိတဲ့ Function ခေါ်သုံးမှုတွေကို Auto ဖမ်းပေးပါတယ်။
၃။ Docker Image Security (Trivy)
အခုနောက်ပိုင်း App တွေကို Docker ပေါ်မှာ အများဆုံး တင်ကြတယ်။ node:latest လို Base image အဟောင်းကြီးတွေ သုံးမိရင် OS level အားနည်းချက်တွေ အများကြီး ပါလာတတ်ပါတယ်။
Github Actions မှာ:
yaml- name: Run Trivy vulnerability scanner uses: aquasecurity/trivy-action@master with: image-ref: 'my-app:latest' format: 'table' exit-code: '1' # အားနည်းချက်တွေ့ရင် Pipeline ကို ရပ်ပစ်မယ် ignore-unfixed: true severity: 'CRITICAL,HIGH'
ဒီလိုလေး တစ်ပိုဒ် ထည့်ထားလိုက်တာနဲ့၊ ကိုယ့် Image မှာ High Vulnerability တွေ့ရင် Production ပေါ် တက်ခွင့် မရအောင် အလိုအလျောက် တားဆီးပေးသွားမှာ ဖြစ်ပါတယ်။
Security ဆိုတာ လူတစ်ယောက်တည်း လိုက်မလုပ်နိုင်တော့ပါဘူး။ Automation သာလျှင် ဖြေရှင်းနိုင်မယ့် တစ်ခုတည်းသော နည်းလမ်းပါပဲ ဗျာ!
