fix: use omitEmpty only on hotspot for SettingIps (#51)

This commit is contained in:
Mateusz Filipowicz
2025-03-16 02:18:36 +01:00
committed by GitHub
parent 98885a12a3
commit e41cfe08e2
2 changed files with 31 additions and 31 deletions

View File

@@ -487,7 +487,7 @@ customizations:
customUnmarshalType: "emptyStringInt"
SettingIps:
fields:
_all:
Honeypot:
omitEmpty: false
SettingMgmt:
fields:

View File

@@ -29,19 +29,19 @@ type SettingIps struct {
Key string `json:"key"`
AdBlockingConfigurations []SettingIpsAdBlockingConfigurations `json:"ad_blocking_configurations"`
AdBlockingConfigurations []SettingIpsAdBlockingConfigurations `json:"ad_blocking_configurations,omitempty"`
AdBlockingEnabled bool `json:"ad_blocking_enabled"`
AdvancedFilteringPreference string `json:"advanced_filtering_preference" validate:"omitempty,oneof=manual disabled"` // |manual|disabled
AdvancedFilteringPreference string `json:"advanced_filtering_preference,omitempty" validate:"omitempty,oneof=manual disabled"` // |manual|disabled
DNSFiltering bool `json:"dns_filtering"`
DNSFilters []SettingIpsDNSFilters `json:"dns_filters"`
EnabledCategories []string `json:"enabled_categories" validate:"omitempty,oneof=emerging-activex emerging-attackresponse botcc emerging-chat ciarmy compromised emerging-dns emerging-dos dshield emerging-exploit emerging-ftp emerging-games emerging-icmp emerging-icmpinfo emerging-imap emerging-inappropriate emerging-info emerging-malware emerging-misc emerging-mobile emerging-netbios emerging-p2p emerging-policy emerging-pop3 emerging-rpc emerging-scada emerging-scan emerging-shellcode emerging-smtp emerging-snmp emerging-sql emerging-telnet emerging-tftp tor emerging-useragent emerging-voip emerging-webapps emerging-webclient emerging-webserver emerging-worm exploit-kit adware-pup botcc-portgrouped phishing threatview-cs-c2 3coresec chat coinminer current-events drop hunting icmp-info inappropriate info ja3 policy scada dark-web-blocker-list malicious-hosts"` // emerging-activex|emerging-attackresponse|botcc|emerging-chat|ciarmy|compromised|emerging-dns|emerging-dos|dshield|emerging-exploit|emerging-ftp|emerging-games|emerging-icmp|emerging-icmpinfo|emerging-imap|emerging-inappropriate|emerging-info|emerging-malware|emerging-misc|emerging-mobile|emerging-netbios|emerging-p2p|emerging-policy|emerging-pop3|emerging-rpc|emerging-scada|emerging-scan|emerging-shellcode|emerging-smtp|emerging-snmp|emerging-sql|emerging-telnet|emerging-tftp|tor|emerging-useragent|emerging-voip|emerging-webapps|emerging-webclient|emerging-webserver|emerging-worm|exploit-kit|adware-pup|botcc-portgrouped|phishing|threatview-cs-c2|3coresec|chat|coinminer|current-events|drop|hunting|icmp-info|inappropriate|info|ja3|policy|scada|dark-web-blocker-list|malicious-hosts
EnabledNetworks []string `json:"enabled_networks"`
DNSFilters []SettingIpsDNSFilters `json:"dns_filters,omitempty"`
EnabledCategories []string `json:"enabled_categories,omitempty" validate:"omitempty,oneof=emerging-activex emerging-attackresponse botcc emerging-chat ciarmy compromised emerging-dns emerging-dos dshield emerging-exploit emerging-ftp emerging-games emerging-icmp emerging-icmpinfo emerging-imap emerging-inappropriate emerging-info emerging-malware emerging-misc emerging-mobile emerging-netbios emerging-p2p emerging-policy emerging-pop3 emerging-rpc emerging-scada emerging-scan emerging-shellcode emerging-smtp emerging-snmp emerging-sql emerging-telnet emerging-tftp tor emerging-useragent emerging-voip emerging-webapps emerging-webclient emerging-webserver emerging-worm exploit-kit adware-pup botcc-portgrouped phishing threatview-cs-c2 3coresec chat coinminer current-events drop hunting icmp-info inappropriate info ja3 policy scada dark-web-blocker-list malicious-hosts"` // emerging-activex|emerging-attackresponse|botcc|emerging-chat|ciarmy|compromised|emerging-dns|emerging-dos|dshield|emerging-exploit|emerging-ftp|emerging-games|emerging-icmp|emerging-icmpinfo|emerging-imap|emerging-inappropriate|emerging-info|emerging-malware|emerging-misc|emerging-mobile|emerging-netbios|emerging-p2p|emerging-policy|emerging-pop3|emerging-rpc|emerging-scada|emerging-scan|emerging-shellcode|emerging-smtp|emerging-snmp|emerging-sql|emerging-telnet|emerging-tftp|tor|emerging-useragent|emerging-voip|emerging-webapps|emerging-webclient|emerging-webserver|emerging-worm|exploit-kit|adware-pup|botcc-portgrouped|phishing|threatview-cs-c2|3coresec|chat|coinminer|current-events|drop|hunting|icmp-info|inappropriate|info|ja3|policy|scada|dark-web-blocker-list|malicious-hosts
EnabledNetworks []string `json:"enabled_networks,omitempty"`
Honeypot []SettingIpsHoneypot `json:"honeypot"`
HoneypotEnabled bool `json:"honeypot_enabled"`
IPsMode string `json:"ips_mode" validate:"omitempty,oneof=ids ips ipsInline disabled"` // ids|ips|ipsInline|disabled
IPsMode string `json:"ips_mode,omitempty" validate:"omitempty,oneof=ids ips ipsInline disabled"` // ids|ips|ipsInline|disabled
MemoryOptimized bool `json:"memory_optimized"`
RestrictTorrents bool `json:"restrict_torrents"`
Suppression SettingIpsSuppression `json:"suppression"`
Suppression SettingIpsSuppression `json:"suppression,omitempty"`
}
func (dst *SettingIps) UnmarshalJSON(b []byte) error {
@@ -81,12 +81,12 @@ func (dst *SettingIpsAdBlockingConfigurations) UnmarshalJSON(b []byte) error {
}
type SettingIpsAlerts struct {
Category string `json:"category"`
Gid int `json:"gid"`
ID int `json:"id"`
Signature string `json:"signature"`
Tracking []SettingIpsTracking `json:"tracking"`
Type string `json:"type" validate:"omitempty,oneof=all track"` // all|track
Category string `json:"category,omitempty"`
Gid int `json:"gid,omitempty"`
ID int `json:"id,omitempty"`
Signature string `json:"signature,omitempty"`
Tracking []SettingIpsTracking `json:"tracking,omitempty"`
Type string `json:"type,omitempty" validate:"omitempty,oneof=all track"` // all|track
}
func (dst *SettingIpsAlerts) UnmarshalJSON(b []byte) error {
@@ -111,14 +111,14 @@ func (dst *SettingIpsAlerts) UnmarshalJSON(b []byte) error {
}
type SettingIpsDNSFilters struct {
AllowedSites []string `json:"allowed_sites"` // ^[a-zA-Z0-9.-]+$|^$
BlockedSites []string `json:"blocked_sites"` // ^[a-zA-Z0-9.-]+$|^$
BlockedTld []string `json:"blocked_tld"` // ^[a-zA-Z0-9.-]+$|^$
Description string `json:"description"`
Filter string `json:"filter" validate:"omitempty,oneof=none work family"` // none|work|family
Name string `json:"name"`
AllowedSites []string `json:"allowed_sites,omitempty"` // ^[a-zA-Z0-9.-]+$|^$
BlockedSites []string `json:"blocked_sites,omitempty"` // ^[a-zA-Z0-9.-]+$|^$
BlockedTld []string `json:"blocked_tld,omitempty"` // ^[a-zA-Z0-9.-]+$|^$
Description string `json:"description,omitempty"`
Filter string `json:"filter,omitempty" validate:"omitempty,oneof=none work family"` // none|work|family
Name string `json:"name,omitempty"`
NetworkID string `json:"network_id"`
Version string `json:"version" validate:"omitempty,oneof=v4 v6"` // v4|v6
Version string `json:"version,omitempty" validate:"omitempty,oneof=v4 v6"` // v4|v6
}
func (dst *SettingIpsDNSFilters) UnmarshalJSON(b []byte) error {
@@ -138,9 +138,9 @@ func (dst *SettingIpsDNSFilters) UnmarshalJSON(b []byte) error {
}
type SettingIpsHoneypot struct {
IPAddress string `json:"ip_address"`
IPAddress string `json:"ip_address,omitempty"`
NetworkID string `json:"network_id"`
Version string `json:"version" validate:"omitempty,oneof=v4 v6"` // v4|v6
Version string `json:"version,omitempty" validate:"omitempty,oneof=v4 v6"` // v4|v6
}
func (dst *SettingIpsHoneypot) UnmarshalJSON(b []byte) error {
@@ -160,8 +160,8 @@ func (dst *SettingIpsHoneypot) UnmarshalJSON(b []byte) error {
}
type SettingIpsSuppression struct {
Alerts []SettingIpsAlerts `json:"alerts"`
Whitelist []SettingIpsWhitelist `json:"whitelist"`
Alerts []SettingIpsAlerts `json:"alerts,omitempty"`
Whitelist []SettingIpsWhitelist `json:"whitelist,omitempty"`
}
func (dst *SettingIpsSuppression) UnmarshalJSON(b []byte) error {
@@ -181,9 +181,9 @@ func (dst *SettingIpsSuppression) UnmarshalJSON(b []byte) error {
}
type SettingIpsTracking struct {
Direction string `json:"direction" validate:"omitempty,oneof=both src dest"` // both|src|dest
Mode string `json:"mode" validate:"omitempty,oneof=ip subnet network"` // ip|subnet|network
Value string `json:"value"`
Direction string `json:"direction,omitempty" validate:"omitempty,oneof=both src dest"` // both|src|dest
Mode string `json:"mode,omitempty" validate:"omitempty,oneof=ip subnet network"` // ip|subnet|network
Value string `json:"value,omitempty"`
}
func (dst *SettingIpsTracking) UnmarshalJSON(b []byte) error {
@@ -203,9 +203,9 @@ func (dst *SettingIpsTracking) UnmarshalJSON(b []byte) error {
}
type SettingIpsWhitelist struct {
Direction string `json:"direction" validate:"omitempty,oneof=both src dest"` // both|src|dest
Mode string `json:"mode" validate:"omitempty,oneof=ip subnet network"` // ip|subnet|network
Value string `json:"value"`
Direction string `json:"direction,omitempty" validate:"omitempty,oneof=both src dest"` // both|src|dest
Mode string `json:"mode,omitempty" validate:"omitempty,oneof=ip subnet network"` // ip|subnet|network
Value string `json:"value,omitempty"`
}
func (dst *SettingIpsWhitelist) UnmarshalJSON(b []byte) error {