Skip to content

Implementation plan / Session plan / Handover RC-4-S02

Handover RC-4-S02 Build: Runtime decision services (Break-the-Glass)

Card: RC-4-S02. Issue: cema-care/his#169. Branch: session/RC-4-S02. Slice: RC-4. Decision record: ADR-HIS-120.

What was built and where

FR-ESS-AUZ-002 Break-the-Glass in MOD-ESS-002 of services/ess-runtime-decision. It offers emergency-access.v1 (IF-ESS-004) as RC-4-S01 fixed it, and the session takes part in every policy decision. The unit's README has the packages and settings.

  • mod-ess-002/.../emergency/:
  • EmergencyAccess, the nine operations:
    • invocation: the ess.auz.btg.invoke decision, the reason and justification of part 6.2, and the 5-minute recent authentication (auth_time);
    • the states of D10-ESS 4.3: suspend, resume, end, expiry at the end of the window, and the end when ordinary access is permitted;
    • the review, opened by a privacy or security officer who is not the subject. The outcome is recorded once, after expiry; Inappropriate needs a comment;
    • escalation of an overdue review, the session list and the repeat patterns of part 6.10;
    • audit ess.auz.btg (and ess.aud.access for the patterns), and the events EmergencyAccessInvoked, EmergencyAccessReviewed and ReviewOverdue on his.ess.emergencyaccesssession.v1.
  • SessionStore (DE-ESS-006).
  • EmergencySettings: CFG-ESS-006 to CFG-ESS-008, read from the policy content.
  • Outbound: the alert and the tasks, written durably in the transaction of the change and sent after it until they go through.
  • EmergencyJobs: expiry, escalation and sending, every 15 seconds.
  • ports/Coordination and HttpCoordination: notification.v1 requestNotification, and workflow.v1 createTask, completeTask and reassignTask (at his.authz.notification-url and workflow-url).
  • web/EmergencyAccessController.
  • support/Commands: idempotency and If-Match. support/JobContext: work run by the unit itself.
  • decision/DecisionService and DecisionStore:
  • the subject's Active session for the request's patient goes into the rules' input;
  • a Permit under it is stored with emergency_session_id and audited as ess.auz.btg-activity;
  • an ordinary Permit for the patient ends the session.
  • resources/policy/his_authz.rego: the permit under a session (ADR-HIS-120 point 2). It keeps the obligations and the second factor (stepUp, stepUpIf) of the role's rules it rests on, and adds its obligations elevated-audit and session-marker, a cache lifetime of 0, its trace step emergency-session, and the part 10 messages when a session does not permit.
  • resources/policy/enterprise-access.v1.json:
  • the emergencyAccess settings (reason codes, the justification length, a window of 4 hours, review within 48 hours, the reviewers, the alert recipients, the queue and the escalation target);
  • patientScope: true on the relationship conditions of the clinical permit rules;
  • the resource type ess.EmergencyAccessSession and the rules btg-invoke, btg-session-read, btg-session-review and btg-patterns.
  • The test pack gains TP-60 to TP-64.
  • Migration V2__emergency_access.sql: emergency_access_session (one session in force per subject and patient; delete refused), outbound_request and idempotency.
  • AuthzProperties: workflow-url, notification-url and emergency-interval. Mod002Module: the topic and the Coordination bean. AuthzRefusalTypes: refusals of ess.auz.btg.* are audited as ess.auz.btg.
  • Tests: EmergencyAccessTest (24 tests) and contract/EmergencyAccessContractTest, with FakeCoordination in the test configuration.

No dependency was added, and no lockfile changed. No contract changed.

Checks and their result

In services/ess-runtime-decision, with HIS_SESSION=RC-4-S02 and the light profile started (platform/dev-environment/his-env start light):

./gradlew build                                              # every module, including both contract tests (Docker)
./gradlew :mod-ess-002:test --tests '*EmergencyAccess*'      # this card's tests
  • ./gradlew :mod-ess-002:test: 140 tests, none failed. EmergencyAccessContractTest runs his-contract verify on all nine operations of emergency-access.v1 with 0 failed cases, and his-contract validate-event on the three events as published (passed).
  • ./gradlew build: BUILD SUCCESSFUL (every module and its tests).
  • python3 docs/implementation_plan/tools/check_links.py and mkdocs build: passed.
  • The secret scan platform/delivery-pipeline/bin/secret-scan code origin/main: no findings.

Requirements and test scenarios

Every test is tagged FR-ESS-AUZ-002, with its AC and TEST tags, in mod-ess-002/src/test/java/care/cema/his/ess/mod002/EmergencyAccessTest.java.

