Platform

Platform overview How it works Authorization testing Evidence & reports Private scanning Integrations

Solutions

Security agencies Product teams Regulated industries Partner programme

Learn

Blog Knowledge hub Compare

Resources

Pricing Documentation Help centre FAQ Security & data What we haven’t proved

Company

About Contact Careers Sign in to the platform Start a $199 pilot →

Home / Knowledge hub / Canonicalisation

Knowledge hub

Canonicalisation

Reducing input to one standard form before checking it, so tricks cannot slip by.

Illustration explaining Canonicalisation

What it means

Canonicalisation means converting input into one standard, simplest form before you use it or judge it. The same thing can often be written many ways: a folder path with dots and slashes, a URL with percent signs, text in different character encodings. The canonical form is the single agreed way to write it.

The rule that follows is simple. Canonicalise first, then validate. If you check first and convert later, you checked something different from what you ended up using. Without it, two checks can look at the same input and see two different things, and an attacker only needs one of them to be fooled. The goal is for the check and the use to look at identical text.

Why it matters

Getting the order wrong is a classic route past security checks. A filter that blocks ../ can be fooled by an encoded form that only turns into ../ after decoding, which leads to path traversal and files outside the intended folder. The same trick works on URLs, filenames and usernames.

Double encoding is a related trick: a value decoded twice, once by a gateway and once by the app. The risk is a data leak or worse, and it is easy to miss since each component looks correct alone. See also input validation.

How it shows up

You meet it in file handling, URL routing, redirects, access rules that match on paths, and anywhere text is decoded more than once. Different layers, such as a proxy, a framework and the operating system, may each decode input in their own way.

Use your platform's function to resolve a path to its real form, then confirm the result sits inside the folder you meant. Decode once, at one place, and validate the result against an allowlist. Test by sending encoded, double-encoded and mixed-case versions of every value that a rule depends on.

Questions people ask

Canonicalisation, answered

What does canonical mean here?

It means the one standard way to write something. For a path, it is the full, resolved location with no dots or links left. For text, it is a single agreed encoding and form.

Everything is compared in that form.

Why validate after canonicalising?

Because attackers choose a spelling that your filter will not recognise but the later step will. If you convert first, the filter sees the same thing the app will use.

Checking in the wrong order is the whole bug.

Is this the same as Unicode normalisation?

Normalisation is one kind of canonicalisation, applied to Unicode text. Canonicalisation is the wider idea, which also covers paths, URLs, encodings and case.

Both fix mismatched views of the same value.

What is double encoding?

It is encoding a value twice, such as a percent sign that is itself encoded. A first layer decodes once and sees something harmless, then a second layer decodes again and sees the real value.

Decode once and in one place.

How do we test for it?

Send the same dangerous value in several spellings: encoded, double-encoded, with different case and with alternative separators. Compare the responses to the plain version.

Any difference means two layers read it differently.

Cyberlop mark

Do your checks see the final form?

We send the same value in encoded and altered spellings and show where one layer lets it through. Each finding carries the request and response. Book a pilot on one app.

Or start with a $199 pilot on one application: thirty days, success criteria agreed before day one, credited against the annual if you convert.