pterodactyl / panel

Pterodactyl® is a free, open-source game server management panel built with PHP, React, and Go. Designed with security in mind, Pterodactyl runs all game servers in isolated Docker containers while exposing a beautiful and intuitive UI to end users.
https://pterodactyl.io
Other
6.6k stars 1.65k forks source link

INI Parser can't handle "/" in Spaces or spaces with aaa.bbb.ccc #2533

Closed gOOvER closed 2 years ago

gOOvER commented 3 years ago

DO NOT REPORT ISSUES CONFIGURING: SSL, PHP, APACHE, NGINX, YOUR MACHINE, SSH, SFTP, ETC. ON THIS GITHUB TRACKER.

For assistance installating this software, as well as debugging issues with dependencies, please use our discord server: https://discord.gg/pterodactyl

You MUST complete all of the below information when reporting a bug, failure to do so will result in closure of your issue. PLEASE stop spamming our tracker with "bugs" that are not related to this project.

STOP: READ FIRST, AND THEN DELETE THE ABOVE LINES

Background (please complete the following information):

Describe the bug

I have a egg, which the Ini file looks like this:

[UWorks]
ConnectionPort=7777
QueryPort=27015

[/Script/Citadel.SocialManager]
Password=changeme

[/Script/Citadel.RemoteConsole]
WebServerPort=8889
WebServerUsername=admin
WebServerPass=password

[/Script/Citadel.CitadelGameInstance]
WorldCreationSettings=(ServerName="CitadelServer",Password="YourServerPassword",ServerType=PVP,PlayerLimit=20,bPrivate=true,ExperienceMultiplier=1.000000,InventoryCapacityMultipler=1.000000,KnowledgePointEarnedMultiplier=1.000000,CharacterPointEarnedMultiplier=1.000000,bUnlimitedResources=false,PlayerDamageMultiplier=1.000000,ArmorMultiplier=1.000000,BaseManaRegen=1.000000,bInventoryWeightRestrictions=true,MagicFindMultiplier=1.000000,CraftingMagicFindChanceMultiplier=1.000000,FlyingCostMultiplier=1.000000,FlyingSpeedMultiplier=1.000000,ResourceCollectionMultiplier=1.000000,StructureDamageMultiplier=1.000000,bRespectNoBuildZones=true,MagicStructureManaRegenerationMultiplier=1.000000,MagicStructureManaConsumptionMultiplier=0.000000,bFreeBuildMode=false,TimeOfDayLock=Auto,NPCPopulationMultiplier=1.000000,StructureDecayMultiplier=2.000000,bThronesDecay=true)

My Config Parsing Script:

{
    "Config/Game.ini": {
        "parser": "ini",
        "find": {
            "UWorks.ConnectionPort": "{{server.build.default.port}}",
            "UWorks.QueryPort": "{{server.build.env.QPORT}}",
            "/Script/Citadel.SocialManager.Password": "{{server.build.env.ADMIN_PASSWD}}",
            "/Script/Citadel.RemoteConsole.WebServerPort": "{{server.build.env.WEB_SRV_PORT}}",
            "/Script/Citadel.RemoteConsole.WebServerUsername": "{{server.build.env.WEB_SRV_USER}}",
            "/Script/Citadel.RemoteConsole.WebServerPass": "{{server.build.env.WEB_SRV_PW}}"
        }
    }
}

After starting the Server and Parsing runs, i get this as Result:

[/Script/Citadel.SocialManager]
Password=changeme

[/Script/Citadel.CitadelGameInstance]
WorldCreationSettings=(ServerName="CitadelServer",Password="YourServerPassword",ServerType=PVP,PlayerLimit=20,bPrivate=true,ExperienceMultiplier=1.000000,InventoryCapacityMultipler=1.000000,KnowledgePointEarnedMultiplier=1.000000,CharacterPointEarnedMultiplier=1.000000,bUnlimitedResources=false,PlayerDamageMultiplier=1.000000,ArmorMultiplier=1.000000,BaseManaRegen=1.000000,bInventoryWeightRestrictions=true,MagicFindMultiplier=1.000000,CraftingMagicFindChanceMultiplier=1.000000,FlyingCostMultiplier=1.000000,FlyingSpeedMultiplier=1.000000,ResourceCollectionMultiplier=1.000000,StructureDamageMultiplier=1.000000,bRespectNoBuildZones=true,MagicStructureManaRegenerationMultiplier=1.000000,MagicStructureManaConsumptionMultiplier=0.000000,bFreeBuildMode=false,TimeOfDayLock=Auto,NPCPopulationMultiplier=1.000000,StructureDecayMultiplier=2.000000,bThronesDecay=true)

[/Script/Citadel]
SocialManager.Password=mypass
RemoteConsole.WebServerPort=8889
RemoteConsole.WebServerUsername=admin
RemoteConsole.WebServerPass=mypass

It looks like, the Ini parser only search for aaa.bbb insteed aaa.bbb.ccc

To Reproduce Steps to reproduce the behavior:

  1. Use my Dev Egg https://gist.github.com/gOOvER/a90e84869217faa56731639467e9b460

  2. Install and Run the Server

gOOvER commented 3 years ago

i tryed ithis also with escaping the slashes, but Backslashes will removed after saving the Configuration Script

{
    "Config/Game.ini": {
        "parser": "ini",
        "find": {
            "UWorks.ConnectionPort": "{{server.build.default.port}}",
            "UWorks.QueryPort": "{{server.build.env.QPORT}}",
            "\/Script\/Citadel.SocialManager.Password": "{{server.build.env.ADMIN_PASSWD}}",
            "\/Script\/Citadel.RemoteConsole.WebServerPort": "{{server.build.env.WEB_SRV_PORT}}",
            "\/Script\/Citadel.RemoteConsole.WebServerUsername": "{{server.build.env.WEB_SRV_USER}}",
            "\/Script\/Citadel.RemoteConsole.WebServerPass": "{{server.build.env.WEB_SRV_PW}}"
        }
    }
}
matthewpi commented 2 years ago

Before this change putting "find": { "/Script/Engine.GameSession.MaxPlayers": "<DATA>" } would make the section name /Script/Engine and the key GameSession.MaxPlayers. After this change, the same behavior occurs, but if you wrap the key in [] it will set the section name properly, for example "find": { "[/Script/Engine.GameSession].MaxPlayers": "<DATA>" } would make the sesion name /Script/Engine.GameSession and the key MaxPlayers.

TL;DR: in your egg file replacer wrap the section name in [] and the parser will ignore the dots when splitting, if you don't use [] the behavior functions as before. (Once that change is released, if you do this on an older version it will either insert [] into the section name twice, or break entirely)