Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
2024年は難読化と仲良くなりたい
Search
みっちゃん
January 22, 2024
Programming
0
290
2024年は難読化と仲良くなりたい
ebisu.mobile #4での登壇内容です
https://hey.connpass.com/event/305181/
みっちゃん
January 22, 2024
Tweet
Share
More Decks by みっちゃん
See All by みっちゃん
DroidKaigi初めて登壇したレポ
mitchan
1
73
実践!難読化ガイド
mitchan
0
1.3k
「実践!難読化ガイド」事前予告編
mitchan
0
140
画面遷移 〜iOSとAndroid〜
mitchan
0
22
パソコン音痴な私がモバイル開発界隈でぬくぬく成長している理由
mitchan
0
330
ドキュメントから adbコマンドの仕組みを読み解く
mitchan
1
220
STORES二年生が得た新しい視点
mitchan
0
250
TabLayoutの「選択されていないインジケーター」にも色を付けるには
mitchan
0
68
Material Design とは
mitchan
0
79
Other Decks in Programming
See All in Programming
Mercari AI/LLM Hackathon TeamBの発表資料
imaikosuke
0
180
Unlocking Python's Core Magic
leew
0
140
データマイグレーションの成功戦略~サービスリニューアルで失敗しないための実践ガイド~
tkzwtks
8
840
Folding Cheat Sheet #8
philipschwarz
PRO
0
120
VS Code extension: ドラッグ&ドロップでファイルを並び替える
ttrace
0
190
実践サーバーレスパフォーマンスチューニング ~その実力に迫る~ / Practical Serverless Performance Tuning ~A Close Look at its Power~
seike460
PRO
2
230
/←このスケジュール表に立ち向かう フロントエンド開発戦略 / A front-end development strategy to tackle a single-slash schedule.
nrslib
1
390
How to debug Xdebug... or any other weird bug in PHP
dunglas
2
1.5k
自分だけの世界を創るクリエイティブコーディング / Creative Coding: Creating Your Own World
chobishiba
2
2k
GrafanaのHTTP API を眺めてみよう
rinchoku
0
440
Going Staff - Keynote edition
pragtob
0
340
tsconfig.jsonの最近の新機能 ファイルパス編
uhyo
7
1.9k
Featured
See All Featured
A better future with KSS
kneath
237
17k
How GitHub (no longer) Works
holman
311
140k
The Pragmatic Product Professional
lauravandoore
31
6.2k
Optimising Largest Contentful Paint
csswizardry
31
2.9k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
231
17k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.6k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
KATA
mclloyd
29
13k
Become a Pro
speakerdeck
PRO
24
4.9k
Art, The Web, and Tiny UX
lynnandtonic
296
20k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
40
2.1k
Designing for humans not robots
tammielis
249
25k
Transcript
2024年は難読化と仲良くなりたい 登壇者:STORES 決済 Androidチーム みっちゃん 1
自己紹介 名前:みっちゃん(4月で3年目) 所属:STORES 決済 Androidチーム ナワバリ:おおさか My fun:犬!!猫!! Twitter: @mimimi_engineer
2
コンピュータプログラムの動作を変えずに、プログラムコードの内部的な手続き の内容・構造・データなどを、人間にとって読み取りにくくなるように改変・加 工すること。難読化されたコードは第三者によるプログラムの解読・解析が困難 になる。 参考:wikipedia 難読化 (ソフトウェア) 難読化ってなに? 3
変数や関数名を意味のない文字列に変換するなどしてコードを読みにく くし、悪意のあるユーザーからコードを守ることができる! セキュリティ対策の一環! 4
• R8(あーるえいと) Androidアプリの「圧縮」「難読化」「最適化」を行うのツールのこと! どんなツールを使うの? 5
• Android Gradle プラグイン 3.4.0 以上を使用したプロジェクトのビルドでは、デフォルト でR8 コンパイラと連携して、コンパイル時に圧縮・難読化・最適化が実行される • 難読化によってコードが悪意のあるユーザから守られる
• 圧縮・最適化によってAndroidアプリ/ ライブラリのサイズが小さくなる 参考:Android Developer アプリの圧縮、難読化、最適化 R8(あーるえいと) 6
R8 は ProGuard ルールファイルを通じて、デフォルトの動作を変更したり、ア プリの構造を正確に把握したりできます。 参考:R8 の構成ファイル • <module-dir>/proguard-rules.pro 独自の
ProGuard ルールをこのファイルに含めます。 どんなコードを書くの? 7
ProGuardルールファイルに-keepを追加し、 特定のコードを削除しないように宣言することができる どんなコードを書くの? 8
STORES 決済 はアプリだけでなくSDKも公開している 2023年12月27日夜 年明け1月4日から新バージョンSDKのQAを開始するための準備中、事件勃発。 2023年は難読化とケンカしちゃった 9
事件勃発! 新バージョンSDKのQA用アプリを用意するのに、 難読化ありでビルドが通らない・・・!
難読化ってなに 先輩明日からお 休みですよね 29日休みたい だが28日一人で 解決できる自信 はない
ウ、ウワァーーーーーーーーーーーーーーーーーーー!!!!!(大混乱)
落ち着いてエラーをみます。
HogeManagerクラスのgetInstance()というメソッドが参照できなくなっている
companion object内に定義されたメソッドの難読化回避はこうしてこう。 参考資料:keep rules companion object
ErrorTypesインターフェースのUNAUTHORIZEDという定数が参照できなくなっている
companion object内に定義された定数の難読化回避はこうしてこう。 参考資料:keep rules companion object
あれ!!できない!!!
アッ・・・!! classじゃなくてinterfaceだった!!
こうだ!
え・・・ダメなんだけど・・・
interface内のcompanion objectに定義された定数を難読化対象から外すような proguardルールはどう書けばよかったのか、結局わからなかった・・・
@Keepで難読化回避
@Keepアノテーションとは • @Keepも-keepと同じで難読化の対象から外す役割がある • ライブラリコードの中では使用しちゃだめ ◦ (🚨Android Developersにベストプラクティスとしての記載あり)
2024年は・・・ 難読化は友達!怖くないよ!
おしまい 26