Skip to content

bug: synology-chat ignores SYNOLOGY_RATE_LIMIT=0 (parseInt || 30 truthy check) #39191

@scoootscooob

Description

@scoootscooob

Bug

In extensions/synology-chat/src/accounts.ts:83, the rate limit parsing uses || instead of ??:

rateLimitPerMinute:
  accountOverride.rateLimitPerMinute ??
  channelCfg.rateLimitPerMinute ??
  (envRateLimit ? parseInt(envRateLimit, 10) || 30 : 30),

When SYNOLOGY_RATE_LIMIT=0, parseInt("0", 10) returns 0, and 0 || 30 evaluates to 30.

Expected behavior

Use ?? so that parseInt result of 0 is respected:

(envRateLimit ? parseInt(envRateLimit, 10) ?? 30 : 30)

Setting SYNOLOGY_RATE_LIMIT=0 should produce rateLimitPerMinute: 0 (disable rate limiting or block all), not silently default to 30.

Impact

Low/Medium — users setting the env var to 0 get a different rate limit than intended.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions