Context, devices, and risk
Time, place, network, device and risk are observations about one request, each made by something the service has to trust and each with its own ways of being wrong. Good rules weigh that evidence, and when it falls short they can ask for more instead of simply saying no.
Context is evidence
All names, domains and identifiers in these examples are fictional.
On the afternoon after Sports day, Nia, a picture editor on the sports desk, is working from a café by the river, on a personal laptop, over the café's Wi-Fi. Nia wants the full-resolution file of draft photo 9003 for the next morning's Sports day feature. The photo service's rules say no: the photo is unpublished, and the device is not managed.
The rules are doing exactly what they were written to do. Whether they are making the right decision depends on what the service actually knows about that café, that laptop and that connection.
Subject and resource attributes come from systems of record. HR decides Nia's desk, and the rights team decides an embargo. Environment attributes are different, because nobody decides them. They are observations about one request, made by something the service has to trust, and each comes with its own reliability. The time comes from a clock. The country comes from an IP address. The device's state comes from a management system, and a risk score comes from a system that judged the sign-in.
Where attributes come from asked who is responsible for each attribute. For the environment, the question becomes sharper: who observed this, how, how could the observation be wrong, and what would the rule do if it were?
Time, place, and network
Time looks like the simplest attribute, and it still causes real incidents. The embargo rule compares the time of the request with embargo_until, and either side can go wrong. The time of the request must come from the service's own clock, kept synchronized, never from a timestamp in the request, which the sender controls.
The embargo itself needs a time zone. The relay result is announced at 10:00 in the event's local time, four hours behind UTC in June. If the rights team types "10:00" and the database stores it without a zone, a server running on UTC reads it as 10:00 UTC, and the photo is released four hours early. The photo service stores every embargo in UTC with the zone written out, and converts to local time only for display:
entered: 14 June 2026, 10:00, event local time
meaning: 2026-06-14T10:00:00-04:00
stored: 2026-06-14T14:00:00ZThat stored value is the 14:00 UTC embargo that refused Jo's early download of the relay photo in Writing rules with attributes.
Place is weaker evidence still. The country of a request is usually derived from its IP address, by looking the address up in a database that maps address ranges to locations. The mapping is approximate and sometimes simply wrong. Mobile networks can route traffic through another country, a VPN (virtual private network), which carries a device's traffic through an encrypted connection to another network so that its requests appear to come from there, moves an apparent location in seconds, and a photographer covering an away match really is somewhere else. The licensing requirement compares a photo's license_regions with this country. That is a reasonable guard against honest mistakes, such as a colleague abroad downloading an agency photo the photo service may not use there, but it will not stop anyone who wants to get around it. A country derived from an IP address should never be the only control on anything that matters.
The network has lost most of its meaning too. "On the office network" once meant sitting in the building at an office desk. Now Nia works from home over a VPN, from the café without one, and from the stadium stand on a phone. A laptop on the VPN may be infected, and a laptop at the café may be perfectly safe. Network membership says where traffic entered, not who sent it or from what device, so it can suggest that a request deserves a closer look but cannot vouch for one.
Devices
The device condition in the download rule is the strongest environment evidence the photo service has, because something actually checked the device. The photo service's laptops are enrolled in device management, which installs updates, requires disk encryptionTransforming data so that only someone holding the right key can read it. It protects confidentiality and, unlike hashing, is designed to be reversed by the key holder. and a screen lock, and can wipe a machine that is lost. When the rule asks whether a device is managed, it is really asking device management, and the decision has to trust that system's answer.
That answer must reach the decision in a way the device cannot fake. A request header such as Device-Managed: true is worthless as evidence, because any browser extension, script or tool can set it. Enrollment usually places a certificateA signed statement that a public key belongs to a name, such as a website's hostname, for stated purposes and a limited period. A certificate authority signs it, so software that trusts the authority can connect the key to the name. on the device instead, with its private keyThe half of a key pair that its owner keeps to themselves and uses to create signatures or decrypt data. Anyone who obtains it can act as its owner. protected by the device's hardware where possible. The device proves it holds that key when it connects, or presents a signed statement of its state, and the service verifies the proof and then checks the device's current standing. A laptop reported lost an hour ago should stop counting as managed, which makes this another attribute that needs to be fresh.
Unmanaged does not mean malicious. Nia's personal laptop may be better maintained than some of the photo service's own. What the rule lacks is evidence, not proof of danger, and that difference should shape the response. Managed does not mean safe either. It means known and configured, which is why the photo service combines it with other signals instead of letting it settle everything alone.
Risk signals
Many services receive a risk score with each sign-in or sessionThe ongoing connection between later requests and an earlier sign-in, so you are not asked for your password on every click. It is often tracked with a cookie holding an unpredictable session identifier., from a system that weighs signals such as an unfamiliar device, an address with a poor reputation, or sign-ins from two distant places within an hour. A score of high is useful information. It is also someone else's judgment, made with inputs and thresholds the photo service cannot see, and it is wrong in both directions: travelers trip it, and careful attackers avoid it.
The photo service therefore combines the score with other attributes rather than treating it as the truth. On a managed office laptop, a high score alone does not block a download, because device management already vouches for the machine. On an unmanaged laptop, where nothing else vouches for it, a high score is enough to refuse the full-resolution file. It also matters what the score measured and when. A score computed at sign-in at 08:10 says nothing about a connection that changed at 15:00.
Asking for more instead of saying no
Back at the café, a flat refusal has a cost. Nia still needs the photo, and people who are blocked find workarounds: a screenshot of the preview, or a colleague in the office who downloads the file and emails it. The decision can do better by asking what evidence would be enough.
The photo service decides that viewing photos needs no managed device, so Nia can see photo 9003 and its caption from anywhere. For the full-resolution file on an unmanaged device, it accepts a different kind of evidence: a passkeyA credential that your phone, computer or password manager creates for one website and keeps for you, unlocked with a fingerprint, face or PIN. Nothing you could type is sent, and it works only for the site it was made for, which helps it resist phishing. sign-in within the last 15 minutes, provided the risk score is low. The policy gains a second route to the same permission, while the embargo forbid stays as it was:
permit photo.download
when "picture-editor" in subject.roles
and resource.status in ["draft", "approved"]
and environment.device.managed is true
permit photo.download
when "picture-editor" in subject.roles
and resource.status in ["draft", "approved"]
and environment.sign_in.method is "passkey"
and environment.sign_in.time is within 15 minutes
and environment.risk is "low"When a request fails only because the sign-in is too old or too weak, the decision can report that, and the application asks Nia to sign in again with a passkey instead of showing an error. This is step-up authenticationAsking someone who is already signed in for stronger evidence before a sensitive action, such as requiring a passkey to export payroll after a password sign-in., described in Authentication policy and SSO. When Nia returns, the same request is evaluated again with the new sign-in. Here is the same download of photo 9003 at 15:00 UTC under three contexts:
| Context | Evidence | Decision | Reason |
|---|---|---|---|
| Office desk | Managed laptop, password sign-in at 08:10, low risk | Allowed | The first permit matches. The device is vouched for, so the age of the sign-in does not matter. |
| Riverside café | Personal laptop, password sign-in at 08:10, low risk | Ask for a passkey sign-in, then allowed | No permit matches yet. The second would match with a recent passkey sign-in, so the application asks for one and evaluates the request again. |
| Unfamiliar network abroad | Personal laptop, passkey sign-in 5 minutes ago, high risk | Denied | Nothing vouches for the device, and the risk is high, so neither permit matches. The sign-in is already strong and recent, so asking for another would add no new evidence. Viewing is unaffected. |
Each of these decisions holds for one request. Context changes during a session: a laptop falls out of compliance, a risk score rises, or Nia walks from the office to the café. Because the photo service checks every request, the next decision sees the new attributes, as long as they are fresh enough, which is the trade Where attributes come from described. Some systems go further and revisit decisions while a session is still open. When device management or the risk system reports a change, the service ends the session or asks for a new sign-in straight away, instead of waiting for the next request or for the tokenA piece of data issued by a trusted service that a client presents as a credential, for example to call an API or to report a sign-in. Some tokens carry readable claims; others are random strings that only the issuer can interpret. to expire. This is often called continuous evaluation. Later lessons take these ideas further: Conditional access policies follows how the photo APIAn application programming interface: a defined way for software to interact with a service. A web API offers endpoints where other programs send HTTP requests. asks for a fresh passkey sign-in, and Continuous access evaluation follows how one system tells another that something has changed.
Check your understanding
Try these questions before moving on. If an answer isn't right, use the feedback and try again.
Try it in the Lab
- Evaluate a context claim without mistaking it for attestationWrite rules that read device, risk and sign-in age from the request, test their boundaries and a missing value, and name the service each input would really come from.