Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting TYK_GW_HASHKEYFUNCTION changes key format #5558

Open
jakub-bochenski opened this issue Sep 14, 2023 · 2 comments
Open

Setting TYK_GW_HASHKEYFUNCTION changes key format #5558

jakub-bochenski opened this issue Sep 14, 2023 · 2 comments

Comments

@jakub-bochenski
Copy link

Branch/Environment/Version

  • Branch/Version: v5.1
  • Environment: On-prem

Describe the bug
This is an unexpected and undocumented behaviour

If I only set TYK_GW_HASHKEYS=true the keys generated by tyk are of the form: 123@example.com1a4704c4c6f8456b9a859041e05a09d6

If I set TYK_GW_HASHKEYFUNCTION to any value (murmur64, murmur128, sha256) the returned key is now a base64 encoded json, e.g. eyJvcmciOiIxMjNAZXhhbXBsZS5jb20iLCJpZCI6Ijk5NzhkZDk0MGNkMzQ5YmNhZWY3YmQyMDQxNGY3YmMyIiwiaCI6InNoYTI1NiJ9

Which when decoded is

{"org":"123@example.com","id":"9978dd940cd349bcaef7bd20414f7bc2","h":"sha256"}

Reproduction steps
Set TYK_GW_HASHKEYFUNCTION to any value

Actual behavior
Key format changes

Expected behavior
Key format doesn't change

Additional context
This significantly increases the key size, which is a concern given that each API request includes in in the header.

@jakub-bochenski
Copy link
Author

Was able to find the description here #1753

@jakub-bochenski
Copy link
Author

jakub-bochenski commented Oct 9, 2023

This also makes the loggin statement useless as the key suffix is always one of the three key="****fQ== or key="****In0=" or key="****NiJ9"

e.g.

time="Oct 04 12:41:09" level=info msg="Key rate limit exceeded." api_id=foo api_name="foo" key="****In0=" mw=RateLimitAndQuotaCheck org_id=default origin=162.158.102.30 path=/foo

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

No branches or pull requests

2 participants