Scope Keyright Licenses for Staging and Production

Краткое содержание

Pixel shares a migration guide for scoping Keyright licenses to staging and production while keeping one product and code path. It compares product-per-environment and other separation strategies, and highlights a gradual rollout that lets the existing unscoped key keep working as new scoped keys are introduced.

DEV Community

Scoping a Keyright license to an environment: migrating from one key everywhere to a signed staging/production boundary

Watch a single license file long enough and it ends up everywhere. You issue one key for the product, drop it into the production deployment, and within a sprint it has been copied into the staging environment so the pre-prod smoke tests pass, pasted into a developer's appsettings.Development.json, and baked into a CI secret so integration tests can run. Now four environments present the same signed key to your Keyright instance, and three facts you would like to have are gone: you cannot tell from a validation which environment it came from, a staging key that leaks is a production key, and the day you want to expire the staging key early you discover it is the production key. This post is a migration guide. We will compare the three ways teams actually separate environments, pick the one that keeps a single product and a single code path, and move to it on Keyright without a flag day — including the part most rollouts skip, which is letting the old unscoped key keep working while the new scoped keys roll out. Three ways to tell production from staging There are only three shapes for this, and they differ in how much ceremony and how much duplication they cost. A product per environment. Register acme-studio-prod and acme-studio-staging as separate products in your issuing service, each with its own signing key, and ship a different public key per build. It works, and the separation is absolute, but you now maintain two of everything — two key pairs, two entitlement catalogues, two rotation schedules — and a feature you add to one you must remember to add to the other. This is the right answer only when staging and production are genuinely different products with different capabilities, which they rarely are. A bare file per environment, same product. Issue two licenses for the one product and rely on deployment discipline to keep them apart. Nothing in the key says which environment it is for, so nothing stops the staging file from running in production; the moment someone copies the wrong file you are back where you started, and the signed payload is no help because it carries no environment at all. One product, an environment written into the signed payload. Keep a single product and a single public key, and add a scope:env entitlement that names the environment(s) the key is licensed for. The key for staging literally cannot validate as licensed in production, because the app checks its own environment against the claim and the claim is covered by the signature. No second product, no second rotation, one gate. This is the shape we migrate to. What the key says A scope:env entitlement is an ordinary signed entitlement — a string in the canonical payload the signature covers — holding a comma-separated set of environment names the key is valid in. A production key names one environment; a key you want to reuse across your own pre-prod tiers names several. {
"product": "acme-studio",
"licensee": "Contoso Ltd",
"expiryUtc": "2027-11-16T00:00:00Z",
"tier": "pro",
"entitlements": {
"scope:env": "production",
"export": "true",
"max-seats": "400"
},
"signature": "…"
}
The scope: prefix is a convention, not a Keyright feature, and it earns its keep the same way site: does: it keeps where this key may run visibly separate from what this key unlocks, so nobody later gates the export feature on an environment or vice versa. Because the value is inside the signed payload, a customer — or a developer in a hurry — can no more change production to staging than they can push the expiry out a year: one changed byte and the app sees LicenseStatus.SignatureInvalid. What the app knows about its own environment The app has to answer "which environment am I?" from its own configuration, offline, at startup. In an ASP.NET Core or generic-host app the answer already exists: IHostEnvironment.EnvironmentName, which the host resolves from DOTNET_ENVIRONMENT (or ASPNETCORE_ENVIRONMENT for the web host), de...
Scope Keyright Licenses for Staging and Production
Powered by Readybot.io

Последнее от Pixel

Incident Response: Look Beyond the Red Alert

Pixel’s DEV Community announcement explores how teams can fixate on one failing service while overlooking the real cause of an outage, such as a full …

Sach: AI Fact-Checks WhatsApp Forwards in India

Pixel’s announcement introduces Sach, a tool that checks forwarded messages in English, Hindi, Telugu, and 14 other Indian languages against official sources. It gives cited …

Java 25 Removes SecurityManager: What to Fix

Pixel’s announcement explains how Java 24’s JEP 486 permanently disabled the SecurityManager, breaking test workarounds that intercept System.exit. It recommends returning exit codes or throwing …

Why a Java HPA Got Stuck at 20 Kubernetes Pods

Pixel shares how a Spring Boot pricing service autoscaled to 20 Kubernetes pods and stayed there because the JVM retained committed heap memory after traffic …