Skip to content

Commit

Permalink
Merge pull request #2471 from GarageDeveloper/master
Browse files Browse the repository at this point in the history
fixes #2249: sanitize tenant and tenantid
  • Loading branch information
stevvooe authored Feb 3, 2018
2 parents 85b4d46 + 8777e97 commit fea8bd5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions registry/storage/driver/swift/swift.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,19 @@ func FromParameters(parameters map[string]interface{}) (*Driver, error) {
InsecureSkipVerify: false,
}

// Sanitize some entries before trying to decode parameters with mapstructure
// TenantID and Tenant when integers only and passed as ENV variables
// are considered as integer and not string. The parser fails in this
// case.
_, ok := parameters["tenant"]
if ok {
parameters["tenant"] = fmt.Sprint(parameters["tenant"])
}
_, ok = parameters["tenantid"]
if ok {
parameters["tenantid"] = fmt.Sprint(parameters["tenantid"])
}

if err := mapstructure.Decode(parameters, &params); err != nil {
return nil, err
}
Expand Down

0 comments on commit fea8bd5

Please sign in to comment.