CodeQLが「models-as-data」形式でサニタイザーとバリデーターをサポート
本文の状態
日本語全文を表示中
詳細モードで約2分の本文を読めます。
同じ出来事の情報源
この情報源を基点に整理
GitHub Changelog
GitHubのCodeQLは、主要言語でサニタイザーとバリデーターを「models-as-data」形式で定義可能にした。これにより、ユーザーは汚染データ追跡をカスタマイズできる。
Continue in AI NEW LAB
このニュースを、実務の判断につなげる
AI NEW LABで、試したことや先に確認したい条件を共有できます。まずはログインなしで読めます。
AI NEW LABで論点を見るSource Article
元記事を日本語で読む
本文に関係しない購読案内、埋め込み通知、サイト内プロモーションは除いています。
CodeQLは、コード内のセキュリティ問題を発見して修正するGitHubコードスキャン(GitHub code scanning)の背後にある静的解析エンジン(static analysis engine)です。C/C++、C#、Go、Java/Kotlin、JavaScript/TypeScript、Python、Ruby、Rustの各言語において、データ拡張(models-as-data)を使用してカスタムのサニタイザーとバリデーターを定義できるようになりました。
What’s new
CodeQLでは、サニタイザーとバリデーターはそれぞれバリア(barriers)とバリアガード(barrier guards)として表現されます。
バリアとバリアガードを使用すると、CodeQLがコード内をどのように汚染データ(tainted data)として追跡するかをカスタマイズできます。バリアは、特定の脆弱性タイプに対して出力がサニタイズ済みとみなされる関数やメソッドを示します(例:クロスサイトスクリプティングを防止するHTMLエスケープ関数)。バリアガードは、データが安全かどうかを示すブール値を返す関数を示し、ガードされた分岐を通る汚染フロー(taint flow)を停止します。
以前は、バリアを定義するにはカスタムのCodeQLコードを書く必要がありました。現在では、2つの新しい拡張可能な述語(extensible predicates)を使用して、YAMLデータ拡張ファイルで宣言的に追加できるようになりました。
barrierModel:指定されたクエリ種別(query kind)に対して、モデル化された要素で汚染フローを停止します。
barrierGuardModel:条件チェックが期待される値を返したときに、汚染フローを停止します。
これらの新しい述語でモデル化されたバリアをCodeQLモデルパック(CodeQL model packs)に追加できます。これにより、カスタムのCodeQLコードを記述することなく、プロジェクト独自のサニタイズおよび検証関数を認識するようにCodeQLの分析を拡張しやすくなります。
Learn more
各言語でのバリアとバリアガードの定義方法に関する詳細と例については、カスタマイズガイドを参照してください。
Customizing library models for C and C++
Customizing library models for C#
Customizing library models for Go
Customizing library models for Java and Kotlin
Customizing library models for JavaScript
Customizing library models for Python
Customizing library models for Ruby
GitHubコードスキャンでCodeQLモデルパックを使用する方法に関する詳細は、CodeQLモデルパックによるCodeQLカバレッジの拡張(Extending CodeQL coverage with CodeQL model packs)を参照してください。
この機能はCodeQL 2.25.2以降で利用可能です。
記事「CodeQL now supports sanitizers and validators in models-as-data」は、The GitHub Blogに最初に掲載されました。
原文を表示
CodeQL is the static analysis engine behind GitHub code scanning, which finds and remediates security issues in your code. You can now define custom sanitizers and validators using data extensions (models-as-data) across C/C++, C#, Go, Java/Kotlin, JavaScript/TypeScript, Python, Ruby, and Rust.
What’s new
In CodeQL, sanitizers and validators are represented as barriers and barrier guards respectively.
Barriers and barrier guards let you customize how CodeQL tracks tainted data through your code. A barrier marks a function or method whose output is considered sanitized for a specific vulnerability type (e.g., an HTML-escaping function that prevents cross-site scripting). A barrier guard marks a function that returns a boolean indicating whether data is safe, stopping taint flow through guarded branches.
Previously, defining barriers required writing custom CodeQL code. Now, you can add them declaratively in YAML data extension files using two new extensible predicates:
barrierModel: Stops taint flow at the modeled element for a specified query kind.
barrierGuardModel: Stops taint flow when a conditional check returns an expected value.
You can add barriers modeled with these new predicates to CodeQL model packs. This makes it easier to extend CodeQL’s analysis to recognize your project’s own sanitization and validation functions without writing custom CodeQL.
Learn more
For details and examples on how to define barriers and barrier guards for your language, see the customization guides:
Customizing library models for C and C++
Customizing library models for C#
Customizing library models for Go
Customizing library models for Java and Kotlin
Customizing library models for JavaScript
Customizing library models for Python
Customizing library models for Ruby
For more information about using CodeQL model packs in GitHub code scanning, see Extending CodeQL coverage with CodeQL model packs.
This feature is available starting with CodeQL 2.25.2.
The post CodeQL now supports sanitizers and validators in models-as-data appeared first on The GitHub Blog.
今日のまとめ
AIデイリーブリーフで今日の重要ニュースをまとめ読み