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.

CommentFileSizeAuthor
#2 3223334-cache_max_age.patch649 byteshngrytrl

Comments

hngrytrl created an issue. See original summary.

hngrytrl’s picture

StatusFileSize
new649 bytes

Attaching a patch that uses loose comparison in AwsSecretsManagerKeyProvider::setCache between $max_age and Cache::PERMANENT.

hngrytrl’s picture

Status: Active » Needs review

  • nterbogt committed 067f037 on 2.x authored by hngrytrl
    Issue #3223334 by hngrytrl: Permanent cache max age not being respected
    
nterbogt’s picture

Status: Needs review » Fixed

This has been merged and I'm creating a new release now.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.