Skip to content

[Correctness] ServiceValidator.cs — Missing upper-bound check on StopTimeout for import flows #556

@Christophe-Rogiers

Description

@Christophe-Rogiers

Severity: Warning

File: src/Servy.Core/Helpers/ServiceValidator.cs, lines 35–37

Description:
ValidateDto checks dto.StopTimeout < AppConfig.MinStopTimeout (lower bound = 1 second) but has NO upper-bound check. AppConfig.MaxStopTimeout is 86,400 seconds (24 hours).

The upper-bound check exists only in the UI/CLI validators (ServiceConfigurationValidator). ServiceValidator.ValidateDto is used by JsonServiceValidator and XmlServiceValidator for import flows — meaning an imported JSON/XML config with StopTimeout = 999999 passes validation without error.

The same gap exists for StartTimeout.

Suggested fix:
Add upper-bound checks:

if (dto.StopTimeout > AppConfig.MaxStopTimeout) return (false, "Stop Timeout exceeds maximum.");
if (dto.StartTimeout > AppConfig.MaxStartTimeout) return (false, "Start Timeout exceeds maximum.");

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions