fix: Use rsa2048 as the default AWS signature type#347
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the Vault AWS EC2 auth integration to default the signature type to rsa2048 (SHA-256) when signatureType is unset, and emits a deprecation warning when pkcs7 is explicitly configured, aligning behavior with issue #346 and avoiding SHA-1 defaults.
Changes:
- Default AWS EC2
signatureTypetorsa2048viaSSHCAVaultAWSConfig.GetSignatureType(). - Emit a
WARNlog whensignatureType=pkcs7is configured for EC2 auth. - Add/adjust unit tests to cover the new defaulting behavior and deprecation warning.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| internal/sshhandler/vault.go | Plumbs logger into Vault auth creation, defaults EC2 signature behavior to rsa2048, and logs pkcs7 deprecation. |
| internal/sshhandler/vault_test.go | Updates auth method tests for new logger parameter and adds a test asserting the pkcs7 deprecation warning is emitted. |
| internal/config/config.go | Introduces defaultAWSSignatureType and adds GetSignatureType() to default to rsa2048 when unset. |
| internal/config/config_test.go | Adds unit tests validating GetSignatureType() defaulting/preservation behavior. |
Comments suppressed due to low confidence (1)
internal/sshhandler/vault.go:76
newAWSAuthMethodnow depends on a non-nillogger(it callslogger.Warnfor the pkcs7 deprecation path). If a nil logger is passed, this will panic during Vault auth initialization whensignatureType=pkcs7. Consider defensively defaulting tozap.NewNop()whenloggeris nil.
func newAWSAuthMethod(awsConfig *gatewayconfig.SSHCAVaultAWSConfig, logger *zap.Logger) (*aws.AWSAuth, error) {
opts := []aws.LoginOption{
aws.WithRole(awsConfig.Role),
aws.WithMountPath(awsConfig.GetMount()),
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #347 +/- ##
==========================================
+ Coverage 86.06% 86.29% +0.23%
==========================================
Files 40 40
Lines 2828 2832 +4
==========================================
+ Hits 2434 2444 +10
+ Misses 269 263 -6
Partials 125 125
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Related Tickets & Documents
Changes
rsa2048(SHA-256) when signatureType is unset.pkcs7is explicitly configured.