Problem/Motivation
When creating a key with AWS Secret Manager Key Provider with cache maximum age set to Permanent, the key is not saved to cache table with an expire value of -1.
Steps to reproduce
1. Go to `/admin/config/system/keys`
2. Add a key, set key provider to `AWS Secrets Manager`
3. Select `Permanent` in cache maximum age select list, save key
4. Access key in code, or go to key edit form to generate cache entry for key created in above steps
5. Check the `cache_default` table for an entry for the key `cid like 'key:aws_secrets_manager%`
Expected result:
The expire value should be -1.
Actual result:
The expire value in the `cache_default` table for the key is a positive integer indicating a time.
Proposed resolution
In `AwsSecretsManagerKeyProvider::setCache` a strict comparison is made between `$max_age` and `Cache::PERMANENT`. A loose comparison should be made instead, as the form value for the cache maximum age select element is saved as a string when the form is submitted.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 3223334-cache_max_age.patch | 649 bytes | hngrytrl |
Comments
Comment #2
hngrytrl commentedAttaching a patch that uses loose comparison in
AwsSecretsManagerKeyProvider::setCachebetween$max_ageandCache::PERMANENT.Comment #3
hngrytrl commentedComment #5
nterbogt commentedThis has been merged and I'm creating a new release now.