Security
The arch repo service protects its endpoints with two different mechanisms, on two different filter chains. Which one applies depends only on the path.
| Path | Chain | Authentication | Authorization |
|---|---|---|---|
/api/** | WebSecurityConfig.apiSecurityFilterChain, @Order(100) | HTTP basic, one shared technical user | A role for writing endpoints; several read endpoints are public |
everything else, i.e. /external-api/** and /docs-api/** | the jEAP security starter's resource-server chain, ordered last | OAuth2 bearer token | Semantic roles, checked per endpoint |
With the optional MCP server module, a third chain sits between the two: the jEAP MCP starter's chain for
/mcp and the protected resource metadata at /.well-known/oauth-protected-resource, ordered at
LOWEST_PRECEDENCE - 100. It authenticates with an OAuth2 bearer token like the jEAP chain, but statelessly and
without CSRF protection, since MCP clients only send a bearer token and expect a 401 challenge to start their OAuth
flow. Neither of the other two chains is changed by it.
For now the MCP tools are open, by team decision: the module sets jeap.mcp.security.anonymous-access: true, so
requests without a token reach the tools, which permit every caller. Most of what they serve is public below anyway
(the model, relations, REST endpoints, OpenAPI specs); get_data_models, however, serves the table structures of the
database schemas, which /external-api/dbschemas and the docs API only serve with a role. A token that is present is
still validated. With jeap.mcp.security.anonymous-access: false, all tools require the semantic role
architecture-model / read. See MCP server.
Two POSTs are cut out of the basic-auth chain when they carry a bearer token, so that a pushing pipeline can use
whichever credential it has - but only one of them really accepts both:
POST /api/openapi/**accepts either.OpenApiControllerchecks the semantic role programmatically, guarded byauthentication instanceof JeapAuthenticationToken, so a caller authenticated with basic auth skips the role check entirely.POST /api/dbschemasis annotated@PreAuthorize("hasRole('database-schema', 'write')"). The two-argumenthasRoleonly resolves on the expression root the jEAP starter builds for aJeapAuthenticationToken, so basic credentials pass the filter chain but cannot satisfy the method-security check. In practice this endpoint needs a bearer token.
HTTP basic on /api/**
archrepo.api.secret is the password of a single in-memory user holding the role api; the username defaults to
archrepo-admin and can be overridden via archrepo.api.username. Requests to /api/** that are not explicitly
permitted need it.
These endpoints are deliberately public, because they are read-only inventory queries consumed by dashboards:
GET /api/model,GET /api/model/{system}/relations,GET /api/model/exportGET /api/model/rest-api-relation-without-pact,GET /api/model/system-components-without-open-api-specGET /api/dbschemas/**,GET /api/openapi/**
Everything else under /api/** requires the basic credentials.
The YAML export includes all team contact addresses and links as well as system metadata, without authentication.
The chain also permits
GET /api/reactions/**, but no controller serves that path - it is a leftover matcher from an endpoint that no longer exists.
OAuth2 and semantic roles
Outside /api/**, the jEAP security starter's chain applies: the request must carry a valid bearer token
(anyRequest().fullyAuthenticated()), so an anonymous call is rejected with 401 before it reaches a controller.
The endpoint then checks a semantic role with @PreAuthorize, and a token without it is rejected with 403.
A semantic role resolves to <system-name>_@<resource>_#<operation>, where <system-name> is
jeap.security.oauth2.resourceserver.system-name.
| Resource | Operation | Protects |
|---|---|---|
openapidoc | write | Pushing an OpenAPI spec, when authenticated with a bearer token |
database-schema | write | Pushing a database schema |
external-database-schema | read | Reading a database schema over /external-api/dbschemas |
architecture-model | read | Every resource of the docs API. There is no public and no merely authenticated resource under /docs-api. Also every tool of the optional MCP server, once jeap.mcp.security.anonymous-access is false |
So an instance whose system-name is my-system grants its pushing pipeline
my-system_@openapidoc_#write and my-system_@database-schema_#write.
system-name is required
Semantic authorization is only active when jeap.security.oauth2.resourceserver.system-name is set. Without it
the starter falls back to a simple expression handler that does not know the two-argument hasRole(resource, operation) form at all, and every annotated endpoint fails to evaluate its expression.
Because the docs API authorizes every one of its resources with a semantic role, the service refuses to start when the property is missing, rather than leaving an endpoint that fails on first use. Every instance has to set it.
Read replicas
The read-only endpoints of the service are annotated @TransactionalReadReplica from jeap-spring-boot-tx
rather than @Transactional(readOnly = true). On an instance configured with an AWS read replica
(jeap.datasource.replica.enabled=true) their transactions are routed there and relieve the writer; without one
the annotation resolves to the ordinary transaction manager, so nothing changes.
Reads from a replica are eventually consistent, which is why only endpoints that tolerate a short staleness window
carry the annotation - and why none of them writes. The docs API is deliberately free of writes for
that reason: the content hash it serves as an entity tag is written when an artifact is stored, and for artifacts
predating the column by the V2_6_0 migration, never by a request.
GET /api/model/export deliberately uses an ordinary primary transaction instead: bootstrap must include
recently written systems and teams before configuration becomes authoritative.
Related
- Docs API - the API that requires the
architecture-modelrole - MCP server - the tools for AI agents, open for now, or with the same role
- Configuration - where the properties live
- API - which endpoint sits behind which mechanism
- Getting started - the minimal instance configuration
- Operations - the endpoints the basic credentials are actually used for