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
880
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
ソニーのクラウド共通基盤の変遷とAI時代の開発スタイルに合わせた進化 / The Journey of Sony’s Common Cloud Platform and Its Evolution for AI-Native Development
kenjiyoneyama
0
270
When benchmarks go bad - what I learned from measuring performance wrong
hollycummins
0
220
dotNET_vulnclicker_intro.pdf
deka_morita
0
140
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
750
Rでドレミ/Do-Re-Mi_with_R
florets1
0
130
Web Framework Benchmark Battle 2026, Any%
a_matsuda
2
2k
Domain-Driven Transformation
hschwentner
2
2.3k
コーディング自動化の次へ。人の介入をゼロにするファクトリーとサポートAIによる実践
timakin
4
3.5k
最近”作らせてる” ローカルAIアプリの話
akit37
0
470
個人開発者よ、Honoを使え(おじさんver)
tanahiro2010
2
260
作って学ぶSpring BootのAuto Configuration / JJUG Night Seminar 2026-10-19
rshindo
0
140
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
180
Featured
See All Featured
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
3.1k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
570
My Coaching Mixtape
mlcsv
0
360
Practical Orchestrator
shlominoach
192
12k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
360
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.6k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
570
sira's awesome portfolio website redesign presentation
elsirapls
0
450
Measuring & Analyzing Core Web Vitals
bluesmoon
9
1k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
7k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
1
280
YesSQL, Process and Tooling at Scale
rocio
174
15k
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を付与してください
学び
ご静聴ありがとうございました