fix: reject app-level vector-networks and vector-image, drop bridge from joined nets

The Docker daemon refuses any endpoint settings on the default bridge network and `docker compose` unconditionally attaches the service name as an alias on every joined network, so combining bridge with user-defined networks via compose's `networks:` block is impossible. When `vector-networks` is set, the compose template now joins only the configured networks; outbound to external sinks still works through user-defined network NAT. Additionally, `vector-image` and `vector-networks` are both global-only but `common.CommandPropertySet` silently accepts them at app level by merging global-only keys into the valid-property set, so both now reject explicitly in `validateSetValue`.
This commit is contained in:
Jose Diaz-Gonzalez
2026-05-12 23:45:10 -04:00
parent d00a7d741a
commit a4e6d06fd1
4 changed files with 33 additions and 10 deletions

View File

@@ -14,6 +14,10 @@ func validateSetValue(appName string, key string, value string) error {
return validateMaxSize(appName, value)
}
if key == "vector-image" {
return validateVectorImage(appName, value)
}
if key == "vector-networks" {
return validateVectorNetworks(appName, value)
}
@@ -64,7 +68,19 @@ func validateVectorSink(appName string, value string) error {
return nil
}
func validateVectorImage(appName string, value string) error {
if appName != "--global" {
return errors.New("vector-image may only be set globally with --global")
}
return nil
}
func validateVectorNetworks(appName string, value string) error {
if appName != "--global" {
return errors.New("vector-networks may only be set globally with --global")
}
if value == "" {
return nil
}
@@ -76,7 +92,7 @@ func validateVectorNetworks(appName string, value string) error {
}
if name == "bridge" {
return errors.New("Invalid vector-networks value, \"bridge\" is attached by default and must not be listed")
return errors.New("Invalid vector-networks value, \"bridge\" is not a valid entry for vector-networks")
}
result, err := common.CallExecCommand(common.ExecCommandInput{

View File

@@ -15,7 +15,6 @@ services:
{{- if $.VectorNetworks }}
networks:
bridge: {}
{{- range $name := $.VectorNetworks }}
{{ $name }}: {}
{{- end }}
@@ -32,9 +31,6 @@ services:
{{- if $.VectorNetworks }}
networks:
bridge:
name: bridge
external: true
{{- range $name := $.VectorNetworks }}
{{ $name }}:
name: {{ $name }}