Repository navigation
Description
Why?
The only uniqueness constraint on registered services is the unique index on id, and POST /services generates a new random id on every call. The same deployment can therefore be registered any number of times, by the same or by different users. With ownership (#62), every copy has its own owner. This confuses users of the registry and breaks consumers that use it as a list of backends (e.g., elixir-cloud-aai/protes#202 would see the same TES twice).
How?
A service is identified by its base URL (url: "the URL to which all endpoints should be relative") and its API type:
- Key: normalized
urlplustype.groupandtype.artifact(case-insensitive). Nottype.version: upgrading a service to a new API version updates its entry. The API type covers the rare case of several APIs under the same base URL. - URL normalization: lowercase scheme and host, remove the default port (443 for
https, 80 forhttp), the trailing slash, query and fragment. Reject URLs with user info (user:password@). - Storage: an internal field with the key, computed on every write (
POST,PUT) and excluded from responses (like_id), with a unique index inconfig.yaml. - Conflicts:
POST /services, or aPUTthat changes the URL or type to a key that exists for another service, returns409 Conflict. The problem details name theidof the existing service, so that the user can contact its owner or an admin. - Existing data: if a deployment keeps data from before this change, creating the index fails while duplicates exist. Document how to find them (e.g., an aggregation on the normalized key) and resolve them before upgrading.
- Documentation: README and API description, including the squatting risk below.
- Tests: spelling variants of the same URL (case, default port, trailing slash) conflict; different types under the same URL and different URLs don't;
PUTof a service onto another service's key conflicts;PUTof a service with unchanged key succeeds.
Squatting risk (to document): anyone logged in can register a URL first, including a URL of a deployment they don't operate, and thereby block its real operator, who would get 409. The squatter would own that entry. Mitigations: admins can delete such entries or reassign their owners (#62); the admin-set "verified" flag (#64) lets consumers rely only on entries checked by admins. Proving control of the URL (e.g., by fetching {url}/service-info at registration) was considered and rejected: the service-info id is self-declared, and fetching user-supplied URLs from the registry would allow server-side request forgery.
Acceptance criteria
- The same service (same normalized URL and API type) cannot be registered twice; the response is
409and names the existing entry. - Spelling variants of a URL are detected as the same service.
- The squatting risk and how admins handle it are documented.
Dependencies: #62 (ownership, admins). Related: #64 (verified flag), elixir-cloud-aai/generic-issues#29 (registrations by operators). The UI should show the conflict message (tracked in cloud-registry-ui).
Activity