Skip to content
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

fix: fix max lenght file secret issue #44

Closed
wants to merge 2 commits into from

Conversation

btfhernandez
Copy link
Contributor

No description provided.

@btfhernandez btfhernandez requested review from a team as code owners February 28, 2024 17:54
secretInBytes := []byte(fileSecretContent)

if len(secretInBytes) > secretObj.maxFileSecretSize {
secretObj.log.Debug(fmt.Sprintf("%v%v%v: %v %v %v", secretPath, separator, secretTitle, "Secret Size:", len(secretInBytes), "is greater than allowed one", secretObj.maxFileSecretSize))
Copy link
Contributor

Choose a reason for hiding this comment

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

looks good, lets change it to an error

secretObj.log.Error(fmt.Sprintf("%v%v%v: %v %v %v", secretPath, separator, secretTitle, "Secret file Size:", len(secretInBytes), "is greater than the maximum allowed size:", secretObj.maxFileSecretSize))

@btfhernandez btfhernandez force-pushed the secret-max-lenght-issue branch from 41c649a to 629350f Compare February 28, 2024 19:20
Copy link

👍 Frogbot scanned this pull request and found that it did not add vulnerable dependencies.

Note:

Frogbot also supports Contextual Analysis, Secret Detection, IaC and SAST Vulnerabilities Scanning. This features are included as part of the JFrog Advanced Security package, which isn't enabled on your system.


@@ -59,9 +59,10 @@ The library supports retrieval of secrets from BeyondInsight/Password Safe versi
- default: 2 minutes
- required: False
- maxFileSecretSize
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add bytes to the end? maxFileSecretSizeBytes

@@ -34,7 +34,7 @@ func main() {
maxFileSecretSize := 4000

// validate inputs
errorsInInputs := utils.ValidateInputs(clientId, clientSecret, apiUrl, clientTimeOutInSeconds, &separator, verifyCa, zapLogger, certificate, certificateKey, &retryMaxElapsedTimeMinutes, maxFileSecretSize)
errorsInInputs := utils.ValidateInputs(clientId, clientSecret, apiUrl, clientTimeOutInSeconds, &separator, verifyCa, zapLogger, certificate, certificateKey, &retryMaxElapsedTimeMinutes, &maxFileSecretSize)
Copy link
Contributor

Choose a reason for hiding this comment

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

maxFileSecretSizeBytes

@@ -25,7 +25,7 @@ type UserInputValidaton struct {
var validate *validator.Validate

// ValidateInputs is responsible for validating end-user inputs.
func ValidateInputs(clientId string, clientSecret string, apiUrl string, clientTimeOutinSeconds int, separator *string, verifyCa bool, logger logging.Logger, certificate string, certificate_key string, retryMaxElapsedTimeMinutes *int, maxFileSecretSize int) error {
func ValidateInputs(clientId string, clientSecret string, apiUrl string, clientTimeOutinSeconds int, separator *string, verifyCa bool, logger logging.Logger, certificate string, certificate_key string, retryMaxElapsedTimeMinutes *int, maxFileSecretSize *int) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

maxFileSecretSizeBytes

@@ -37,6 +37,10 @@ func ValidateInputs(clientId string, clientSecret string, apiUrl string, clientT
*retryMaxElapsedTimeMinutes = 2
}

if *maxFileSecretSize == 0 {
*maxFileSecretSize = 4000
Copy link
Contributor

Choose a reason for hiding this comment

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

maxFileSecretSizeBytes

@@ -46,7 +50,7 @@ func ValidateInputs(clientId string, clientSecret string, apiUrl string, clientT
ClientTimeOutinSeconds: clientTimeOutinSeconds,
Separator: *separator,
VerifyCa: verifyCa,
MaxFileSecretSize: maxFileSecretSize,
MaxFileSecretSize: *maxFileSecretSize,
Copy link
Contributor

Choose a reason for hiding this comment

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

maxFileSecretSizeBytes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants