Why repeat the test at system acceptance
The IT team accepting the gate system usually does not check what happens when the scanner delivers something unexpected. Yet a USB or HID scanner is a keyboard: it types characters that someone may have prepared on a printout. A QR code can contain an address, a script, a file path or a string that resembles a database query.
The scenario described here is a test of a function, not a history of a rollout at a client. It is based on the set of cases that the gate's tests pass, and it suggests how a similar review can be carried out independently in the plant's test environment.
The set of strings and the expected result
The gate tests pass five kinds of malicious strings. None of them may open access or change the state of a person in the system. For its own acceptance, it is worth preparing printouts with the same content and scanning them with the plant's ordinary scanner.
The most instructive case is the last one, a fabricated token of the correct length on a foreign domain. It looks like a real code, but the system does not treat the address as a command, only as a string to be classified.
- a script starting with javascript:,
- a script tag typed as content,
- a path leading outside the directory,
- a string resembling an SQL injection,
- a fabricated 64-character token on a foreign domain.
Lengths in the gate test
Why the string does nothing
The scanner is treated purely as a keyboard: what it types is a string that is classified with a regular expression. It is never an address to open, HTML to display or code to execute. The browser at the gate does not navigate to any address taken from the code.
On the server side the value is checked again. The browser sends only the raw string, and its own recognition result is not taken into account. As a result, a modified client cannot declare that the string is a valid token. Lookups of a badge and a card in the database use parameterised queries only, so a fragment that resembles SQL remains an ordinary value.
Length limit and a uniform response
The gate rejects a string longer than 512 characters before it attempts recognition. This is a simple safeguard against flooding the field with a huge entry. The acceptance test should cover a string just below and just above this threshold, to see the difference in behaviour.
The response to an unknown, revoked and invented code is the same: "unknown code" (404), without echoing the scanned string. For IT this means that no fragment of the typed text will appear in the gate window that could be used to attack the page. It also means the response itself does not reveal whether a code ever existed.
What to record in the acceptance protocol
The acceptance protocol should contain the list of tested strings, the date of the test, the name of the environment and the result for each. It is good to add an observation that after the test the data of people and the on-site status did not change. The absence of changes is proof that the string did not reach the business logic.
The IT team can also check whether the attempts were recorded in the event history. The system records every attempt at the gate, including a refusal, so the test leaves a trace that can later be told apart from production traffic. A detailed description of the method for assessing a vendor's code will be found in the guide on the resilience of the gate against malicious strings.
Checklist
Video
Frequently asked questions
Can a fake token from a foreign domain open the gate?
No. The server checks the raw string again and does not treat the address from the code as a command. A token from outside the system ends with the message "unknown code".
Can the test be run in production?
It is better in the plant's test environment. In production every attempt is recorded in the gate history and could disturb the analysis of events.
What about strings longer than 512 characters?
The gate rejects them before it starts recognition. It is worth including such a string in the acceptance test.
See the gate test live
We will show the set of strings and the record of attempts in the gate history. Book a demonstration with the InnerWeb team.
Let's talk