-
Notifications
You must be signed in to change notification settings - Fork 4
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
Conversation
api/secrets/secrets.go
Outdated
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)) |
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.
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))
41c649a
to
629350f
Compare
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 |
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.
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) |
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.
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 { |
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.
maxFileSecretSizeBytes
@@ -37,6 +37,10 @@ func ValidateInputs(clientId string, clientSecret string, apiUrl string, clientT | |||
*retryMaxElapsedTimeMinutes = 2 | |||
} | |||
|
|||
if *maxFileSecretSize == 0 { | |||
*maxFileSecretSize = 4000 |
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.
maxFileSecretSizeBytes
@@ -46,7 +50,7 @@ func ValidateInputs(clientId string, clientSecret string, apiUrl string, clientT | |||
ClientTimeOutinSeconds: clientTimeOutinSeconds, | |||
Separator: *separator, | |||
VerifyCa: verifyCa, | |||
MaxFileSecretSize: maxFileSecretSize, | |||
MaxFileSecretSize: *maxFileSecretSize, |
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.
maxFileSecretSizeBytes
No description provided.