mirror of
https://github.com/amir20/dozzle.git
synced 2026-01-04 20:14:59 +01:00
chore: improves security by updating all find containers with user scope (#3464)
This commit is contained in:
@@ -22,7 +22,7 @@ func NewAgentService(client *agent.Client) ClientService {
|
||||
}
|
||||
}
|
||||
|
||||
func (a *agentService) FindContainer(ctx context.Context, id string) (docker.Container, error) {
|
||||
func (a *agentService) FindContainer(ctx context.Context, id string, filter docker.ContainerFilter) (docker.Container, error) {
|
||||
return a.client.FindContainer(ctx, id)
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
)
|
||||
|
||||
type ClientService interface {
|
||||
FindContainer(ctx context.Context, id string) (docker.Container, error)
|
||||
FindContainer(ctx context.Context, id string, filter docker.ContainerFilter) (docker.Container, error)
|
||||
ListContainers(ctx context.Context, filter docker.ContainerFilter) ([]docker.Container, error)
|
||||
Host(ctx context.Context) (docker.Host, error)
|
||||
ContainerAction(ctx context.Context, container docker.Container, action docker.ContainerAction) error
|
||||
@@ -70,8 +70,8 @@ func (d *dockerClientService) StreamLogs(ctx context.Context, container docker.C
|
||||
}
|
||||
}
|
||||
|
||||
func (d *dockerClientService) FindContainer(ctx context.Context, id string) (docker.Container, error) {
|
||||
return d.store.FindContainer(id)
|
||||
func (d *dockerClientService) FindContainer(ctx context.Context, id string, filter docker.ContainerFilter) (docker.Container, error) {
|
||||
return d.store.FindContainer(id, filter)
|
||||
}
|
||||
|
||||
func (d *dockerClientService) ContainerAction(ctx context.Context, container docker.Container, action docker.ContainerAction) error {
|
||||
|
||||
@@ -43,14 +43,14 @@ func NewMultiHostService(manager ClientManager, timeout time.Duration) *MultiHos
|
||||
return m
|
||||
}
|
||||
|
||||
func (m *MultiHostService) FindContainer(host string, id string) (*containerService, error) {
|
||||
func (m *MultiHostService) FindContainer(host string, id string, filter docker.ContainerFilter) (*containerService, error) {
|
||||
client, ok := m.manager.Find(host)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("host %s not found", host)
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), m.timeout)
|
||||
defer cancel()
|
||||
container, err := client.FindContainer(ctx, id)
|
||||
container, err := client.FindContainer(ctx, id, filter)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user