Skip to content

Commit

Permalink
allow to bypass this check
Browse files Browse the repository at this point in the history
  • Loading branch information
QuintenQVD0 authored Sep 14, 2024
1 parent 7c9ca52 commit 02b4b0b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,10 @@ type Configuration struct {
// This is required to have the "Server Mounts" feature work properly.
AllowedMounts []string `json:"-" yaml:"allowed_mounts"`

// Check if you are allowed to mount to a sub dir of /home/container
// Default false as this is bad practise but some people want to do this.
AllowBaseDirMount bool `default:"false" json:"-" yaml:"AllowBaseDirMount"`

// AllowedOrigins is a list of allowed request origins.
// The Panel URL is automatically allowed, this is only needed for adding
// additional origins.
Expand Down
5 changes: 3 additions & 2 deletions server/mounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@ 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")
// check can be disabled with the AllowBaseDirMount config value
if strings.Contains(target, "/home/container") && config.get().AllowBaseDirMount == false {

Check failure on line 70 in server/mounts.go

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu-22.04, 1.21.9, linux, amd64)

undefined: config.get

Check failure on line 70 in server/mounts.go

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu-22.04, 1.21.9, linux, arm64)

undefined: config.get

Check failure on line 70 in server/mounts.go

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu-22.04, 1.22.2, linux, amd64)

undefined: config.get

Check failure on line 70 in server/mounts.go

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu-22.04, 1.22.2, linux, arm64)

undefined: config.get
logger.WithField("invalid_target_path", target).Warn("Skipping custom server mount; target path includes /home/container")
continue
}

Expand Down

0 comments on commit 02b4b0b

Please sign in to comment.