Dynamic /.well-known discovery responses are marked publicly cacheable for one year
Description
Impact
ResourceCacheControlFilter (mapped to /* in web.xml) was written for the UI's static files. It disables caching only for URLs containing /apis/, version.js, config.js or /.well-known/agents; every other response gets Cache-Control: public, max-age=31536000 and an Expires one year ahead.
That includes the dynamic discovery endpoints under /.well-known that are not /.well-known/agents:
POST /.well-known/ard/search,GET /.well-known/ard.json,/.well-known/ard/agents,/.well-known/ard/exploreGET /.well-known/ai-catalog.jsonGET /.well-known/mcp-tools,/.well-known/mcp-tools/{groupId}/{artifactId}and its/compatibleand/compatibilitysub-resourcesGET /.well-known/agent.json,/.well-known/agent-card.json,/.well-known/schemas/...
These responses depend on the caller: authentication, role-based and per-resource authorization (grants), and the agent visibility label filter them. With a shared cache (reverse proxy, CDN, corporate proxy) in front of the registry, one caller's filtered results can be served to another caller, including an unauthenticated one, and results stay stale for up to a year after artifacts change or access is revoked.
Reproducer (any registry with apicurio.features.experimental.enabled=true, apicurio.ard.enabled=true, apicurio.mcp-tools.enabled=true):
curl -s -D - -o /dev/null -X POST -H 'Content-Type: application/json' -d '{"query":{"text":"x"}}' http://localhost:8080/.well-known/ard/search | grep -i cache
# Cache-control: public, max-age=31536000
curl -s -D - -o /dev/null 'http://localhost:8080/.well-known/mcp-tools?name=x' | grep -i cache
# Cache-control: public, max-age=31536000/.well-known/agents itself answers no-cache, no-store, must-revalidate.
Only deployments that enable the experimental agent features (A2A, MCP tools, AI Catalog, ARD), which are off by default, and that put a shared HTTP cache in front of the registry are exposed. Clients that honour caching (for example Gatling, browsers) also keep serving stale results to the same user.
Patches
Fixed on main by github.com//.well-known/, as already done for /.well-known/agents. The fix will be in the next release.
Workarounds
Configure the reverse proxy or CDN not to cache /.well-known/*, or override Cache-Control there.
Found
While building the agent registry scale baseline (#11093): a load generator that honours HTTP caching stopped sending ARD and MCP tool search requests after the first response for each URL.