-
Notifications
You must be signed in to change notification settings - Fork 68
Allow users to send requests from CMK using POST requests. #161
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code looks okay, a couple of comments added
@@ -282,6 +284,9 @@ func saveConfig(cfg *Config) *Config { | |||
core.AutoComplete = true | |||
core.Output = JSON | |||
} | |||
if !conf.Section(ini.DEFAULT_SECTION).HasKey("postrequest") { | |||
core.PostRequest = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default PostRequest is true, so should set to false here when "postrequest" key not present?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point @sureshanaparti. @kevin-lii can you please check this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kevin-lii build is failing. Can you please check?
@@ -204,6 +204,8 @@ func NewAPIRequest(r *Request, api string, args []string, isAsync bool) (map[str | |||
} | |||
} | |||
params.Add("response", "json") | |||
params.Add("signatureversion", "3") | |||
params.Add(expiresKey, time.Now().UTC().Add(15 * time.Minute).Format(time.RFC3339)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
build failing here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fixed.
Description
Currently, CMK only allows for POST requests and this is a security concern since GET requests may leak the values of the query parameters.
Types of changes
[] Breaking change (fix or feature that would cause existing functionality to change)
[] New feature (non-breaking change which adds functionality)
[] Bug fix (non-breaking change which fixes an issue)
[] Enhancement (improves an existing feature and functionality)
[] Cleanup (Code refactoring and cleanup, that may add test cases)
[] build/CI
[] test (unit or integration test code)
[X] Feature/Enhancement Scale
[] Major
[X] Minor
How Has This Been Tested?
This was tested by manually building CMK and using a proxy to confirm that POST requests are being sent by CMK when the configuration value is set.