Skip to content

Conversation

@sohomdatta1
Copy link
Contributor

Hi hi,

So, background, I was implementing this protocol on https://github.com/sohomdatta1/link-dispenser (which is a webservice hosted on Wikimedia's community-run Toolforge servers that checks if the external references of/on a page are still web accessible). After implementing the protocol, I was testing the server to make sure I had implemented the directory correctly, and while testing that, I found two small QoL fixes that would be nice to have in this tool! I know the contributing guidelines ask me to create issues, but I decided to open a PR directly since the fixes are relatively minor :)

Basically, this commit introduces two fixes/QoL changes. First off, it adds a useragent to every request sent by this tool. This is required iff the remote server rejects requests without any specific useragent being set (an example for this is Wikimedia Toolforge, which will drop all HTTP requests without a User-Agent header

See: https://wikitech.wikimedia.org/wiki/Help:Toolforge/Banned#Banned_user_agents_and_IP_addresses

Additionally, the second change introduced prints the body of the response into stderr iff the tool encounters an error in parsing the JSON data into JWKS sets. This is particularly useful because it (allowed me to debug the error above) will help folks figure out exactly what data got sent back from the server and why the tool might not be able to validate the keys.

Hope y'all have a nice day!

Copy link
Collaborator

@thibmeu thibmeu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall seems ok.
Minimising the use of defaults would be great.

@AkshataDM should be able to provide a deeper review

@AkshatM AkshatM self-requested a review October 9, 2025 16:20
Copy link
Contributor

@AkshatM AkshatM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, this looks great - just make the UA configurable, fix the fmt error, and we can merge.

This commit introduces two fixes/QoL changes. First off, it adds a
useragent to every request sent by this tool. This is required iff
the remote server rejects requests without any specific useragent
being set (an example for this is Wikimedia Toolforge, which will
drop all HTTP requests without a User-Agent header

See: https://wikitech.wikimedia.org/wiki/Help:Toolforge/Banned#Banned_user_agents_and_IP_addresses

Additionally the second change introduced prints the body of the
response into stderr iff the tool encounters a error in parsing the
JSON data into JWKS sets. This is particularly useful because it
(~~allowed me to debug the error above~~) will help folks figure out
exactly what data got sent back from the server and why the tool might
not be able to validate the keys.
@AkshatM
Copy link
Contributor

AkshatM commented Oct 9, 2025

Amazing - thanks for your contribution @sohomdatta1! If this doesn't auto-deploy, I will cut a release early next week.

@AkshatM AkshatM merged commit 55a90d4 into cloudflare:main Oct 9, 2025
3 checks passed
AkshatM added a commit that referenced this pull request Oct 13, 2025
Major change since last release:

Add a useragent header when fetching data + print response if not JSON (#59)
AkshatM added a commit that referenced this pull request Oct 13, 2025
Major change since last release:

Add a useragent header when fetching data + print response if not JSON (#59)
AkshatM added a commit that referenced this pull request Oct 13, 2025
Major change since last release:

Add a useragent header when fetching data + print response if not JSON (#59)
AkshatM added a commit that referenced this pull request Oct 13, 2025
Major change since last release:

Add a useragent header when fetching data + print response if not JSON (#59)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants