Maintenance Tag Review
Maintenance Tag Review
Reader State Model
Start with a small state machine. The simulation should make each transition explicit so a bad tag, ambiguous field, malformed record, or policy denial is visible rather than hidden behind a single “read failed” message.
Activation Loop Trace
Simulating an NFC reader means modelling a repeating loop, not a single read. The reader energizes the 13.56 MHz field, polls supported technologies such as NFC-A, NFC-B, NFC-F, and NFC-V, detects a response, resolves one target out of any crowd, activates it, exchanges data, and releases the target before polling again.
Figure 1 divides a reader tap into states that can be logged separately.
Polling turns on the field and cycles the supported modes. Detection reports a nearby target, while anti-collision resolves a participant when more than one response appears. Selection and activation establish the exchange context before the reader decodes data; release ends that attempt. Record the state where a simulated run failed instead of writing only “read failed.” A detection without activation does not prove an NDEF message was available, and a decoded message does not authorize an application action. The software-only model prepares a trace to check later against a real reader and tag.
A useful simulator logs transitions instead of returning only “tag read” or “read failed.” For a maintenance tag, the trace might say: field on, Type 2 candidate detected, UID selected, NDEF TLV read, URI decoded, host accepted, app authorization still required. That trace lets a review distinguish a polling miss, collision-resolution issue, payload rejection, policy denial, or release-evidence outcome.
The simulation boundary should be explicit in the same report. A software-only lab can prove that the parser rejects a malformed TLV length, that policy rejects an unknown URI host, and that the application asks the user to isolate one label when two tags are in the field. It cannot prove antenna tuning, installed read range, phone operating-system prompts, secure-element behavior, or the effect of mounting a label on metal.
Use a simple release example. If the target deployment is a gateway tag carrying https://ops.example/A7, the simulation should accept that reference only after checking the NDEF record type, URI scheme, allowed host, payload length, and duplicate-read rule. It should still stop short of service action until an authenticated app session and backend work-order state allow it.
Failure Injection Matrix
A useful lab does not only show the happy path. It should include failure scenarios that force the reader and application to explain their decision.
Inspect Figure 2 and ask whether every injected failure has an expected reader response and a retained evidence field.
Read Figure 2 down the cases. A valid maintenance URI may reach authorization, while two visible tags require isolation or explicit selection. Malformed length must stop before policy receives a partial URI, and an unknown host must not be opened even when parsing succeeds. Locked-tag writes fail safely, while suspicious timing is recorded as a freshness and review signal rather than automatic attack proof. Each outcome retains inputs, reason codes, lock state, timing, and the resulting decision.
Minimal Scenario Record
Use a compact scenario record instead of a long copied code listing. The record should describe what the simulated reader sees, not pretend to be real RF data.
Activation Sequence Details
Model the activation sequence as distinct states so failure injection can name exactly where the workflow stopped:
- Field on and technology polling: the reader sends each technology’s poll command, such as
REQA/WUPAfor NFC-A orSENSF_REQfor NFC-F, and listens for a technology-specific response. - Anti-collision: if more than one card answers, the reader resolves one UID or target identifier so it talks to exactly one device.
- Select and activate: the reader issues
SELECTor the technology equivalent to put the resolved target into the active state. - Protocol activation: for a Type 4 or ISO-DEP card, the reader runs
RATSto learn card capabilities, then exchanges ISO 7816-4 APDUs such as application selection by AID and command/response pairs. - Release: the card is deactivated and the polling loop resumes.
Run it: Steps 3 and 4 are a command-then-response exchange – watch one play out in the card-emulation workbench below. The terminal starts the conversation, the AID selects an app or secure element route, and each command draws a response until a security policy decides the result. Switch between the Host card emulation app and the Secure element route. Click Show a common failure once for the out-of-range case, then again for No matching route: the workbench reports No route is registered for the selected AID. This was observed in the browser run and identifies a route failure before APDU exchange.
This is where the lab earns its keep. You can inject a second card at the anti-collision step, drop the field mid-APDU, corrupt a TLV length, or delay a response and then ask which state owns the failure. The point is not to imitate every analog timing detail; it is to make the reader software obligations explicit enough that the review can separate parser, policy, and follow-up hardware risks.
A practical scenario table should include one clean tag and several negative cases. In the clean case, a Type 2 tag advertises an NDEF Message TLV, the parser finds a URI record, and policy accepts the host. In a malformed case, the TLV length claims more bytes than the buffer contains, so the parser must reject before policy sees a partial URI. In a multi-tag case, anti-collision selects one UID, but the application may still reject a maintenance write because two nearby labels create user ambiguity.
The byte trace can stay small. For example, 03 13 means an NDEF Message TLV with length 0x13, or 19 bytes, before the FE terminator. The record header D1 indicates a short well-known record with message-begin and message-end set. The URI record type 55 is followed by URI identifier code 04, which abbreviates the https:// prefix, and the remaining payload bytes spell the host and path.
Folded Hands-On Pilot Notes
A useful NFC hands-on pilot separates tap intent, payload design, app policy, and field testing:
| Pilot checkpoint | Evidence to capture |
|---|---|
| Tap intent | What the user expects the tap to select, open, or hand off. |
| NDEF payload | Record type, host, schema version, payload size, and unsupported-record behavior. |
| Application policy | Session requirement, role check, object-state check, fallback path, and audit event. |
| Field test | Final tag surface, phone models, cases, label overlay, tap-zone marking, and damaged-tag behavior. |
| Release record | Owner, app version, tag batch, replacement process, and failure reason codes. |
Use the simulator for parser behavior, duplicate reads, anti-collision paths, malformed records, and policy denials. Then run a physical pilot before release, because software-only traces cannot prove installed read range, phone prompts, metal detuning, or user handling.
Folded Lab Evidence Record
When the lab uses a real tag, phone, USB reader, or supplied trace, finish with one evidence record that separates observation from authorization:
| Evidence field | What to record |
|---|---|
| Reader path | Phone app, USB reader, embedded reader, or supplied trace. |
| Raw evidence | Saved trace, tag type, UID if exposed, NDEF bytes, record order, and read timestamp. |
| Decode result | Record type, payload length, URI prefix, host, text encoding, schema version, and terminator handling. |
| Validation result | Approved host, allowed record type, object reference exists, malformed length rejected, duplicate tap behavior. |
| Action boundary | Which action may proceed after app policy, and which actions must never follow from read success alone. |
| Retest trigger | Payload format, reader path, policy, tag replacement, mounting material, or installation change. |
This record is intentionally small. It should prove that learners can plan a payload, read it, decode it, reject bad cases, and explain why “tag read” is not the same as “action allowed.”
Worked Example: Maintenance Tag Review
A facilities team wants tags on gateways and air handlers. A tap should open the correct maintenance record and allow a technician to create a service note. The team wants a simulation before buying production labels.
Simulation Design
Step 1: Set the reader scenario
- Copy the
maintenance-tag-validscenario above into a lab record and identify its Type 2 tag and URI intent. - In the reader state model, mark polling, selection, memory access, parsing, policy, and evidence as separate stages.
- The expected output is an asset reference, not permission to update an asset.
- Label the supplied UID and bytes as scenario data; they are not a live RF capture.
- Keep the approved host and maximum payload length beside the scenario before decoding.
Step 2: Trace activation and selection
- Follow the activation loop above from field on through technology poll, one selected target, and release.
- In the card-emulation workbench, compare the host app and secure-element routes and note the selected AID.
- Click its common-failure control twice; the browser run reported
Out of NFC coupling range.and thenNo route is registered for the selected AID. - Record a distinct reason for two candidates, selection failure, or mid-exchange field loss.
- The software trace models state transitions; only a physical reader can test installed range and coupling.
Step 3: Decode the NDEF bytes
- In a local Python terminal, decode the chapter’s
03 13 ... FEbytes as an NDEF TLV and URI record. - Check the TLV length against available bytes before reading the short-record payload length.
- The local run returned
ACCEPT reference=https://ops.example/A7 action=requires_app_authorization. - Confirm the URI prefix byte
04supplieshttps://and the remaining payload supplies the host and path. - Save both the input hex and decoded URI so a reviewer can detect byte-to-text mistakes.
Step 4: Reject damaged or untrusted records
- Change one byte or length at a time, then rerun the same parser and record its first failed rule.
- A TLV length of
0x40on the short chapter buffer returnedREJECT tlv_length_exceeds_bufferlocally. - Changing the URI host in the fixture returned
REJECT unknown_host. - Also document duplicate-read, multi-tag, oversized payload, and read-only-write cases in the matrix above.
- Do not pass a partial URI to application policy when the container length is invalid.
Step 5: Apply application authority
- For the accepted URI, check the authenticated technician session and work-order state in the application layer.
- Record
requires_app_authorizationafter parsing; this is the actual local fixture disposition. - Deny service-note creation when the session or object state is not approved, even if the tag parsed cleanly.
- Keep parser acceptance, policy acceptance, and completed action as three different fields.
- This boundary prevents a readable label from becoming an authorization credential.
Step 6: Prepare physical follow-up
- Complete the evidence record above with raw bytes, decode, reason codes, and policy decision.
- On your own hardware, test final label placement, phone models, cases, metal surfaces, and damaged tags.
- Capture the actual reader or phone window and note the installed tap range; this was not run here.
- Include read-back and lock-state evidence before approving any writable tag design.
- Mark the release provisional until those field tests match the simulated record.
Checkpoint: Acceptance Evidence
The simulation is ready for field testing only when it produces evidence for both accepted and rejected paths:
- Accepted tag opens the asset record only after the app session is valid.
- Unknown host, malformed NDEF, and oversized payload are rejected with clear reason codes.
- Multi-tag behavior is documented so label spacing can be checked in the physical layout.
- Write tests include read-back validation and expected lock state.
- The report states what the simulation does not prove: tap range, antenna detuning, case effects, and phone operating-system prompts.
Technical boundaries. The supplied UID and bytes are scenario data, not a live RF capture. Software-only traces cannot prove installed read range, phone prompts, metal detuning, or user handling; parser acceptance still requires app authorization before service-note creation.