turbot / steampipe-plugin-net

Use SQL to instantly query DNS records, certificates and other network information. Open source CLI. No DB required.
https://hub.steampipe.io/plugins/turbot/net
Apache License 2.0
23 stars 5 forks source link

Table `net_dns_record` not listing correct results for consecutive queries when used filter for `type` column #21

Closed LalitLab closed 2 years ago

LalitLab commented 2 years ago

Describe the bug net_dns_record not listing correct results for consecutive queries when used filter for type field

> select * from net_dns_record where domain = 'turbot.com' and type = 'NS'
+------------+------+--------+--------------------------+----------+--------+--------+
| domain     | type | ip     | target                   | priority | value  | ttl    |
+------------+------+--------+--------------------------+----------+--------+--------+
| turbot.com | NS   | <null> | ns-1312.awsdns-36.org.   | <null>   | <null> | 172800 |
| turbot.com | NS   | <null> | ns-287.awsdns-35.com.    | <null>   | <null> | 172800 |
| turbot.com | NS   | <null> | ns-2039.awsdns-62.co.uk. | <null>   | <null> | 172800 |
| turbot.com | NS   | <null> | ns-517.awsdns-00.net.    | <null>   | <null> | 172800 |
+------------+------+--------+--------------------------+----------+--------+--------+

Time: 85.174741ms
> select * from net_dns_record where domain = 'turbot.com' and type = 'A'
+--------+------+----+--------+----------+-------+-----+
| domain | type | ip | target | priority | value | ttl |
+--------+------+----+--------+----------+-------+-----+
+--------+------+----+--------+----------+-------+-----+

Time: 4.52282ms
> select * from net_dns_record where domain = 'turbot.com' and type = 'SOA'
+--------+------+----+--------+----------+-------+-----+
| domain | type | ip | target | priority | value | ttl |
+--------+------+----+--------+----------+-------+-----+
+--------+------+----+--------+----------+-------+-----+

Time: 4.568473ms
> select * from net_dns_record where domain = 'turbot.com' and type = 'MX'
+--------+------+----+--------+----------+-------+-----+
| domain | type | ip | target | priority | value | ttl |
+--------+------+----+--------+----------+-------+-----+
+--------+------+----+--------+----------+-------+-----+

Time: 5.069768ms
> select * from net_dns_record where domain = 'turbot.com'
+------------+------+--------+--------------------------+----------+--------+--------+
| domain     | type | ip     | target                   | priority | value  | ttl    |
+------------+------+--------+--------------------------+----------+--------+--------+
| turbot.com | NS   | <null> | ns-1312.awsdns-36.org.   | <null>   | <null> | 172800 |
| turbot.com | NS   | <null> | ns-287.awsdns-35.com.    | <null>   | <null> | 172800 |
| turbot.com | NS   | <null> | ns-2039.awsdns-62.co.uk. | <null>   | <null> | 172800 |
| turbot.com | NS   | <null> | ns-517.awsdns-00.net.    | <null>   | <null> | 172800 |
+------------+------+--------+--------------------------+----------+--------+--------+

Time: 5.259996ms
> .cache clear
> select * from net_dns_record
Error: rpc error: code = Internal desc = 'List' call for table 'net_dns_record' is missing 1 required qual: column:'domain' operator: =
 (SQLSTATE HV000)
> select * from net_dns_record where domain = 'turbot.com'
+------------+------+--------------+--------------------------+----------+--------+--------+
| domain     | type | ip           | target                   | priority | value  | ttl    |
+------------+------+--------------+--------------------------+----------+--------+--------+
| turbot.com | A    | 54.182.0.62  | <null>                   | <null>   | <null> | 60     |
| turbot.com | A    | 54.182.0.126 | <null>                   | <null>   | <null> | 60     |
| turbot.com | A    | 54.182.0.125 | <null>                   | <null>   | <null> | 60     |
| turbot.com | A    | 54.182.0.32  | <null>                   | <null>   | <null> | 60     |
| turbot.com | MX   | <null>       | alt3.aspmx.l.google.com. | 10       | <null> | 300    |
| turbot.com | MX   | <null>       | alt2.aspmx.l.google.com. | 5        | <null> | 300    |
| turbot.com | MX   | <null>       | aspmx.l.google.com.      | 1        | <null> | 300    |
| turbot.com | MX   | <null>       | alt1.aspmx.l.google.com. | 5        | <null> | 300    |
| turbot.com | MX   | <null>       | alt4.aspmx.l.google.com. | 10       | <null> | 300    |
| turbot.com | NS   | <null>       | ns-2039.awsdns-62.co.uk. | <null>   | <null> | 172800 |
| turbot.com | NS   | <null>       | ns-287.awsdns-35.com.    | <null>   | <null> | 172800 |
| turbot.com | NS   | <null>       | ns-517.awsdns-00.net.    | <null>   | <null> | 172800 |
| turbot.com | NS   | <null>       | ns-1312.awsdns-36.org.   | <null>   | <null> | 172800 |
| turbot.com | SOA  | <null>       | ns-1312.awsdns-36.org.   | <null>   | <null> | 900    |
+------------+------+--------------+--------------------------+----------+--------+--------+

Steampipe version (steampipe -v) v0.13.2

Plugin version (steampipe plugin list) v0.1.1

To reproduce witch cache ON execute below queries in order they appear here:

  1. select * from net_dns_record where domain = 'turbot.com' and type = 'NS'
  2. select * from net_dns_record where domain = 'turbot.com' and type = 'A'
  3. .cache clear
  4. select * from net_dns_record where domain = 'turbot.com'

Expected behavior A clear and concise description of what you expected to happen.

Additional context Add any other context about the problem here.