Marker contracts and exact-match boundaries
What the observer actually found
A SOC analyst is reviewing a training alert attributed to an infostealer. The headline says a secret left a workstation. The attachment is a single line produced by a test application. Start with a narrower question: does one of the fields in that line contain an exact match for a registered test value? The test owner created two fictional values before the exercise. They were handed to the reviewer under short aliases. The owner’s report needs an alias and a reference to an observation, which is sufficient to repeat the decision.
Teams sometimes use the same word for a marker value, a detection name and an alert identifier. Separate these on paper. M-11 names an entry in the registry. Its longer value can occur in the text. R-104 identifies a transcript row. Another run can reuse the same registry entry. That is why the report identifies the run even if the shift was given just one export.
Evidence supplied by the owner
run B-71
M-11 = TRAINING-CANARY-X412
M-12 = TRAINING-CANARY-N504
R-104 entered TRAINING-CANARY-X412
R-105 entered TRAINING-CANARY-X412-sample
R-106 copied TRAINING-CANARY-X412 TRAINING-CANARY-N504 TRAINING-CANARY-N504
The input contract determines boundaries
For this particular export the owner defines whitespace as the field separator. Punctuation remains part of a field. Substring matching would count the value with the suffix -sample. Stripping punctuation would silently alter the data contract. If another system exports a JSON object, ask for its field definitions and design a separate adapter. The current test covers a specific format that both sides can reproduce without access to a live device.
Draw a truth table before writing the loop. Include an exact value, an extended value, two copies of an exact value and text with no markers. Two different aliases can occur in the same row. This produces two findings but still only one affected row if the metric counts rows. Record the unit next to the total. Without it, two analysts who both reason correctly could appear to disagree about the impact.
Implement and inspect
def observed_aliases(text, registry):
fields = set(text.split())
return sorted(alias for alias, value in registry.items() if value in fields)
registry = {"M-11": "TRAINING-CANARY-X412", "M-12": "TRAINING-CANARY-N504"}
assert observed_aliases("TRAINING-CANARY-X412-sample", registry) == []
Turn an example into a property
The sample is a pure function. Its result depends only on two arguments. Predict the output for empty text, then swap the positions of two tokens and repeat. Sorting aliases stabilizes the output for comparison with an expected result. It does not describe when an event occurred. If the output were word positions instead of aliases, the reordering test would need a different expectation. The representation determines which property is worth checking.
Add a near match to probe the boundary. Decide in advance whether case matters. Here it does. Lowercasing just one character changes the outcome. Ask a colleague to predict that decision from the contract without seeing the code. When two different answers are defensible, updating the contract gives a better result than creating more assertions around an ambiguous specification.
Review the contract with the fixture author
Ask the fixture author to prepare three fresh cards before applying the rule. One contains an approved marker in its own field, another contains the same sequence inside a longer word, and the third contains a similar marker from another run. The developer and analyst write down their expected decisions independently and compare answers. If punctuation causes disagreement, clarify the field boundary and preserve that example as a test. If the disagreement concerns the run, check the origin of the marker register. A brief sign-off lets the next shift recognise deliberate format decisions.
Exercise. Handover to the next shift
A second shift supplies four rows from a separate acceptance run. Its registry contains a single sample. The customer wants the row identifier for the exact value and asks whether that observation proves that a file reached another organization. The source is explicitly a local training transcript. No receiving-system acknowledgement is included in the assignment.
B-19 M-09 = TRAINING-CANARY-Y100
R-210 TRAINING-CANARY-Y100,
R-211 ack TRAINING-CANARY-Y100
R-212 training-canary-y100
R-213 TRAINING-CANARY-Y1001
Identify the matching row and give a reason for rejecting each of the other three. Replace the comma following the value in the first row with whitespace. Predict how many rows will qualify after this edit. Keep the original result and your amended table so a reviewer can trace the change in the output to one change in the input.
Compare your independent decision
In the original input R-211 is the only exact match. The observation establishes the presence of the test value in this transcript. Evidence of delivery would require an independent receiver record tied to this run and row. Removing the comma also admits R-210. If outcomes change for other rows, inspect any state that may be leaking between consecutive calls to the function.
Sources
OWASP. Logging Cheat Sheet · Python. unittest
Test your conclusion
Which finding belongs in the synthetic exposure report?
Lab journal
run=B-16 row=R-110 marker=M-08
Receiver
run=B-18 row=R-110 receipt=K-280 report schema: run, row, marker, status
Supported. A received status requires the B-16 receipt for R-110. The shared report uses only declared fields.
Insufficient evidence. The row identifier was reused in another run. The receipt refers to B-18.
Independent exercise

The fixture owner claims that three appearances of a sample imply three findings. Test the claim on this new register.
Evidence
B-28: M-06 = TRAINING-CANARY-W020; M-07 = TRAINING-CANARY-D611 R-310 TRAINING-CANARY-W020 TRAINING-CANARY-W020 R-311 prefix-TRAINING-CANARY-W020 TRAINING-CANARY-D611 R-312 training-canary-d611
Assignment
List the row and alias pairs and count the distinct matching rows. Change only the case in R-312 and predict the new result.
Compare your reasoning
The initial pairs are R-310/M-06 and R-311/M-07. A repeated marker in a single row counts once. Matching the registered case adds R-312/M-07.
Personal practice environment
Check an excerpt, find matching lines and compute the SHA-256 of the original text. Temporary data expires after 30 minutes or when you close the environment.
Sign in