mirror of
https://github.com/passbolt/go-passbolt.git
synced 2025-09-13 14:29:09 +00:00
Compare commits
5 commits
8b00fcd497
...
1ffa5a23bd
Author | SHA1 | Date | |
---|---|---|---|
1ffa5a23bd | |||
1111e12f1e | |||
09ecd1f23a | |||
9c9e2334dc | |||
2cb39e9481 |
3 changed files with 50 additions and 47 deletions
|
@ -15,22 +15,19 @@ var ResourceSchemas = map[string]json.RawMessage{
|
||||||
"maxLength": 255
|
"maxLength": 255
|
||||||
},
|
},
|
||||||
"username": {
|
"username": {
|
||||||
"type": "string",
|
"type": ["string", "null"],
|
||||||
"maxLength": 255,
|
"maxLength": 255
|
||||||
"nullable": true
|
|
||||||
},
|
},
|
||||||
"uris": {
|
"uris": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"maxLength": 1024,
|
"maxLength": 1024
|
||||||
"nullable": true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"description": {
|
"description": {
|
||||||
"type": "string",
|
"type": ["string", "null"],
|
||||||
"maxLength": 10000,
|
"maxLength": 10000
|
||||||
"nullable": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -43,14 +40,12 @@ var ResourceSchemas = map[string]json.RawMessage{
|
||||||
"enum": ["PASSBOLT_SECRET_DATA"]
|
"enum": ["PASSBOLT_SECRET_DATA"]
|
||||||
},
|
},
|
||||||
"password": {
|
"password": {
|
||||||
"type": "string",
|
"type": ["string", "null"],
|
||||||
"maxLength": 4096,
|
"maxLength": 4096
|
||||||
"nullable": true
|
|
||||||
},
|
},
|
||||||
"description": {
|
"description": {
|
||||||
"type": "string",
|
"type": ["string", "null"],
|
||||||
"maxLength": 10000,
|
"maxLength": 10000
|
||||||
"nullable": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,22 +61,19 @@ var ResourceSchemas = map[string]json.RawMessage{
|
||||||
"maxLength": 255
|
"maxLength": 255
|
||||||
},
|
},
|
||||||
"username": {
|
"username": {
|
||||||
"type": "string",
|
"type": ["string", "null"],
|
||||||
"maxLength": 255,
|
"maxLength": 255
|
||||||
"nullable": true
|
|
||||||
},
|
},
|
||||||
"uris": {
|
"uris": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"maxLength": 1024,
|
"maxLength": 1024
|
||||||
"nullable": true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"description": {
|
"description": {
|
||||||
"type": "string",
|
"type": ["string", "null"],
|
||||||
"maxLength": 10000,
|
"maxLength": 10000
|
||||||
"nullable": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -101,22 +93,19 @@ var ResourceSchemas = map[string]json.RawMessage{
|
||||||
"maxLength": 255
|
"maxLength": 255
|
||||||
},
|
},
|
||||||
"username": {
|
"username": {
|
||||||
"type": "string",
|
"type": ["string", "null"],
|
||||||
"maxLength": 255,
|
"maxLength": 255
|
||||||
"nullable": true
|
|
||||||
},
|
},
|
||||||
"uris": {
|
"uris": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"maxLength": 1024,
|
"maxLength": 1024
|
||||||
"nullable": true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"description": {
|
"description": {
|
||||||
"type": "string",
|
"type": ["string", "null"],
|
||||||
"maxLength": 10000,
|
"maxLength": 10000
|
||||||
"nullable": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -129,14 +118,12 @@ var ResourceSchemas = map[string]json.RawMessage{
|
||||||
"enum": ["PASSBOLT_SECRET_DATA"]
|
"enum": ["PASSBOLT_SECRET_DATA"]
|
||||||
},
|
},
|
||||||
"password": {
|
"password": {
|
||||||
"type": "string",
|
"type": ["string", "null"],
|
||||||
"maxLength": 4096,
|
"maxLength": 4096
|
||||||
"nullable": true
|
|
||||||
},
|
},
|
||||||
"description": {
|
"description": {
|
||||||
"type": "string",
|
"type": ["string", "null"],
|
||||||
"maxLength": 10000,
|
"maxLength": 10000
|
||||||
"nullable": true
|
|
||||||
},
|
},
|
||||||
"totp": {
|
"totp": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
@ -174,23 +161,16 @@ var ResourceSchemas = map[string]json.RawMessage{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"maxLength": 255
|
"maxLength": 255
|
||||||
},
|
},
|
||||||
"username": {
|
|
||||||
"type": "string",
|
|
||||||
"maxLength": 255,
|
|
||||||
"nullable": true
|
|
||||||
},
|
|
||||||
"uris": {
|
"uris": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"maxLength": 1024,
|
"maxLength": 1024
|
||||||
"nullable": true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"description": {
|
"description": {
|
||||||
"type": "string",
|
"type": ["string", "null"],
|
||||||
"maxLength": 10000,
|
"maxLength": 10000
|
||||||
"nullable": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -173,7 +173,21 @@ func GetResourceFromData(c *api.Client, resource api.Resource, secret api.Secret
|
||||||
|
|
||||||
pw = rawSecretData
|
pw = rawSecretData
|
||||||
case "v5-totp-standalone":
|
case "v5-totp-standalone":
|
||||||
// nothing fits into the interface in this case
|
rawMetadata, err := GetResourceMetadata(ctx, c, &resource, &rType)
|
||||||
|
if err != nil {
|
||||||
|
return "", "", "", "", "", "", fmt.Errorf("Getting Metadata: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
var metadata api.ResourceMetadataTypeV5TOTPStandalone
|
||||||
|
err = json.Unmarshal([]byte(rawMetadata), &metadata)
|
||||||
|
if err != nil {
|
||||||
|
return "", "", "", "", "", "", fmt.Errorf("Parsing Decrypted Metadata: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
name = metadata.Name
|
||||||
|
if len(metadata.URIs) != 0 {
|
||||||
|
uri = metadata.URIs[0]
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return "", "", "", "", "", "", fmt.Errorf("Unknown ResourceType: %v", rType.Slug)
|
return "", "", "", "", "", "", fmt.Errorf("Unknown ResourceType: %v", rType.Slug)
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,15 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func validateSecretData(rType *api.ResourceType, secretData string) error {
|
func validateSecretData(rType *api.ResourceType, secretData string) error {
|
||||||
|
// TODO Remove when v4 Resources are unsupported
|
||||||
|
// with the Resource Type password-string the Secret is not json and can't be properly validated, so skip the check here
|
||||||
|
if rType.Slug == "password-string" {
|
||||||
|
if len(secretData) > 4096 {
|
||||||
|
return fmt.Errorf("password is longer than 4096")
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
var schemaDefinition api.ResourceTypeSchema
|
var schemaDefinition api.ResourceTypeSchema
|
||||||
definition := rType.Definition
|
definition := rType.Definition
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue