mirror of
https://github.com/passbolt/go-passbolt.git
synced 2025-09-13 14:29:09 +00:00
Add Secret Json Schema Validation
This commit is contained in:
parent
adaffbce7e
commit
605db2b047
4 changed files with 68 additions and 7 deletions
|
@ -42,6 +42,11 @@ func CreateResource(ctx context.Context, c *api.Client, folderParentID, name, us
|
|||
return "", fmt.Errorf("Marshalling Secret Data: %w", err)
|
||||
}
|
||||
|
||||
err = validateSecretData(rType, string(secretData))
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("Validating Secret Data: %w", err)
|
||||
}
|
||||
|
||||
encSecretData, err := c.EncryptMessage(string(secretData))
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("Encrypting Secret Data for User me: %w", err)
|
||||
|
@ -223,6 +228,11 @@ func UpdateResource(ctx context.Context, c *api.Client, resourceID, name, userna
|
|||
return fmt.Errorf("Unknown ResourceType: %v", rType.Slug)
|
||||
}
|
||||
|
||||
err = validateSecretData(rType, secretData)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Validating Secret Data: %w", err)
|
||||
}
|
||||
|
||||
newResource.Secrets = []api.Secret{}
|
||||
for _, user := range users {
|
||||
var encSecretData string
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue