v0.1.35: whitelist имён атрибутов и для JSON-протокола (UnmarshalJSON)
This commit is contained in:
@@ -25,9 +25,9 @@ import (
|
||||
// 4. RedrivePolicy: ARN DLQ разбирается, DLQ должна существовать, иначе
|
||||
// InvalidAttributeValue.
|
||||
func setQueueAttributesV1(q *models.Queue, attr models.QueueAttributes, provided map[string]string) error {
|
||||
// Шаг 1: whitelist имён атрибутов.
|
||||
// Шаг 1: whitelist имён атрибутов (единый список — models.AttrNameWhitelist).
|
||||
for name := range provided {
|
||||
if !attrNameWhitelist[name] {
|
||||
if !models.AttrNameWhitelist[name] {
|
||||
return fmt.Errorf("InvalidAttributeName")
|
||||
}
|
||||
}
|
||||
@@ -81,14 +81,3 @@ func setQueueAttributesV1(q *models.Queue, attr models.QueueAttributes, provided
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// attrNameWhitelist — имена атрибутов, которые SetQueueAttributes может изменять.
|
||||
// Всё, чего нет в списке, отклоняется с ошибкой InvalidAttributeName.
|
||||
var attrNameWhitelist = map[string]bool{
|
||||
"DelaySeconds": true,
|
||||
"MaximumMessageSize": true,
|
||||
"MessageRetentionPeriod": true,
|
||||
"ReceiveMessageWaitTimeSeconds": true,
|
||||
"VisibilityTimeout": true,
|
||||
"RedrivePolicy": true,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user