Skip to content

v8.0.0

Latest

Choose a tag to compare

@Ahoo-Wang Ahoo-Wang released this 26 Nov 04:39
1550ffa

CoSec 8.0 is a new design of the authorization framework for multi-tenant applications, released after four alphas,
nine betas and two release candidates. These notes are for teams on CoSec 7.x. A deployment on an 8.0 pre-release
reads "From 8.0.0-rc.2" at the end.

Getting it

implementation(platform("me.ahoo.cosec:cosec-bom:8.0.0"))
npm install @ahoo-wang/cosec-fetcher @ahoo-wang/cosec-react
docker pull ghcr.io/ahoo-wang/cosec-gateway:8.0.0
docker pull ghcr.io/ahoo-wang/cosec-control:8.0.0

Kotlin 2.x on Java 21, Spring Boot 4.2, CoCache 8.2. The images publish no latest: latest stays the newest 7.x
release, so a 7.x gateway pulled again never comes back as 8.0. Pin a version or a digest.

What 8.0 is

  • Policies are data. Platform, app and tenant snapshot documents (schema: 2) in Redis, compiled into indexes.
    Conditions are a typed AST checked when a document is compiled: no OGNL, no SpEL, no matcher plugins.
  • Deny-first, fail closed. A matching DENY decides, whatever document either statement comes from. A failing DENY,
    an unreadable document or a slow dependency never permits. Outcomes and status codes come from one decision path, so
    every adapter answers alike.
  • One coroutine pipeline behind the WebFlux, Web MVC and Spring Cloud Gateway adapters, and a gateway image
    (cosec-gateway) that decides at the edge and forwards the verified identity to the services behind it.
  • A control plane (cosec-control, or embedded in your IAM service), the only writer of documents: a change is
    validated, compiled, shadowed against live traffic and approved before it publishes, and every write is itself
    authorized and audited.
  • Tests of your own. cosec-testkit runs policy scenarios and makes the security context a handler reads.
  • A TypeScript client. @ahoo-wang/cosec-fetcher and @ahoo-wang/cosec-react, released with CoSec at its
    version, on fetcher 6.1.x or fetcher 8.

What is promised from here

  • Semantic versioning applies from 8.0.0. A public API, a cosec.* property or an authorization semantic is
    removed or changed only in a major release; each published module's public ABI is held to a dump.
  • Two adjacent minor versions of 8.x run mixed, whichever is upgraded first, and a rollback of one minor version is
    supported (What is promised).
  • What stays experimental in 8.0 says so and may change in a minor release: building a pipeline without Spring
    (Pipeline.builder), SnapshotDocumentStore, the kit's policy and pipeline tests, cosec-control-sdk with
    HttpControlService, and the evaluation trace
    (Stability levels).
  • 7.x gets security and critical fixes until 2027-05-26, six months from this release; release/6.1.x gets
    security fixes only.

Upgrading from 7.x

Read Upgrading: a checklist, then every change by area.
cosec-migrate converts the 7.x data once. What an integrator meets:

  • Modules. The starter is cosec-spring-boot, and capabilities are modules you add. cosec-core is split into
    cosec-spi, cosec-runtime and cosec-login, and packages moved. CoSec no longer brings CosId (IdGenerator),
    and no Jackson type is in a public signature.
  • Removed and replaced. Authorization, SecurityPipeline and the decorator chain (tracing, metrics, rate
    limiting, shadow); the policy and permission model with its matchers, OGNL and SpEL; RequestAttributesAppender
    (now AttributeProvider); CoSecAuthorizationCustomizer (now beans of the SPIs); the OpenAPI generators (now route
    maps).
  • Login and tokens. Credentials is LoginCredentials; Mono becomes suspend; TokenSubject replaces the
    principal wrappers and declares whose a credential is (kind); token revocation is always on (TokenStore,
    RevocationReader), and a TokenAuthenticator you build states whether a token is accepted while revocations
    cannot be read; a tenant switch presents the session's token pair.
  • API keys. ApiKeyStore is removed; records are of format 3, and memberships decide.
  • Identity propagation replaces inject mode.
  • Security-context readers are requireSecurityContext() and securityContextOrNull().
  • Social login. SocialUserConverter is SocialUserPrincipalConverter. A social provider of your own has no 8.0
    home (JustAuth's providers only); one is planned for 8.1.
  • Audit. Records name via, document, policy and statement. ALLOW is PERMIT in decision and
    reasonCode: a SIEM rule that matches "ALLOW" matches nothing and says nothing, so change it. Metric tags and span
    names changed too, and the audit sets may gain a member in a minor release: accept a value you do not know.
  • Properties. Renamed and removed (the table is in Upgrading); a key CoSec does not read fails startup, naming it.
  • The front end. @ahoo-wang/fetcher-cosec and the security hooks of @ahoo-wang/fetcher-react are replaced by
    @ahoo-wang/cosec-fetcher and @ahoo-wang/cosec-react
    (Building a client). Fetcher 8, released today, is fetcher 6.1 without
    its CoSec package; an application whose server still runs CoSec 7.x stays on fetcher 6.x.

How CoSec checks itself

  • Every normative rule has an id and the tests that guard it: 382 rules, one file each, and a build that fails
    when a rule loses its guards.
  • Mutants. Each security property is broken on purpose by a patch, and a test must fail and pass again once the
    patch is reverted; a verdict counts only when the patched code was compiled.
  • Two versions are tested against each other, in one JVM and over the network: the previous release, as
    published, beside the build, one rule per format they exchange.
  • The system test: the gateway image built from the commit, services behind it, the control plane in both of its
    deployments, Redis and Kafka, driven over the network only, and the manifests on Kubernetes.
  • A real project ran the candidates. It upgraded to beta.9 and to rc.1 on its main branch; the one defect it found
    in CoSec was fixed in rc.1, and its upgrade to rc.1 found none.
  • This release's gates. On the tagged commit: CI, with the client's tests on fetcher 6.1 and on fetcher 8.0.0;
    the system test in both deployments of the control plane and on Kubernetes; the system test with 8.0.0-rc.2's
    gateway and control-plane images in front of this build's services; no open code-scanning or dependency alert.
    On the release pull request's head, whose tree is the tagged commit's: the full mutation check (every mutant
    killed) and a million cases of each property test.

From 8.0.0-rc.2

Nothing to do: 8.0.0 is rc.2 with its version. No main source of a JVM module changed since rc.1, and no public
signature, property, format or decision. Install the npm packages without a tag. From 8.0.0-rc.1 there is one more
change, and it needs no action: the two npm packages also accept fetcher 8. The notes between the 8.0 pre-releases are
kept as they stood at the last candidate
(Upgrading between 8.0 previews, as of 8.0.0-rc.2).

Full changelog: v7.0.2...v8.0.0