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:
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.
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_LENGTHshould be introduced to allow administrators to configure the length of generated tokens. The option should:15if not provided, preserving the current behavior and ensuring backward compatibility.15to ensure a minimum level of security.Example configuration:
Or via environment variable:
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.