Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Changing createCacheKey to replace _any_ characters that violate file naming standards #135

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

shazaman23
Copy link

By default this tool uses a cache pool that creates local files for caching. The existing implementation covers PSR-6 requirements, but there are some issues that can occur when using the defaults if some bad characters are in the URI used to form the cache key (which is used as the filename).

For example, assume an Okta instance of testing.oktapreview.com with a user of test**[email protected]. By making a get for that user with this library, the URI will be testing.oktapreview.com/api/v1/users/test**[email protected]. Based off of the existing code, this name will get transformed to a cache key of testing_oktapreview_com_api_v1_users_test**7_test_com which is an invalid file name.

The change I propose would use the regex for valid filenames by default to create cache keys. Under this setup, the cache key would instead be testing_oktapreview_com_api_v1_users_test__7_test_com which would be valid.

Note: There are still going to be some problems if people include lots of the invalid characters in their usernames because you could have collisions. For example, user of test**[email protected] and [email protected] would both hit the same cache key testing_oktapreview_com_api_v1_users_test__7_test_com

…e file naming standards instead of just the handful of characters that were being replaced by default.
@bretterer
Copy link
Contributor

Thank you for the PR! This looks great. Just to cover our bases, could you please send in a CLA? you can find it over at developer.okta.com/cla. This MAY fall into "Obvious Fix" category, but I would like to have one anyway.

@shazaman23
Copy link
Author

I sent an email with an attached PDF of the CLA to this email address earlier today:
[email protected]

Did it not come through?

@shazaman23
Copy link
Author

Just got confirmation on my signed CLA. @robertdamphousse-okta

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants