Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
エラーログのマスキングの仕組みづくりに役立ったASTの話
Search
Kenichi Shihota
February 24, 2026
Programming
810
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
エラーログのマスキングの仕組みづくりに役立ったASTの話
ASTを活用し、エラーマスキング解除の漏れを警告するLinterを実装した事例を紹介しています。
Kenichi Shihota
February 24, 2026
Other Decks in Programming
See All in Programming
テストを司るデーモンに会いに行く 〜隔離した仮想マシンでテストを通すまで〜
h1d3mun3
1
540
変化を抱擁するドキュメントの作り方 - ビジネスルール駆動開発がもたらす、コードとの新しい関係
ioki
2
220
Vibes Containers 〜AIで変わるコンテナ設計と運用〜
tkikuc
3
550
AWS Step Functions 大規模並列の壁を越える / jaws-sonic-2026-niigata-step-functions
kasacchiful
PRO
1
500
WebRTC映像をAirPlayに対応させる挑戦.pdf
monolithic_adam
0
290
Starting & Sustaining Code-Based E2E Testing for Non-Coding QA Teams( #jasstniigata )
teyamagu
PRO
1
460
cdk deploy JawsSonic #MARATHONしながらAWSリソースをデプロイしてみよう
akihisaikeda
2
140
AIは賢い。でも実行環境は? CLIおじさんがAI時代に伝えたいこと ~ CLIおじさんがAI時代に伝えたいこと ~
curekoshimizu
1
250
仕様駆動開発による爆速プロダクト開発 / Bakusoku Spec Driven Development
kobakei
0
120
Intent as Code
shoppingjaws
6
1.1k
Heart of Swift Concurrency
koher
0
930
wkhtmltopdfの次どうするか問題2026
willnet
2
1.6k
Featured
See All Featured
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
1k
Leo the Paperboy
mayatellez
10
2.3k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
430
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
460
AI Search: Where Are We & What Can We Do About It?
aleyda
0
8k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.6k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
420
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
280
How to Talk to Developers About Accessibility
jct
2
550
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.4k
Automating Front-end Workflow
addyosmani
1369
210k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
2
280
Transcript
エラーログのマスキングの仕組みづくりに 役⽴ったASTの話
⾃⼰紹介 Kumoichi14 経歴: 新卒1年⽬ 職種: バックエンドエンジニア 趣味: スマブラ(⼤乱闘)
プレゼンテーション構成 ‧マスキングを導⼊したことにより出てきた課題 ‧課題解決にASTがどう役⽴ったか ‧マスキングとマスキング解除の挙動の紹介 はじまり
1. コード上での呼び出し 2. ログへの出⼒結果 ※変数 title の値が⾃動的に検知‧加⼯されます。 errorsx.Errorf(“invalid title: %s”,
title) invalid title: ***** マスキングの挙動例 string, struct など
1. コード上での呼び出し 2. ログへの出⼒結果 errorsx.Errorf(“invalid title: %s”, mask.WithoutMasking(title)) invalid title:
GolangTokyo マスキングの対象外とする挙動例
なぜマスキングされる型に対して、マスキング対象外と する関数を毎回つけるのか
この「付与忘れ」を仕組みで防ぎたかった マスキング対象外とする関数(withoutMasking) をつけ忘れる可能性があった 課題
ASTを活用してLinterを作れば、特定の関数の付与のし 忘れなどを検知できると知った
コードを「情報のツリー」として捉える ソースコードを単なる⽂字列ではなく、コンピューターが理解 できる階層構造(⽊構造)に変換したものです。 • 役割の明確化: パッケージ名、関数名、引数、リテラル値などを、 意味を持つ最小単位(ノード)として個別に識別。 AST(抽象構⽂⽊)とは
CallExpr 関数呼び出し全体 FUN(SelectorExpr) 呼び出す対象 X(Ident) 受信者 / 左側 SEL(Ident) 選択子
/ 右側 Arg([]AST.Expr) 引数リスト Arg[0](BasicLit) リテラル値 Arg[1](Ident) 変数 errorsx.Errorf(“invalid title: %s”, title) errorsx.Errorf errorsx Errorf “invalid title: %s“ title ["invalid title: %s", title] errorsx.Errorf(“invalid title: %s”, title)
コードの差分を取得 ① パッケージ名がerrorsxを含むものがあるかを確かめる ② 関数名がErrofであることを確かめる ③ 変数(title)がWithoutMasking付与対象内の型であることを確かめる ここまで確認が取れたら、警告を出す mask.WithoutMasking()つけ忘れ検知の流れ
CallExpr 関数呼び出し全体 FUN(SelectorExpr) 呼び出す対象 SEL(IDENT) 選択子 Arg([]AST.EXPR) 引数リスト Arg[0](BASICLIT) リテラル値
Arg[1](IDENT) 変数 errorsx.Errorf(“invalid title: %s”, title) errorsx.Errorf Errorf “invalid title: %s“ title ["invalid title: %s", title] X(Ident) 受信者 / 左側 SEL(Ident) 選択子 / 右側 errorsx Errorf “errorsx”であることを確認
CallExpr 関数呼び出し全体 FUN(SelectorExpr) 呼び出す対象 Arg([]AST.EXPR) 引数リスト Arg[0](BASICLIT) リテラル値 Arg[1](IDENT) 変数
errorsx.Errorf(“invalid title: %s”, title) errorsx.Errorf Errorf “invalid title: %s“ title ["invalid title: %s", title] “Errorf”であることを確認 X(Ident) 受信者 / 左側 SEL(Ident) 選択子 / 右側 errorsx Errorf
CallExpr 関数呼び出し全体 FUN(SelectorExpr) 呼び出す対象 Arg([]AST.EXPR) 引数リスト Arg[0](BASICLIT) リテラル値 Arg[1](IDENT) 変数
errorsx.Errorf(“invalid title: %s”, title) errorsx.Errorf “invalid title: %s“ title ["invalid title: %s", title] titleがマスキング対象内の型であるこ とを確認(analysis.Pass.TypesInfoが型 情報を持っている) titleの型はstringであるので マスキング対象内の型 X(Ident) 受信者 / 左側 SEL(Ident) 選択子 / 右側 errorsx Errorf
Linterでの関数付与忘れの検知 errorsx.Errorf(“invalid title: %s”, title) ASTを利用した検知の仕組み エラーログに出していい値なことを確認したうえで、 mask.WithoutMaskingを付与してください
学び
ご静聴ありがとうございました