Skip to main content

normalize_serial

Function normalize_serial 

Source
pub fn normalize_serial(value: &str) -> String
Expand description

Folds an operator-supplied certificate serial into the form the column holds: lowercase hex, no separators.

Every serial this server stores comes from AriCertId::serial_hex, i.e. hex::encode, which is lowercase and unseparated. Operators do not arrive with that: openssl x509 -serial prints upper case, and an abuse report quotes whatever its own tooling printed, colons included. Bound raw, such a value matched nothing and the answer was a silent empty page — the failure mode --status and --event are refused by name to avoid, since “no rows” reads exactly like “nothing happened”.

Applied at the operator entry points only (order list --cert-serial, audit list --cert-serial and their two ?certSerial= twins), never in the models: Order::find_by_cert_serial is fed by POST /revokeCert from a parsed certificate, where the value is already canonical and widening what matches would be a change of answer wearing a refactor’s clothes.

Only separators an operator would plausibly paste are stripped (:, -, whitespace). Anything else is left alone to match nothing, as it should.