deepstream.io icon indicating copy to clipboard operation
deepstream.io copied to clipboard

Server config: maxRuleIterations can be non-positive

Open ChristophConrads-deepstreamHub opened this issue 9 years ago • 1 comments

Consider the following simple conf.yml:

permission:
  type: config
  options:
    path: ./permissions.yml
    maxRuleIterations: -1

When starting the server, there is no warning or error message with respect to the maxRuleIterations value.

Expected behavior: A warning or an error message because no set of permission rules can be evaluated with a non-positive number of rule iterations.

The behavior was tested with the MacOS standalone binary and the npm version 2.0.1.

I wondered if the smallest possible value for maxRuleIterations should be zero or one. Based on RuleApplication.prototype._run and the fact that this._maxIterationCount = maxRuleIterations, I think maxRuleIterations should be at least one because the iteration counter this._iteration is incremented before the first comparison takes place.