Item Covered by
AC-01 access without remote approval; a session exists Invocation.accessWithoutRemoteApproval
AC-02 every audit event under the session carries it, with elevated detail activityAudited
AC-03 real-time alert and a review task with a due time Invocation.alertAndReviewTask
AC-04 after the window, denied unless ordinary policy permits Lifecycle.accessEndsAtExpiry, Lifecycle.ordinaryAccessEndsSession
AC-05 an overdue review escalates reviewOverdue
AC-06 notification and task services down: access proceeds, alert and task after recovery coordinationDown
AC-07 a role not permitted is refused and audited Lifecycle.roleNotPermitted
AC-08 a screen lock: still Active, the time keeps counting Lifecycle.screenLock
AC-09 fast user switch: resumed with the time left, or ended after the window Lifecycle.switchAndReturnWithinWindow, Lifecycle.returnAfterWindow
TEST-ESS-006 Invocation (8 tests), activityAudited
TEST-ESS-007 Lifecycle (7 tests)
TEST-ESS-008 reviewOverdue
TEST-ESS-009 coordinationDown
Part 13: the role rule's second factor (stepUpIf) still applies under a session Invocation.stepUpKept
D10-ESS 4.3, PR-IAM-002-2: a Blocked account's open session may invoke, a Suspended one may not Invocation.accountState
Part 6.2 reason, justification, recent authentication; part 6.8 end; part 6.9 review; part 6.10 patterns; part 6.11 scope; part 13 justification for reviewers only Invocation.reasonCaptured, Invocation.recentAuthentication, Invocation.repeatAnswersSession, Invocation.patientScopeOnly, Lifecycle.endEarly, the Review tests (6)
IF-ESS-004, EVT-ESS-004, EVT-ESS-005, ReviewOverdue contract/EmergencyAccessContractTest
The policy rules (AC-03 of FR-ESS-AUZ-001) PolicyTestPackTest with TP-60 to TP-64

The safety duty of the card is covered as follows:

  • time-limited: AC-04, AC-08 and AC-09;
  • reason-captured: reasonCaptured;
  • fully audited: AC-02 and AC-07, and every transition is audited;
  • always reviewed: AC-03 and AC-05;
  • never wider than the patient in context: patientScopeOnly and ADR-HIS-120 point 2.

On the non-functional targets: the invocation never waits on another service (NFR-ESS-007, 011). Expiry and escalation run every 15 seconds, safe on several instances, and the backlog of unsent calls is a metric (NFR-ESS-015 to 017). The decision path adds one indexed lookup when the subject is a person and the request names a patient.

Done differently from the specification or contract, and why

  • No security incident is opened in D02. contracts/ise security-monitoring.v1 has no operation to open one. An Inappropriate outcome is referred instead (ADR-HIS-120 point 6), and securityIncidentId stays absent:
  • the event EmergencyAccessReviewed;
  • the audit record ess.auz.btg.review-outcome with referral: d02-security-monitoring, which the audit service forwards;
  • an alert "referred" to the security and privacy recipients.
  • An outcome may be recorded on an Expired session without opening the review first. The contract's openEmergencyAccessReview stays the way UI-ESS-005 marks the review started. The outcome is still refused while the session is in force, and recorded only once.
  • Account state at invocation follows MOD-ESS-001's rule for every decision. A Blocked account stops new sign-ins only (D10-ESS 4.3, PR-IAM-002-2), so its open session may invoke. A Suspended or Deactivated account, or a revoked session, may not.
  • justificationMinLength is 10, a starter value. The specification gives no number (part 6.2 says "configured length").

Questions for a person

  • The security incident of an Inappropriate outcome (asked on issue #169). Part 6.9 and D10-ESS 4.3 say an Inappropriate outcome opens a security incident in D02. security-monitoring.v1 offers no operation to open one, so the outcome is referred instead (see above), and securityIncidentId stays absent. The clinical safety officer and the privacy officer should confirm that this referral is acceptable until D02 offers the operation, or say what must happen in the meantime.
  • Q4 on issue #15 (extending a session that is still Active) is still open. Version 1's behaviour stays: a repeat invocation answers the session in force.
  • The Security and Privacy Office should confirm the starter settings in emergencyAccess (the reason codes, a justification of at least 10 characters for Other, the reviewers, the alert recipients, the escalation target) and the new btg-* rules. Both go through the configuration lifecycle with the policy.

Follow-ups outside the card

  • RC-4-S06 (e2e/scenarios/RC-4/rc-4.scenario.ts):
  • RC-4-E2E-002 reads obligations as o.code, but the contract's field is id (policy-decision.v1 Obligation). The step "in-scope requests are permitted" fails until it reads o.id.
  • The privacy officer's token must carry acr: aal2, because the reviewer roles are privileged.
  • ess-coordination (MOD-ESS-007, MOD-ESS-008) must register these, and allow this unit's service identity to create, complete and reassign those tasks:
  • the notification type ess.emergency-access-alert;
  • the task types ess.emergency-access-review and ess.emergency-access-follow-up;
  • the escalation policy ess.emergency-access-review-escalation.
  • Deployment: set HIS_AUTHZ_WORKFLOW_URL and HIS_AUTHZ_NOTIFICATION_URL for this unit. Until they are set, the alert and tasks stay pending and are counted in his.authz.btg.outbound.unsent.
  • D02 contract owner: an operation to open a security incident in security-monitoring.v1, which would make it one more kind of outbound call here.
  • Policy content: the pharmacist and the allied health professional have no ordinary permit rule on the clinical record, so a session gives them nothing to read. The domain rule owners should add those rules, or remove the roles from CFG-ESS-006.
  • TEST-ESS-040 is also traced to FR-ESS-AUZ-002 in D10-ESS section 15.3, but is not on this card.