Skip to content

XML/JSON import validators only check Name and Path — numeric fields not range-validated #366

@Christophe-Rogiers

Description

@Christophe-Rogiers

Description

The import validators only verify that Name and ExecutablePath are present:

  • src/Servy.Core/Helpers/XmlServiceValidator.cs (lines 79–95)
  • src/Servy.Core/Helpers/JsonServiceValidator.cs (lines 47–62)

Zero validation on numeric fields (HeartbeatInterval, RotationSize, MaxRestartAttempts, StartTimeout, StopTimeout, etc.) or string lengths. A crafted config file can set:

  • RotationSize to -1 → disables log rotation silently
  • HeartbeatInterval to 0 → health monitoring ineffective
  • StopTimeout to int.MaxValue → uint overflow in SCM timeout
  • Name to a megabyte-long string → DB corruption, path issues

These values flow directly into SQLite via UpsertAsync and are used at service runtime without further checks.

Severity

Warning — crafted import files can persist dangerous values into the database.

Suggested fix

Apply the same validation rules used by ServiceInstallValidator to imported configurations before persisting to the database.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions