public final class GspRuntime extends Object
Replaces the former TSQLEnv.usedBySqlflow guard, which was a
private boolean a host set by reflection: anyone who read the bytecode knew
the secret, and the failure mode for everyone else was silently wrong
results. This is a signed, expiring, revocable, auditable grant instead.
GspActivation result = GspRuntime.activate(Files.readAllBytes(path));
if (!result.isValid()) {
throw new IllegalStateException("GSP entitlement rejected: "
+ result.reasonCode() + " audit=" + result.auditId());
}
Activate once per process, before the service reports ready, and treat failure as a startup failure rather than a per-request one.
There is deliberately no setActivated(true). The only way
to reach GspActivationStatus.ACTIVE is to present bytes carrying a
valid signature from a private key this build does not contain.
activate performs full verification and reports an accurate
verdict. Nothing yet refuses to produce results when the runtime is not
activated — wiring enforcement into the result-producing entry points is
the next step. Until then this API is observable but not enforcing, and
saying otherwise would overstate what the jar protects.
| Modifier and Type | Method and Description |
|---|---|
static GspActivation |
activate(byte[] signedEntitlement)
Verifies a signed entitlement and records the outcome.
|
static GspActivation |
activationStatus()
The current activation, re-evaluated for expiry.
|
static boolean |
isActivated()
Whether this runtime currently holds a valid entitlement.
|
static boolean |
isEnforcementEnabled()
Whether this build refuses to produce results without an entitlement.
|
static void |
requireActivated()
Refuses to continue when an entitlement-gated build is not activated.
|
public static GspActivation activate(byte[] signedEntitlement)
Every refusal is logged at ERROR with a greppable marker and an audit id matching the returned object. That pairing is a condition of the agreed design: a covert refusal is only acceptable when an operator can still find out why from the host's own logs.
signedEntitlement - compact JWS bytes; null or empty yields
GspActivationStatus.MISSINGpublic static boolean isActivated()
Re-checks expiry on every call, so a long-running process does not
stay activated past exp just because it started before it.
public static GspActivation activationStatus()
GspActivationStatus.MISSING before any
activate(byte[]) callpublic static boolean isEnforcementEnabled()
False for the ordinary jars, so this whole mechanism is invisible to existing users. True only for a build that shipped the marker.
Honest about its limits: a marker on the classpath raises the cost of removing the check, it is not a security boundary. An attacker who controls the JVM can strip it, just as they could patch the check out of the bytecode. Obfuscation and this marker buy cost, not impossibility.
public static void requireActivated()
Called from the result-producing entry points. On a build without the marker this is a cheap no-op.
GspNotActivatedException - explicitly, rather than degrading the
result — see that class for why covert failure was rejected