8000 WebAuthn Passwordless Policy Timeout Field Causes Syntax Error When Value Exceeds 1000 Seconds Due to Locale-Specific Number Formatting in FTL Generated JavaScript · Issue #40474 · keycloak/keycloak · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
WebAuthn Passwordless Policy Timeout Field Causes Syntax Error When Value Exceeds 1000 Seconds Due to Locale-Specific Number Formatting in FTL Generated JavaScript #40474
Closed
@toshiki-hirokawa

Description

@toshiki-hirokawa

Before reporting an issue

  • I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.

Area

adapter/javascript

Describe the bug

When configuring the "Timeout" field within the Keycloak Admin Console's Configure -> Authentication -> Policies -> Webauthn Passwordless Policy section, entering a value greater than 1000 seconds results in a JavaScript Syntax Error.
This appears to be caused by FreeMarker Template Language (FTL) applying locale-specific number formatting, which inserts a comma (,) as a thousand separator into the generated JavaScript code.
This prevents the value from being parsed as a valid Number type by the JavaScript engine.

Version

26.2.5 (tested with the latest official Docker image as per reproduction steps), 23.0.7 (our currently utilized version, exhibiting the same issue)

Regression

  • The issue is a regression

Expected behavior

The "Timeout" field should correctly handle and display values greater than 1000 seconds without introducing formatting characters like commas.
The input value should be rendered as a pure numerical value in the generated JavaScript, ensuring it is properly interpreted as a Number type and does not cause a Syntax Error.
The user should be able to proceed with WebAuthn authentication as expected.

Actual behavior

When a value exceeding 1000 seconds is entered (e.g., 3600), the generated JavaScript code contains a comma (e.g., 3,600 instead of 3600).
This invalidates the number literal in JavaScript, leading to a Syntax Error during script execution, preventing the WebAuthn flow from proceeding correctly.

How to Reproduce?

  1. Start a Keycloak container without any modifications (e.g., using the command from the official getting started guide):
  2. Access the Keycloak Admin Console (e.g., http://localhost:8080).
  3. Log in with the admin credentials (e.g., admin/admin).
  4. Navigate to Manage realms (top left dropdown) and create a new test realm, e.g., test-realm.
  5. Switch to the test-realm.
  6. Under Manage -> Users, create a new test user, e.g., test.
  7. Set a password for the test user in the Credentials tab.
  8. For the test user, in the Required user actions input field, set Webauthn Register Passwordless.
  9. Navigate to Configure -> Authentication -> Policies -> Webauthn Passwordless Policy.
  10. Locate the "Timeout" field and set its value to something greater than 1000 seconds (e.g., 3600 for 1 hour). Click "Save".
  11. Attempt to log in to the test-realm using the test user through a Keycloak client application or directly via the account console (e.g., http://localhost:8080/realms/test-realm/account).
  12. Open your browser's developer tools (e.g., F12) and inspect the Console tab for JavaScript errors.

Example of the generated JavaScript snippet causing the error:

const input = {
  // ... code before ...
  requireResidentKey : 'not specified',
  userVerificationRequirement : 'not specified',
  createTimeout : 3,600, // causing SyntaxError
  excludeCredentialIds : '',
  initLabel : "Passkey (Default Label)",
  // ... code after ...
}

Anything else?

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0