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

Remove inline JS for Kagi URLs in webauthn setup #65

Open
MarkusH opened this issue Jun 1, 2023 · 0 comments
Open

Remove inline JS for Kagi URLs in webauthn setup #65

MarkusH opened this issue Jun 1, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@MarkusH
Copy link
Collaborator

MarkusH commented Jun 1, 2023

The current kagi/templates/kagi/base.html contains the following content:

<script>
    window.Kagi = window.Kagi || {};
    Kagi.begin_activate = '{% url 'kagi:begin-activate' %}';
    Kagi.begin_assertion = '{% url 'kagi:begin-assertion' %}';
    Kagi.verify_credential_info = '{% url 'kagi:verify-credential-info' %}';
    Kagi.verify_assertion = '{% url 'kagi:verify-assertion' %}';
    Kagi.keys_list = '{% url 'kagi:webauthn-keys' %}';
</script>

This is not ideal, when considering adding CSPs to a site. Instead, we should probably use json_script instead:

{{ kagi_urls | json_script:"kagi-urls" }}

This would then result in:

<script id="kagi-urls" type="application/json">
{
    "begin_activate": "/kagi/api/begin-activate/",
    "begin_assertion": "/kagi/api/begin-assertion/",
    "verify_credential_info": "/kagi/api/verify-credential-info/",
    "verify_assertion": "/kagi/api/verify-assertion/"
}
</script>

That said, key_list doesn't appear to be used.

@MarkusH MarkusH added the enhancement New feature or request label Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant