zeek icon indicating copy to clipboard operation
zeek copied to clipboard

Table constructors allow creating values with non-Zeek-accessible types

Open vpax opened this issue 2 years ago • 0 comments

https://github.com/zeek/zeek/blob/686eb54f9590fb491582f1bab10b754c9bd419fc/testing/btest/bifs/table_values.zeek#L8 constructs a complex table using:

table( ["web"] = { [80/tcp, "http"], [443/tcp, "https"] }, ["login"] = { [21/tcp, "ftp"], [23/tcp, "telnet"] });

If you print the type of this table, you get: table[string] of list of list of port,string,list of port,string. In general, I don't think we (currently) want to expose list types to script-land when we can avoid it, so I think this constructor should either produce an error, or result in a more reasonable type. Regarding what's more reasonable, the following works fine:

table( ["web"] = set( [80/tcp, "http"], [443/tcp, "https"] ), ["login"] = set( [21/tcp, "ftp"], [23/tcp, "telnet"] ));

with the unsurprising type table[string] of set[port,string].

vpax avatar Aug 27 '22 16:08 vpax