Skip to content

Commit fbfc60e

Browse files
committed
fix: prevent user ingresses from shadowing API hostname
Add validation to reject ingress creation when the hostname matches the configured API_HOSTNAME. This prevents users from hijacking API traffic by creating an ingress with the same hostname.
1 parent 9d9554c commit fbfc60e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/ingress/manager.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,12 @@ func (m *manager) Create(ctx context.Context, req CreateIngressRequest) (*Ingres
323323

324324
for _, rule := range req.Rules {
325325
newPort := rule.Match.GetPort()
326+
327+
// Check if hostname conflicts with API hostname (reserved for Hypeman API)
328+
if m.config.APIIngress.IsEnabled() && rule.Match.Hostname == m.config.APIIngress.Hostname {
329+
return nil, fmt.Errorf("%w: hostname %q is reserved for the Hypeman API", ErrHostnameInUse, rule.Match.Hostname)
330+
}
331+
326332
for _, existing := range existingIngresses {
327333
for _, existingRule := range existing.Rules {
328334
existingPort := existingRule.Match.GetPort()

0 commit comments

Comments
 (0)