Apply the Role-B row filter to the manifest table, take the difference against the airframe’s known hold set, and probe the same fact a second way with a duplicate-key insert.
Apply the Role-B row filter to the manifest table, take the difference against the airframe’s known hold set, and probe the same fact a second way with a duplicate-key insert.
Answer
MANIFEST = [ {"flight": 3308, "hold": "A", "contents": "winter parkas", "classification": "Unclassified"}, {"flight": 3308, "hold": "B", "contents": "targeting pods", "classification": "Top Secret"}, {"flight": 3308, "hold": "C", "contents": "ration packs", "classification": "Unclassified"}, {"flight": 3308, "hold": "D", "contents": "spare tyres", "classification": "Unclassified"}, ] # From the aircraft table, which the flight id cross-references and Role B may read. AIRFRAME_HOLDS = ["A", "B", "C", "D"] role_b = [r for r in MANIFEST if r["classification"] == "Unclassified"] visible = sorted(r["hold"] for r in role_b) withheld = [h for h in AIRFRAME_HOLDS if h not in visible] def insert_probe(flight, hold): """The PK (flight, hold) is enforced over the WHOLE table, not the view.""" keys = {(r["flight"], r["hold"]) for r in MANIFEST} return "rejected: duplicate key" if (flight, hold) in keys else "accepted" print("visible holds :", visible) print("airframe holds:", AIRFRAME_HOLDS) print("withheld :", withheld) print("rows seen :", len(role_b), "of", len(MANIFEST), "(unfiltered COUNT(*))") print("insert probe B:", insert_probe(3308, "B")) print("inference :", "a classified shipment is aboard" if withheld else "nothing inferable")
Stallings & Brown, Computer Security 5e, ch5 §5.6–§5.9