Skip to content

Session token is shown briefly in URL bar when performing search in Firefox #95

@raxod502

Description

@raxod502

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:

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions