cozystack/packages/apps
Aleksei Sviridkin 8b7813fdeb
[platform] Add DNS-1035 validation for Application names (#1771)
## What this PR does

Add DNS-1035 validation for Application names to prevent creation of
resources with invalid names that would fail Kubernetes resource
creation.

### Changes

- Add `ValidateApplicationName()` function using standard
`IsDNS1035Label` from `k8s.io/apimachinery`
- Call validation in REST API `Create()` method (skipped on `Update` —
names are immutable)
- Add name length validation: `prefix + name` must fit within Helm
release name limit (53 chars)
- Remove rootHost-based length validation — the underlying label limit
issue is tracked in #2002
- Remove `parseRootHostFromSecret` and `cozystack-values` Secret reading
at API server startup
- Add unit tests for both DNS-1035 format and length validation

### DNS-1035 Requirements

- Start with a lowercase letter `[a-z]`
- Contain only lowercase alphanumeric or hyphens `[-a-z0-9]`
- End with an alphanumeric character `[a-z0-9]`

Fixes #1538
Closes #2001

### Release note

```release-note
[platform] Add DNS-1035 validation for Application names to prevent invalid tenant names
```

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* Enforced DNS-1035 name format and Helm-compatible length limits for
applications during creation; name constraints surfaced early and
reflected in API validation.

* **Documentation**
* Updated tenant naming rules to DNS-1035, clarified hyphen guidance,
and noted maximum length considerations.

* **Tests**
* Added comprehensive tests covering format and length validation,
including many invalid and boundary cases.

* **API**
* OpenAPI/Swagger schemas updated to include name pattern and max-length
validation.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-02-17 14:33:02 +03:00
..
bucket refactor: move scripts to hack directory 2026-01-15 16:06:56 +01:00
clickhouse refactor: move scripts to hack directory 2026-01-15 16:06:56 +01:00
foundationdb refactor: move scripts to hack directory 2026-01-15 16:06:56 +01:00
http-cache Prepare release v1.0.0-alpha.2 2026-01-20 07:50:59 +00:00
kafka refactor: move scripts to hack directory 2026-01-15 16:06:56 +01:00
kubernetes Prepare release v1.0.0-beta.4 2026-02-14 09:17:24 +00:00
mariadb feat(platform): add migration 27 to rename mysql resources to mariadb 2026-02-12 15:16:29 +01:00
mongodb fix(mongodb): update MongoDB logo 2026-02-10 21:17:50 +01:00
nats refactor: move scripts to hack directory 2026-01-15 16:06:56 +01:00
postgres refactor: move scripts to hack directory 2026-01-15 16:06:56 +01:00
qdrant [qdrant] Add Qdrant vector database application 2026-02-06 13:30:58 +03:00
rabbitmq refactor: move scripts to hack directory 2026-01-15 16:06:56 +01:00
redis refactor: move scripts to hack directory 2026-01-15 16:06:56 +01:00
tcp-balancer refactor: move scripts to hack directory 2026-01-15 16:06:56 +01:00
tenant [platform] Add DNS-1035 validation for Application names (#1771) 2026-02-17 14:33:02 +03:00
vm-disk refactor: move scripts to hack directory 2026-01-15 16:06:56 +01:00
vm-instance feat(vm-instance): port cpuModel, instancetype switching, and runStrategy changes 2026-02-14 03:02:41 +01:00
vpc feat(vpc): migrate subnets definition from map to array format 2026-02-15 21:34:19 +01:00
vpn refactor: move scripts to hack directory 2026-01-15 16:06:56 +01:00
Makefile refactor: move scripts to hack directory 2026-01-15 16:06:56 +01:00
README.md [clickhouse] add clickhouse keeper 2025-08-07 14:07:05 +03:00

How to test packages local

cd packages/core/installer
make image-cozystack REGISTRY=YOUR_CUSTOM_REGISTRY
make apply
kubectl delete po -l app=source-controller -n cozy-fluxcd