Skip to content

Commit

Permalink
allow to bypass /home/container mount check (#42)
Browse files Browse the repository at this point in the history
* allow to bypass this check

* upercase

* other var names

* config is lowercase

* use HasPrefix
  • Loading branch information
QuintenQVD0 authored Sep 27, 2024
1 parent e5e1de5 commit 4e7c207
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,11 @@ type Configuration struct {
// This is required to have the "Server Mounts" feature work properly.
AllowedMounts []string `json:"-" yaml:"allowed_mounts"`

// BlockBaseDirMount indicates whether mounting to /home/container is blocked.
// If true, mounting to /home/container is blocked.
// If false, mounting to /home/container is allowed.
BlockBaseDirMount bool `default:"true" json:"-" yaml:"BlockBaseDirMount"`

// AllowedOrigins is a list of allowed request origins.
// The Panel URL is automatically allowed, this is only needed for adding
// additional origins.
Expand Down
4 changes: 2 additions & 2 deletions server/mounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ func (s *Server) customMounts() []environment.Mount {
}

// Check if the target path includes /home/container
if strings.Contains(target, "/home/container") {
logger.WithField("invalid_target_path", target).Warn("skipping custom server mount, target path includes /home/container")
if strings.HasPrefix(target, "/home/container") && config.Get().BlockBaseDirMount {
logger.WithField("invalid_target_path", target).Warn("Skipping custom server mount; target path includes /home/container")
continue
}

Expand Down

0 comments on commit 4e7c207

Please sign in to comment.