Invalid Route and Invalid Route
by in CodeSOD on 2025-11-20Someone wanted to make sure that invalid routes logged an error in their Go web application. Artem found this when looking at production code.
if (requestUriPath != "/config:system") &&
(requestUriPath != "/config:system/ntp") &&
(requestUriPath != "/config:system/ntp/servers") &&
(requestUriPath != "/config:system/ntp/servers/server") &&
(requestUriPath != "/config:system/ntp/servers/server/config") &&
(requestUriPath != "/config:system/ntp/servers/server/config/address") &&
(requestUriPath != "/config:system/ntp/servers/server/config/key-id") &&
(requestUriPath != "/config:system/ntp/servers/server/config/minpoll") &&
(requestUriPath != "/config:system/ntp/servers/server/config/maxpoll") &&
(requestUriPath != "/config:system/ntp/servers/server/config/version") &&
(requestUriPath != "/config:system/ntp/servers/server/state") &&
(requestUriPath != "/config:system/ntp/servers/server/state/address") &&
(requestUriPath != "/config:system/ntp/servers/server/state/key-id") &&
(requestUriPath != "/config:system/ntp/servers/server/state/minpoll") &&
(requestUriPath != "/config:system/ntp/servers/server/state/maxpoll") &&
(requestUriPath != "/config:system/ntp/servers/server/state/version") {
log.Info("ProcessGetNtpServer: no return of ntp server state for ", requestUriPath)
return nil
}