Allocate AWSCredentials secret key and signing key through a dedicated memory system - #39
Open
mstetsyuk wants to merge 1 commit into
Open
Allocate AWSCredentials secret key and signing key through a dedicated memory system#39mstetsyuk wants to merge 1 commit into
mstetsyuk wants to merge 1 commit into
Conversation
…d memory system Adds MemoryManagementOptions::sensitiveMemoryManager, Aws::SensitiveAllocator and Aws::SensitiveString, honoured regardless of USE_AWS_MEMORY_MANAGEMENT. The secret access key inside Aws::Auth::AWSCredentials and the SigV4 signing key are stored in Aws::SensitiveString, so an application can keep them out of core dumps. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #, if available: ClickHouse-side change: ClickHouse/ClickHouse#82441 (revival; the new pull request will link back here)
Description of changes:
Lets the application keep the AWS secret access key out of core dumps by allocating it through a dedicated memory system.
MemoryManagementOptions::sensitiveMemoryManager: a secondMemorySystemInterfacethatInitAPIinstalls (andShutdownAPIremoves) regardless ofUSE_AWS_MEMORY_MANAGEMENT. Defaults tonullptr, in which case nothing changes.Aws::SensitiveAllocator<T>andAws::SensitiveString: a minimal allocator (not derived fromstd::allocator, soallocate_at_leastcannot bypass it) and the string type built on it. They fall back tomalloc/freewhen no sensitive memory manager is installed.AWSCredentials::m_secretKeyis anAws::SensitiveString;GetAWSSecretKeyreturns it. A constructor takingconst Aws::SensitiveString&lets callers hand over a secret without a plainAws::Stringcopy.AWSAuthV4SignerandAWSAuthEventStreamV4Signerkeep the derived signing key andm_currentSecretKeyinAws::SensitiveString.HashingUtils::CalculateSHA256HMAC(const Aws::String&, const Aws::SensitiveString&): computes the first HMAC step ("AWS4" + secret) without materialising the concatenation in a plain string.GetAWSSecretKeyreturn type.ClickHouse installs a
MADV_DONTDUMPjemalloc-arena allocator intosensitiveMemoryManager, so everyAWSCredentialsheld by a credentials provider, and every signing key, lives in pages excluded from core dumps.Check all that applies:
/proc/self/smapsVmFlags: ddcheck onGetAWSSecretKey().data()after installing the manager; the SDK itself only changes types.)GetAWSSecretKeyreturnsconst Aws::SensitiveString&instead ofconst Aws::String&; callers that need anAws::Stringconstruct one from.data()/.size().Check which platforms you have built SDK on to verify the correctness of this PR.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
🤖 Generated with Claude Code