-
Notifications
You must be signed in to change notification settings - Fork 30
Description
This is a follow-on from https://kagifeedback.org/d/2550-add-kagi-search-shouldnt-save-with-session-token-in-url/7 since I didn't see anywhere it has been discussed on GitHub. As reported in that feedback thread, when you do a search while using the Kagi for Firefox addon, the session token is temporarily shown in the URL bar as a query parameter. I took a screen recording demonstrating the behavior, but for obvious reasons that is problematic to post here.
I had a quick look through the code to see if this seemed more like an addon coding issue or more like a Firefox API design issue. What I found surprised me:
browser_extensions/shared/src/background.js
Lines 123 to 146 in 5190249
| await browser.declarativeNetRequest.updateDynamicRules({ | |
| addRules: [ | |
| { | |
| id: 1, | |
| priority: 1, | |
| action: { | |
| type: 'modifyHeaders', | |
| requestHeaders: [ | |
| { | |
| header: 'X-Kagi-Authorization', | |
| value: sessionToken, | |
| operation: 'set', | |
| }, | |
| ], | |
| }, | |
| condition: { | |
| urlFilter: '||kagi.com/', | |
| resourceTypes: ['main_frame', 'xmlhttprequest'], | |
| }, | |
| }, | |
| ], | |
| removeRuleIds: [1], | |
| }); | |
| } |
This code seems to suggest that we are transparently authenticating all Kagi requests using a header. Great: but then what is the point of setting the session token in the query parameter? It seems like we could just remove that and eliminate the security risk, while still having search work in private browsing windows automatically.