Skip to content

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

kevin-lii
Copy link

@kevin-lii kevin-lii commented Mar 25, 2025

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.

Copy link
Contributor

@shwstppr shwstppr left a 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
Copy link
Contributor

@sureshanaparti sureshanaparti Mar 26, 2025

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?

Copy link
Contributor

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?

@rohityadavcloud rohityadavcloud added this to the 6.5.0 milestone Mar 27, 2025
Copy link
Contributor

@shwstppr shwstppr left a 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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

build failing here

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fixed.

@kevin-lii kevin-lii requested a review from shwstppr April 8, 2025 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants