xmidt-org / clortho

Key manager that supports JWKs and remotely hosted keys
Apache License 2.0
1 stars 0 forks source link

Add a log message when a URI template finds no expected variable #54

Open njharter opened 1 year ago

njharter commented 1 year ago

Problem

When configuring servers, too many times the value {keyId} is used instead of {keyID} (and/or the other way around). This causes either the services to fail or run with a bad URL endpoint.

A Bit of History

Initially keyId use to be present in commit 289f54f, but along with keyID in the same file. Later keyID in commit 5260d89 is consistently used in both examples.

Comparison Example 1

https://github.com/xmidt-org/clortho/blob/289f54fb6d48e0e6b43379238312942708c9f322/resolver.go#L28-L31 https://github.com/xmidt-org/clortho/blob/5260d89764052b6674cd4f6d63c8a1b74fbda23b/resolver.go#L30-L33

Comparison Example 2

https://github.com/xmidt-org/clortho/blob/289f54fb6d48e0e6b43379238312942708c9f322/resolver.go#L88-L91 https://github.com/xmidt-org/clortho/blob/5260d89764052b6674cd4f6d63c8a1b74fbda23b/resolver.go#L199-L202

Suggested Solution

Make this keyID value case insensitive.

johnabass commented 1 year ago

URI templates are governed by https://www.rfc-editor.org/rfc/rfc6570. Specifically, from section 2.3:

Variable names are case-sensitive because the name might be expanded within a case-sensitive URI component.

clortho consistently uses keyID to conform to golang naming conventions.

We could put a log message or something when no key id parameter is found.