microsoft / Kusto-Query-Language

Kusto Query Language is a simple and productive language for querying Big Data.
Apache License 2.0
510 stars 97 forks source link

know if there is search/ find operator in query text #78

Closed amitharitan closed 1 year ago

amitharitan commented 2 years ago

Hi there,

TLDR: I wish to know if the query has a find/search operator in the text.

More details: I have a BE solution where I need to know which tables are taking part in the query to know if a user is allowed to view them. While using search (*) | or just search | all the tables will be used in the query, and I wish to be able to know that so that I will not allow certain users to do that.

Thanks in advance! Amit

sloutsky commented 2 years ago

Instead of analyzing query (which may not be possible in some cases - as the query may be complex, or even include dynamic evaluation) - use 'restrict statement' (check-docs) in the middle-tier to allow user access only to a specific tables

mattwar commented 1 year ago

You can already do this using the parser library. Examples are here: https://github.com/microsoft/Kusto-Query-Language/tree/master/src/Kusto.Language