Skip to content

Commit

Permalink
Add filter on domain name. Fix where injection.
Browse files Browse the repository at this point in the history
  • Loading branch information
cardigliano committed Oct 28, 2024
1 parent 3473793 commit 8ce99ce
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 8 deletions.
10 changes: 10 additions & 0 deletions httpdocs/tables_config/flow_historical.json
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,16 @@
"no-wrap"
]
},
{
"title_i18n": "db_search.tags.domain_name",
"data_field": "domain_name",
"min-width": "100px",
"sortable": true,
"render_generic": "domain_name",
"class": [
"no-wrap"
]
},
{
"title_i18n": "db_search.tags.wlan_ssid",
"data_field": "wlan_ssid",
Expand Down
1 change: 1 addition & 0 deletions scripts/locales/en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2195,6 +2195,7 @@ local lang = {
["confidence"] = "Confidence",
["country"] = "Country",
["dga_domain_name"] = "Requested Domain Name",
["domain_name"] = "Domain Name",
["dscp_id"] = "DSCP ID",
["dst2src_dscp"] = "Server DSCP",
["dst2src_tcp_flags"] = "Srv TCP Flags",
Expand Down
15 changes: 7 additions & 8 deletions scripts/lua/modules/historical_flow_utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -368,14 +368,12 @@ end

-- #####################################

local function dt_format_ssid_obj(ssid)
local formatted_ssid = {
title = ssid,
label = ssid,
value = ssid,
local function dt_format_str_obj(s)
return {
title = s,
label = s,
value = s,
}

return formatted_ssid
end

-- #####################################
Expand Down Expand Up @@ -1150,8 +1148,9 @@ local flow_columns = {
['POST_NAT_SRC_PORT'] = { tag = "post_nat_src_port", dt_func = dt_format_port, db_type = "Number", db_raw_type = "Uint16" },
['POST_NAT_IPV4_DST_ADDR'] = { tag = "post_nat_ipv4_dst_addr", dt_func = dt_format_nat_ip, select_func = "IPv4NumToString", db_type = "Number", db_raw_type = "Uint32" },
['POST_NAT_DST_PORT'] = { tag = "post_nat_dst_port", dt_func = dt_format_port, db_type = "Number", db_raw_type = "Uint16" },
['WLAN_SSID'] = { tag = "wlan_ssid", dt_func = dt_format_ssid_obj, db_type = "String", db_raw_type = "String" },
['WLAN_SSID'] = { tag = "wlan_ssid", dt_func = dt_format_str_obj, db_type = "String", db_raw_type = "String" },
['WTP_MAC_ADDRESS'] = { tag = "apn_mac", dt_func = dt_format_mac_obj, db_type = "Number", db_raw_type = "Uint64" },
['DOMAIN_NAME'] = { tag = "domain_name", dt_func = dt_format_str_obj, db_type = "String", db_raw_type = "String" },

--[[ TODO: this column is for the aggregated_flow_columns but the parsing Function
only parses these columns, so a new logic to parse only the aggregated_flow_columns
Expand Down
1 change: 1 addition & 0 deletions scripts/lua/modules/http_lint.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1721,6 +1721,7 @@ local known_parameters = {
["name"] = validateEmptyOr(validateListOfTypeInline(validateFilters(validateServer))), -- An IPv4 or IPv6 address or an Hostname
["cli_name"] = validateEmptyOr(validateListOfTypeInline(validateFilters(validateHostName))), -- An IPv4 or IPv6 address or an Hostname
["srv_name"] = validateEmptyOr(validateListOfTypeInline(validateFilters(validateHostName))), -- An IPv4 or IPv6 address or an Hostname
["domain_name"] = validateEmptyOr(validateListOfTypeInline(validateFilters(validateUnquoted))),
["wlan_ssid"] = validateEmptyOr(validateListOfTypeInline(validateFilters(validateUnquoted))),
["cli_port"] = validateListOfTypeInline(validateFilters(validatePort)), -- Client port
["srv_port"] = validateListOfTypeInline(validateFilters(validatePort)), -- Server port
Expand Down
5 changes: 5 additions & 0 deletions scripts/lua/modules/tag_utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,11 @@ tag_utils.defined_tags = {
i18n_label = i18n('db_search.tags.mdns_ssid'),
operators = { 'eq', 'neq', 'in', 'nin' }
},
domain_name = {
value_type = 'text',
i18n_label = i18n('db_search.tags.domain_name'),
operators = { 'eq', 'neq', 'in', 'nin' }
},
alert_domain = {
value_type = 'text',
i18n_label = i18n('db_search.tags.dga_domain_name'),
Expand Down

0 comments on commit 8ce99ce

Please sign in to comment.