Skip to content

Feature Request: Add GOTIFY_TOKEN_LENGTH configuration option #936

@Pyvonix

Description

@Pyvonix

Is your feature request related to a problem? Please describe.
When Gotify generates tokens (for applications, clients, etc.), they are always 15 characters long. This length is hardcoded and cannot be changed either through the UI or any configuration option. For environments with stricter security requirements, 15 characters may not be sufficient, and there is currently no way for an administrator to enforce a longer, more secure token length.

Describe the solution you'd like
A new application configuration option GOTIFY_TOKEN_LENGTH should be introduced to allow administrators to configure the length of generated tokens. The option should:

  • Default to 15 if not provided, preserving the current behavior and ensuring backward compatibility.
  • Accept any integer value greater than or equal to 15 to ensure a minimum level of security.
  • Be documented alongside the other existing configuration options.

Example configuration:

server:
  [...]
  tokenlength: 15

Or via environment variable:

GOTIFY_TOKEN_LENGTH=32

Describe alternatives you've considered
Manually editing tokens after generation: Users could theoretically update tokens manually in the database, but this is error-prone, not user-friendly, and not a scalable solution for administrators.

Enforcing a fixed longer token length: Hardcoding a longer token length (e.g., 32 characters) instead of 15 would improve security but would not give administrators the flexibility to define their own required length based on their specific security policies.

Additional context
Allowing configurable token lengths is a common best practice in security-conscious applications, giving administrators the ability to align token generation with their organization's security policies or compliance requirements (e.g., NIST, OWASP recommendations). This change is fully backward compatible since the default value remains 15.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:featureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions