11 #include <booster/copy_ptr.h> 12 #include <booster/regex.h> 13 #include <booster/function.h> 14 #include <cppcms/defs.h> 36 struct basic_rules_holder;
188 rules(std::string
const &file_name);
203 opening_and_closing = 1,
211 html_type html()
const;
216 void html(html_type t);
224 void add_tag(std::string
const &name,
tag_type = any_tag);
229 void add_entity(std::string
const &name);
235 bool numeric_entities_allowed()
const;
240 void numeric_entities_allowed(
bool v);
254 void add_boolean_property(std::string
const &tag_name,std::string
const &property);
258 void add_property(std::string
const &tag_name,std::string
const &property,validator_type
const &val);
262 void add_property(std::string
const &tag_name,std::string
const &property,
booster::regex const &r);
267 void add_integer_property(std::string
const &tag_name,std::string
const &property);
276 void add_uri_property(std::string
const &tag_name,std::string
const &property);
284 void add_uri_property(std::string
const &tag_name,std::string
const &property,std::string
const &schema);
309 CPPCMS_DEPRECATED
static booster::regex uri_matcher(std::string
const &schema);
317 static validator_type uri_validator();
333 static validator_type uri_validator(std::string
const &scheme,
bool absolute_only =
false);
339 static validator_type relative_uri_validator();
344 bool comments_allowed()
const;
348 void comments_allowed(
bool comments);
365 void encoding(std::string
const &enc);
374 tag_type valid_tag(details::c_string
const &tag)
const;
380 bool valid_boolean_property(details::c_string
const &tag,details::c_string
const &property)
const;
386 bool valid_property(details::c_string
const &tag,details::c_string
const &property,details::c_string
const &value)
const;
391 bool valid_entity(details::c_string
const &val)
const;
397 std::string encoding()
const;
403 basic_rules_holder &impl();
404 basic_rules_holder
const &impl()
const;
425 CPPCMS_API
bool validate(
char const *begin,
char const *end,
rules const &r);
436 std::string &filtered,
437 filtering_method_type method=remove_invalid,
438 char replacement_char = 0);
444 CPPCMS_API std::string
filter(
char const *begin,
447 filtering_method_type method=remove_invalid,
448 char replacement_char = 0);
452 CPPCMS_API std::string
filter(std::string
const &input,
454 filtering_method_type method=remove_invalid,
455 char replacement_char = 0);
This is a simple wrapper of PCRE library.
Definition: perl_regex.h:35
This class is central representation of json objects.
Definition: json.h:140
CPPCMS_API std::string filter(char const *begin, char const *end, rules const &r, filtering_method_type method=remove_invalid, char replacement_char=0)
Filter the input in range [begin, end) according to the rules r using filtering method method...
tag_type
Definition: xss.h:201
CPPCMS_API bool validate(char const *begin, char const *end, rules const &r)
Check the input in range [begin, end) according to the rules r.
This is the namespace where all CppCMS functionality is placed.
Definition: application.h:19
The class that holds XSS filter rules.
Definition: xss.h:90
booster::function< bool(char const *begin, char const *end)> validator_type
Definition: xss.h:245
filtering_method_type
The enumerator that defines filtering invalid HTML method.
Definition: xss.h:414
Definition: function.h:16
CPPCMS_API bool validate_and_filter_if_invalid(char const *begin, char const *end, rules const &r, std::string &filtered, filtering_method_type method=remove_invalid, char replacement_char=0)
Validate the input in range [begin, end) according to the rules r and if it is not valid filter it an...
html_type
Definition: xss.h:193
Assume that the input is XHTML.
Definition: xss.h:194
Remove all invalid HTML form the input.
Definition: xss.h:415
Escape (convert to text) all invalid HTML in the input.
Definition: xss.h:416