i did some research about grafana public dashboard, i got the solution. it use a proxy to do that. all the api request only have dashboardId, pannelId, it never fire a search request with sql. with this it is easy to do.
we can only check the dashboard id if it is publiced, then use a internal user to fire the search internally.
But our dashboard design as fire the query from frontend. if we want to do it like Grafna, need a big refactor. a lot of work need to do.