Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog.d/authorization-history.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### `status`, `doctor` and `verify` keep an older denial visible

- A provider's last coordinator authorization was shown only while it was at most 10 seconds old. An App Attest lease already stayed visible until it expires, but an older `none` (a denial) or `legacy` report vanished from `darkbloom status`, `doctor` and `verify`, so a Mac the coordinator had denied could look healthy. Such a report now stays visible as dated history: `Last reported authorization: received 10m ago; not a fresh dispatch grant. …` in `status`, and a `last reported authorization` line in `doctor` and `verify`, INFO for legacy and WARN for a denial.
- History never stands in for a current grant or the public proofs: it offers no MDM removal or migration, and `doctor` and `verify` still run the trust and public attestation checks after it. `darkbloom verify` now fails on a WARN or FAIL line, not on an INFO line.
3 changes: 2 additions & 1 deletion docs/provider/cli-reference.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Provider CLI reference

> Last updated: 2026-11-08
> Last updated: 2026-11-09

Reference for the `darkbloom` command-line tool: every subcommand and flag, the
files and identifiers it creates, the `provider.toml` keys it reads with their
Expand Down Expand Up @@ -2752,6 +2752,7 @@ Output includes:
the `→ fix:` line from
[GLM-5.3-Flash GPU wired-memory limit](#glm-53-flash-gpu-wired-memory-limit).
- App Attest serving authorization can remain visible through its unexpired lease, while MDM removal advice requires a matching fresh coordinator decision. The same distinction applies to both doctor summaries; see [provider authorization](../reference/provider-authorization.md).
- `Last reported authorization: received <age> ago; not a fresh dispatch grant. …`: when no current decision is shown, an older `none` (a denial) or `legacy` report from the running daemon, as dated history. `darkbloom doctor` and `darkbloom verify` print it as `last reported authorization`, INFO for legacy and WARN for none, and still run the public attestation checks; `verify` fails on a WARN or FAIL, never on INFO. See [provider authorization](../reference/provider-authorization.md).
- `Requests served since the daemon started (… ago)`: coordinator requests
this daemon finished since it started, with output tokens only. The count
restarts at zero when the daemon restarts or a scheduled availability window
Expand Down
27 changes: 26 additions & 1 deletion docs/reference/provider-authorization.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Provider Serving Authorization

> Last updated: 2026-10-27
> Last updated: 2026-11-09

Provider trust status reports external serving permission, not a guarantee of
correct model output, physical uniqueness or secrecy from the executing process.
Expand Down Expand Up @@ -97,6 +97,31 @@ lease until its `expires_at` when its latest renewal arrived more than
The lease duration remains the external coordinator's decision; see the
[current status contract][platform-current].

When neither shows a decision, an older `none` or `legacy` report stays visible
as dated history, so a denial can't vanish 10 seconds after it arrived and leave
a denied Mac looking healthy (`ProviderAuthorizationReadiness.lastReportedStatus`,
`lastReportedSummary`; `DaemonState.lastReportedProviderAuthorization`). Every
check above still applies except the receipt's age: the state-file write within
`snapshotMaxAge`, the process and coordinator identity, `online`, protocol `1`,
and a receipt after the process started and at most 2 seconds ahead. An older
`app_attest` report, or a path it doesn't know, is never history.

| Command | Line | Level |
|---|---|---|
| `darkbloom status` | `Last reported authorization: received <age> ago; not a fresh dispatch grant. <summary>` before the trust line | — |
| `darkbloom doctor` | `last reported authorization`, in its coordinator checks (after the health check) and in the diagnosis's trust section, as `serving authorization` appears in both | INFO for `legacy`, WARN for `none` |
| `darkbloom verify` | `last reported authorization`, after the coordinator health check | INFO for `legacy`, WARN for `none` |

History is display only: it is never a dispatch grant, never offers MDM removal,
changes no enrollment or migration and doesn't touch the coordinator's own
per-request authorization. It never stands in for the public proofs: the trust
level and the public attestation lookup still run after it, and `darkbloom
verify` still fails on any warning or failure (an INFO line fails nothing).
Code: `provider-swift/Sources/darkbloom/StatusCommand.swift`,
`provider-swift/Sources/darkbloom/Diagnostics/DoctorRunner.swift`,
`provider-swift/Sources/darkbloom/DoctorCommand.swift` (`buildCoordinatorDoctorChecks`)
and `provider-swift/Sources/darkbloom/VerifyCommand.swift`.

The serving summary takes that displayed lease and the strict removal decision
separately (`ProviderAuthorizationReadiness.summary`). Status and both doctor
paths derive them from the same daemon snapshot and observation time. Positive
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,33 @@ public enum ProviderAuthorizationReadiness {
return live
}

/// Paths whose last coordinator report may be shown after `snapshotMaxAge`.
/// Neither can pass `removalReady`, so showing one grants nothing.
private static let lastReportedPaths: Set<String> = ["none", "legacy"]

/// Display only, where `displayedStatus` returns nil: an older `none` or
/// `legacy` report, which would otherwise vanish after `snapshotMaxAge`
/// and let a denied Mac look healthy. Only the receipt's age is relaxed;
/// the snapshot write must still be at most `snapshotMaxAge` old and every
/// identity guard still applies. Never a removal, enrollment, migration
/// or serving decision.
public static func lastReportedStatus(
_ authorization: ProviderAuthorizationStatus?,
status: String?, writtenAt: Double, receivedAt: Double,
startedAt: Double, now: Double, processMatches: Bool,
coordinatorMatches: Bool
) -> ProviderAuthorizationStatus? {
guard displayedStatus(authorization, status: status, writtenAt: writtenAt, receivedAt: receivedAt,
startedAt: startedAt, now: now, processMatches: processMatches,
coordinatorMatches: coordinatorMatches) == nil,
let live = liveDecision(authorization, status: status, writtenAt: writtenAt,
receivedAt: receivedAt, startedAt: startedAt, now: now,
processMatches: processMatches, coordinatorMatches: coordinatorMatches),
lastReportedPaths.contains(live.path)
else { return nil }
return live
}

/// The latest decision this live process received from the expected
/// coordinator, written by a daemon that is still updating its snapshot.
private static func liveDecision(
Expand Down Expand Up @@ -98,6 +125,26 @@ public enum ProviderAuthorizationReadiness {
return "This coordinator has not enabled App Attest serving; legacy enrollment is still required on older macOS. "
+ ProviderOnboardingPolicy.retirementNotice
}

/// Wording for a `lastReportedStatus` result: the report's age, that it is
/// not a current grant, then what it said. A path outside
/// `lastReportedPaths` reads as unconfirmed.
public static func lastReportedSummary(
_ authorization: ProviderAuthorizationStatus, receivedAt: Double, now: Double,
macOSMajorVersion: Int = ProcessInfo.processInfo.operatingSystemVersion.majorVersion
) -> String {
let reported = lastReportedPaths.contains(authorization.path) ? authorization : nil
return "received \(ageDescription(now - receivedAt)); not a fresh dispatch grant. "
+ summary(reported, removalAuthorization: nil, now: now, macOSMajorVersion: macOSMajorVersion)
}

private static func ageDescription(_ seconds: Double) -> String {
guard seconds.isFinite else { return "at an unknown time" }
let age = max(0, seconds)
if age < 120 { return "\(Int(age))s ago" }
if age < 7200 { return "\(Int(age / 60))m ago" }
return "\(Int(min(age / 3600, 1_000_000)))h ago"
}
}

extension DaemonState {
Expand Down Expand Up @@ -131,6 +178,22 @@ extension DaemonState {
processMatches: matches.process, coordinatorMatches: matches.coordinator)
}

/// For `status`, `doctor` and `verify` when `displayedProviderAuthorization`
/// is nil: an older `none` or `legacy` report as dated history, never a
/// grant (`ProviderAuthorizationReadiness.lastReportedStatus`).
public func lastReportedProviderAuthorization(
coordinatorURL expectedCoordinator: String,
now: Double = Date().timeIntervalSince1970,
readProcessIdentity: (Int32) -> ProcessIdentity? = ProcessIdentity.read
) -> ProviderAuthorizationStatus? {
let matches = snapshotMatches(coordinatorURL: expectedCoordinator, readProcessIdentity: readProcessIdentity)
return ProviderAuthorizationReadiness.lastReportedStatus(
trust?.authorization, status: trust?.status,
writtenAt: writtenAt, receivedAt: trust?.receivedAt ?? 0,
startedAt: startedAt, now: now,
processMatches: matches.process, coordinatorMatches: matches.coordinator)
}

/// Whether this snapshot was written by the still-running daemon process
/// and describes a connection to the expected coordinator.
private func snapshotMatches(
Expand Down
12 changes: 12 additions & 0 deletions provider-swift/Sources/darkbloom/Diagnostics/DoctorRunner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,18 @@ enum DoctorRunner {
}

// ---- Coordinator trust (from the daemon's last trust_status) ----
// When no current decision is shown, an older none/legacy decision is
// history, not a grant: legacy is informational, a denial (none)
// warns, and the trust-level lines below still run unchanged.
// `appAttestAuthorized` stays with the current decision.
if authorization == nil, let state, let trust = state.trust,
let lastReported = state.lastReportedProviderAuthorization(coordinatorURL: coordinatorURL, now: now) {
out.append(Diagnostic(section: .trust, name: "last reported authorization",
level: lastReported.path == "legacy" ? .info : .warn,
message: ProviderAuthorizationReadiness.lastReportedSummary(
lastReported, receivedAt: trust.receivedAt, now: now),
fix: nil))
}
if let authorization {
out.append(Diagnostic(section: .trust, name: "serving authorization",
level: appAttestAuthorized || authorization.path == "legacy" ? .pass : .warn,
Expand Down
12 changes: 12 additions & 0 deletions provider-swift/Sources/darkbloom/DoctorCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,9 @@ func buildCoordinatorDoctorChecks(
let removalAuthorization = state?.currentProviderAuthorization(
coordinatorURL: coordinatorOverride ?? snapshot.config.coordinator.url, now: now)
let appAttestAuthorized = authorization?.hasCurrentAppAttestAuthorization(now: now) == true
// Display only; nil whenever `authorization` is a current decision.
let lastReported = state?.lastReportedProviderAuthorization(
coordinatorURL: coordinatorOverride ?? snapshot.config.coordinator.url, now: now)

let linked = AuthTokenStore.load() != nil
checks.append(.init(
Expand Down Expand Up @@ -428,6 +431,15 @@ func buildCoordinatorDoctorChecks(
authorization, removalAuthorization: removalAuthorization, now: now)))
return checks
}
// An older none/legacy decision is history, not a grant: legacy is
// informational, a denial (none) warns. Either way the public attestation
// identity and proof checks below still run.
if let lastReported, let receivedAt = state?.trust?.receivedAt {
checks.append(.init(name: "last reported authorization",
status: lastReported.path == "legacy" ? .info : .warn,
detail: ProviderAuthorizationReadiness.lastReportedSummary(
lastReported, receivedAt: receivedAt, now: now)))
}

let localSEPublicKey: String
switch resolveDoctorAttestationIdentity(daemonState: DaemonStateFile.read()) {
Expand Down
7 changes: 7 additions & 0 deletions provider-swift/Sources/darkbloom/StatusCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,13 @@ struct Status: AsyncParsableCommand {
print("Authorization: \(ProviderAuthorizationReadiness.summary(authorization, removalAuthorization: removalAuthorization, now: now))")
if !authorization.machineID.isEmpty { print("Machine ID: \(authorization.machineID)") }
} else if let trust = state.trust {
// An older none/legacy decision is history, never a current grant.
if let lastReported = state.lastReportedProviderAuthorization(
coordinatorURL: config.coordinator.url, now: now) {
let summary = ProviderAuthorizationReadiness.lastReportedSummary(
lastReported, receivedAt: trust.receivedAt, now: now)
print("Last reported authorization: \(summary)")
}
let advice = TrustReasonCatalog.advice(level: trust.trustLevel, status: trust.status, reason: trust.reason)
print("Trust: \(trust.trustLevel) / \(trust.status)")
print(" → \(advice.message)")
Expand Down
3 changes: 2 additions & 1 deletion provider-swift/Sources/darkbloom/VerifyCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ struct Verify: AsyncParsableCommand {
print("\(check.status.marker) \(check.name): \(check.detail)")
}

if checks.contains(where: { $0.status != .pass }) {
// An INFO line (an older legacy report) states history and fails nothing.
if checks.contains(where: { $0.status.isFailure(strict: true) }) {
throw ExitCode.failure
}
}
Expand Down
Loading
Loading