// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// This flatbuffer represents a machine learning model which is used to compute
// the probability that a particular page visited by Chrome is phishing.
//
// Note: since the machine learning model is trained on the server-side and then
// downloaded onto the client it is important that this flatbuffer file stays in
// sync with the server-side copy. Otherwise, the client may not be able to
// parse the server generated model anymore. If you want to change this
// flatbuffer definition or you have questions regarding its format please contact
// [email protected].
include "components/safe_browsing/core/common/fbs/csd.fbs";
namespace safe_browsing.flat;
table Hash {
data:[ubyte];
}
table ClientSideModel {
hashes:[Hash];
rule:[safe_browsing.flat.ClientSideModel_.Rule];
page_term:[int];
page_word:[uint];
max_words_per_term:int;
version:int;
bad_subnet:[safe_browsing.flat.ClientSideModel_.IPSubnet];
murmur_hash_seed:uint;
max_shingles_per_page:int = 200;
shingle_size:int = 4;
threshold_probability:float = 0.5;
vision_model:safe_browsing.flat.VisionModel;
tflite_model_version:int (deprecated);
tflite_thresholds:[safe_browsing.flat.TfLiteModelMetadata_.Threshold]
(deprecated);
tflite_model_input_width: int (deprecated);
tflite_model_input_height: int (deprecated);
tflite_metadata:safe_browsing.flat.TfLiteModelMetadata;
img_embedding_metadata:safe_browsing.flat.TfLiteModelMetadata;
dom_model_version:int;
}
root_type ClientSideModel;
namespace safe_browsing.flat.ClientSideModel_;
table Rule {
feature:[int];
weight:float;
}
table IPSubnet {
prefix:[ubyte] (required);
size:int = 128;
}
namespace safe_browsing.flat;
table TfLiteModelMetadata {
version:int;
thresholds:[safe_browsing.flat.TfLiteModelMetadata_.Threshold];
input_width: int;
input_height: int;
}
namespace safe_browsing.flat.TfLiteModelMetadata_;
table Threshold {
label:string;
threshold:float;
esb_threshold:float;
}
namespace safe_browsing.flat;
table VisionModel {
targets:[safe_browsing.flat.VisualTarget];
}
table VisualTarget {
digest:[ubyte];
timestamp_usec:long;
hash:[ubyte];
dimension_size:int;
bins:[safe_browsing.flat.VisualFeatures_.ColorHistogramBin];
match_config:safe_browsing.flat.MatchConfig;
}
table MatchConfig {
match_rule:[safe_browsing.flat.MatchRule];
}
table MatchRule {
hash_distance:double;
color_distance:double;
color_range:[safe_browsing.flat.MatchRule_.ColorRange];
float_color_range:[safe_browsing.flat.MatchRule_.FloatColorRange];
}
namespace safe_browsing.flat.MatchRule_;
table ColorRange {
low:int;
high:int;
}
table FloatColorRange {
low:float;
high:float;
}