case 4717 - KPI interval accepted only as a known date unit
Six KPIs put the request's interval criterion into the query as
DATE_TRUNC('<interval>', ...) unchecked, reachable by staff down to
TechRestricted (security review F26). New KPIFetcher.DateTruncUnitOrNull
accepts only PostgreSQL's date_trunc unit names (any case); the seven KPIs that
read interval refuse anything else with "Invalid 'interval' criteria", the same
form as their existing missing-criteria errors. The client only sends day or
month. (WorkOrderByStatusList reads interval without using it; checked too.)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -41,7 +41,13 @@ namespace AyaNova.KPI
|
||||
}
|
||||
|
||||
var timeSpan = (string)options.Criteria["timeSpan"];
|
||||
var interval = (string)options.Criteria["interval"];
|
||||
//case 4717: interval goes into DATE_TRUNC in the query, so only PostgreSQL's own unit names are accepted
|
||||
var interval = KPIFetcher.DateTruncUnitOrNull((string)options.Criteria["interval"]);
|
||||
if (interval == null)
|
||||
{
|
||||
_errorMessage = "Invalid 'interval' criteria";
|
||||
return;
|
||||
}
|
||||
var dateWhere = DataListSqlFilterCriteriaBuilder.DataFilterToColumnCriteria("aworkorder.createddate", UiFieldDataType.DateTime, "no-operator", timeSpan, options.ClientTimeStamp);
|
||||
var wotags = options.Criteria["wotags"].ToObject<List<string>>();
|
||||
bool wotagsany = options.Criteria["wotagsany"].ToObject<bool>();
|
||||
|
||||
Reference in New Issue
Block a user