opensnitch/daemon/rule
Gustavo Iñiguez Goia 58aa979cae
fixed loading rules when Created field is a timestamp
When exporting rules from the GUI, the Created field was exported as
timestamp. Importing rules worked fine, because json.Marshall() accepts
the timestamp format.

However, when the daemon was loading a rule with the Created field as
timestamp, since the field was defined as time.Time, it expected a RFC3339
string (https://pkg.go.dev/time#Time.UnmarshalJSON)
so it failed to parse the timestamp and the rule was not loaded.

Now the field is defined as string, it's always saved as RFC3339, and if
we fail to parse these fields we'll use a temporary date instead of
failing loading the rule.

More info:
https://github.com/evilsocket/opensnitch/issues/1140#issuecomment-2140904847

Closes #1140
2024-06-10 23:54:54 +02:00
..
testdata rules: improved operator list parsing and conversion 2023-10-09 14:55:15 +02:00
loader.go fixed loading rules when Created field is a timestamp 2024-06-10 23:54:54 +02:00
loader_test.go updated rules tests 2023-10-09 18:07:48 +02:00
operator.go fixed typo 2024-01-15 20:45:17 +01:00
operator_lists.go improved rules reloading, cli parameters 2024-05-22 00:47:54 +02:00
operator_test.go updated rules tests 2023-09-22 01:21:27 +02:00
rule.go fixed loading rules when Created field is a timestamp 2024-06-10 23:54:54 +02:00
rule_test.go deserialize rules operator list correctly 2023-11-11 02:16:08 +01:00