-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't use predefined string as Stmt in Client.Mgmt #33
Comments
So Kusto by default uses the Stmt type to enforce that string constants are used. This prevents and entire range of SQL-like injection attacks. Most SQL like APIs are unsafe by default requiring you to turn on safety. Because of a language trick in Go, we have the option to make There are two ways to input variable substitution. One is through the use of query parameters and the other is the unsafe package. Mgmt calls uses an old version API, so I don't think it supports query parameters for substitution. If you need to do string substitution as above, you will probably need to use the unsafe package. stmt := NewStmt("", kusto.UnsafeStmt(unsafe.Stmt{Add: true}).UnsafeAdd(yourStr) This will let you add whatever you want, but as it says in the package name, this is "unsafe". Which really means, you need to scrub your inputs if you are allowing outside data to affect you Mgmt call. |
@element-of-surprise Will there ever be a way to use query parameter for Mgmt calls? If yes, is there already an ETA? |
@jrauschenbusch I'm not sure of the exact procedure for getting new features, but Kusto does have a forum for requesting things and getting them upvoted: You might also be able to do this by opening a support ticket or working through account reps, etc.... The SDK can support them if the backends add support. |
I have some management statements that I want to execute through the client.
These statements are built with
fmt.Sprintf
.So I saw the query is supposed to be of type
Stmt
, but I didn't find how to convert this string toStmt
.When using
NewStmt
, I can only use a raw string as input, but not a predefined one:Am I missing something? How can I fix this issue?
I'm using azure-kust-go version 0.1.3 and go version go1.13.12 darwin/amd64
The text was updated successfully, but these errors were encountered: