Skip to content

Validation silently rewrites bad input (e.g. interval -500 runs at max speed) #39

Closed

Description

@TMHSDigital

Summary

SettingsManager.validate_all_settings() sanitizes before validating, and sanitize_input() clamps and defaults values. Invalid input gets silently rewritten into a different, valid value, so validation never sees the mistake.

Why it matters

Some of these rewrites are dangerous for a clicker:

Typed Becomes Effect
Interval -500 (ms) 0 Max-speed clicking with no error
Interval 1OO (letter O) 1000 Runs at a different speed than typed
X -1200 (monitor left of primary) 0 Clicks at the wrong place on the primary monitor
Interval 999999 60000 Silently clamped

The < 0 checks in validate_clicks, validate_minutes, validate_variation and validate_burst_settings are dead code, because values reach them already clamped to >= 0.

Evidence

  • autoclicker/core/settings_manager.py:241-282 — sanitize_input: max(0, min(int(float(value)), 10000)) for coords (:253), max(0, min(float(value), 60000)) for interval (:255), return self.DEFAULT_SETTINGS.get(key, 0) on parse failure (:246, :280).
  • validate_all_settings (:284+) runs sanitize_input on every key, then validates the sanitized dict.

Reproduced:

interval -500 -> valid=True interval=0
interval '1OO' -> valid=True interval=1000
x -1200 -> valid=True x=0

Suggested approach

  • Split parsing from validation: parse the raw string to a number, report a field error on parse failure or out-of-range (no clamping, no defaults), and only sanitize types (strip, int/float).
  • Keep defaulting only for missing keys from older settings files, not for user input.
  • Put the field name in errors and highlight the offending entry in the UI.

Done when

  • Negative, non-numeric, and out-of-range values for every numeric field produce a validation error naming the field.
  • Unit tests cover -500, abc, 1OO, and over-max values per field.
  • No path turns invalid user input into a faster click rate.

Activity

  1. added
    bug
    priority: high
    safety
    on Oct 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpriority: highsafety

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions