Fix declared server config file reads
This commit is contained in:
@@ -1949,7 +1949,7 @@ func validatePluginFileWorkspace(prefix string, workspace domain.PluginFileWorks
|
||||
}
|
||||
for i, item := range workspace.Files {
|
||||
field := fmt.Sprintf("%s.files[%d]", prefix, i)
|
||||
if !validDistributionLogicalKey(item.Key) || !directories[item.DirectoryKey] || item.Label == "" || !oneOf(item.Kind, "config", "log") || (item.Kind == "log" && item.StreamKey == "") {
|
||||
if !validDistributionLogicalKey(item.Key) || !directories[item.DirectoryKey] || item.Label == "" || !oneOf(item.Kind, "config", "log") || (item.Kind == "log" && item.StreamKey == "") || (item.TargetKey != "" && len(validateSafeRelativeRuntimePath(field+".targetKey", item.TargetKey)) > 0) {
|
||||
violations = append(violations, field+" is invalid")
|
||||
}
|
||||
if _, exists := files[item.Key]; exists {
|
||||
|
||||
@@ -47,6 +47,11 @@ func TestValidateGamePluginManifestRegistrationValidatesLogicalFileWorkspace(t *
|
||||
if err := ValidateGamePluginManifestRegistration(registration); err != nil {
|
||||
t.Fatalf("expected safe logical file workspace: %v", err)
|
||||
}
|
||||
registration.Manifest.FileWorkspace.Files[0].TargetKey = "../server-settings.ini"
|
||||
if err := ValidateGamePluginManifestRegistration(registration); err == nil {
|
||||
t.Fatal("expected unsafe file target reference to fail")
|
||||
}
|
||||
registration.Manifest.FileWorkspace.Files[0].TargetKey = "SCUM/Saved/Config/WindowsServer/ServerSettings.ini"
|
||||
registration.Manifest.FileWorkspace.Files[0].DirectoryKey = "../host"
|
||||
if err := ValidateGamePluginManifestRegistration(registration); err == nil {
|
||||
t.Fatal("expected unsafe logical directory reference to fail")
|
||||
|
||||
Reference in New Issue
Block a user