Regex 比對器 (proto)
.xds.type.matcher.v3.RegexMatcher
[.xds.type.matcher.v3.RegexMatcher proto]
一個 regex 比對器,在與不受信任的輸入一起使用時,專為安全而設計。
{
"google_re2": {...},
"regex": ...
}
- google_re2
(.xds.type.matcher.v3.RegexMatcher.GoogleRE2, 必要) Google 的 RE2 regex 引擎。
- regex
(字串, 必要) regex 比對字串。此字串必須受已設定的引擎支援。
.xds.type.matcher.v3.RegexMatcher.GoogleRE2
[.xds.type.matcher.v3.RegexMatcher.GoogleRE2 proto]
Google 的 RE2 regex 引擎。regex 字串必須遵守文件中記錄的語法。此引擎旨在線性時間內完成執行,並限制使用的記憶體量。
Envoy 透過執行時間支援程式大小檢查。執行時間鍵 re2.max_program_size.error_level 和 re2.max_program_size.warn_level 可以設定為整數,作為編譯後的 regex 可以在拋出例外或記錄警告之前擁有的最大程式大小或複雜度。re2.max_program_size.error_level 預設為 100,如果未設定 re2.max_program_size.warn_level 則沒有預設值(不會檢查/記錄警告)。
Envoy 發出兩個統計資訊,用於追蹤 regex 的程式大小:直方圖 re2.program_size,記錄程式大小;以及計數器 re2.exceeded_warn_level,每次程式大小超過警告級別閾值時遞增。