Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow to bypass /home/container mount check #42

Merged
merged 5 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading