{"id":22529543,"url":"https://github.com/elrygh/secure-godot","last_synced_at":"2025-03-28T04:44:26.242Z","repository":{"id":265155891,"uuid":"895298253","full_name":"ElryGH/Secure-Godot","owner":"ElryGH","description":"Make Godot Builds more secure by stripping the debug arguments","archived":false,"fork":false,"pushed_at":"2024-11-28T00:26:10.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-02T05:42:06.792Z","etag":null,"topics":["godot","godot-engine","security-tools"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ElryGH.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-28T00:06:50.000Z","updated_at":"2024-12-14T11:11:20.000Z","dependencies_parsed_at":"2024-11-28T01:26:21.100Z","dependency_job_id":"543db944-7ebe-404f-a016-38398884ddac","html_url":"https://github.com/ElryGH/Secure-Godot","commit_stats":null,"previous_names":["elrygh/secure-godot"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElryGH%2FSecure-Godot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElryGH%2FSecure-Godot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElryGH%2FSecure-Godot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElryGH%2FSecure-Godot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ElryGH","download_url":"https://codeload.github.com/ElryGH/Secure-Godot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245972669,"owners_count":20702720,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["godot","godot-engine","security-tools"],"created_at":"2024-12-07T07:15:20.992Z","updated_at":"2025-03-28T04:44:26.219Z","avatar_url":"https://github.com/ElryGH.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"Here's a step-by-step guide to disable specific command-line arguments in **game builds**, without affecting the Godot editor:\n\n---\n\n### **1. Understand the Goal**\nWe want to:\n- Retain full functionality in the Godot editor binary for development.\n- Customize and rebuild export templates so that the exported game binaries do not include debug-related command-line options like `--help` or `--debug`.\n\nThis is achieved by modifying the **export template code paths** and compiling templates with `tools=no`.\n\n---\n\n### **2. Prerequisites**\nFollow the [Godot official guide for compiling on Windows](https://docs.godotengine.org/en/latest/contributing/development/compiling/compiling_for_windows.html) and ensure you have installed:\n1. **Visual Studio 2022** with the \"Desktop Development with C++\" workload.\n2. **Python 3.8+** with SCons:\n   ```bash\n   python -m pip install scons\n   ```\n3. **Git** to clone the Godot repository.\n\n---\n\n### **3. Modify the Command-Line Parsing Code**\n1. Open the Godot source code:\n   ```bash\n   git clone https://github.com/godotengine/godot.git\n   cd godot\n   git checkout 4.3-stable\n   ```\n\n2. Open `main/main.cpp` in your code editor.\n\n3. Locate the section responsible for parsing command-line arguments. Typically, it looks like this:\n   ```cpp\n   for (int i = 1; i \u003c argc; i++) {\n       String arg = argv[i];\n       if (arg == \"--help\") {\n           print_help();\n           return 0;\n       }\n       // Other arguments like debug options\n   }\n   ```\n\n4. Comment out unwanted arguments **only in export templates**.\n\n   ```cpp\n   for (int i = 1; i \u003c argc; i++) {\n       String arg = argv[i];\n   \n       // Disable debug-related options in exported builds.\n       //if (arg == \"--help\") {\n       //    print_help();\n       //    return 0;\n       //}\n   \n       // Retain essential or custom arguments like --fullscreen\n       if (arg == \"--fullscreen\" || arg.begins_with(\"--\")) {\n           OS::get_singleton()-\u003eset_fullscreen(true);\n       }\n   }\n   ```\n\n5. Save the changes.\n\n---\n\n### **4. Compile the Export Templates**\n1. Open the **x64 Native Tools Command Prompt** from Visual Studio.\n\n2. Navigate to the Godot source directory:\n   ```bash\n   cd path\\to\\godot\n   ```\n\n3. Compile the export templates with `tools=no`:\n   - **Debug template**:\n     ```bash\n     scons platform=windows target=release_debug tools=no -j8\n     ```\n   - **Release template**:\n     ```bash\n     scons platform=windows target=release tools=no -j8\n     ```\n\n4. The compiled templates will appear in the `bin/` directory:\n   - `godot.windows.opt.debug.64.exe` (debug export template).\n   - `godot.windows.opt.release.64.exe` (release export template).\n\n---\n\n### **5. Replace Default Export Templates**\n1. Locate the export templates in your Godot installation:\n   - Default location: `C:\\Users\\\u003cYourName\u003e\\AppData\\Roaming\\Godot\\templates\\4.x-stable`.\n2. Replace the default Windows templates with your custom-built binaries.\n\nAlternatively:\n- Use **Editor \u003e Manage Export Templates** to configure a custom path for your templates.\n\n---\n\n### **6. Test the Exported Game**\n1. In Godot, export your project using the custom templates.\n2. Run the exported binary and test:\n   - Verify that debug options like `--help` or `--debug` are no longer functional.\n   - Confirm that essential options (e.g., `--fullscreen`) still work as expected.\n\n---\n\n### **7. Notes**\n- These changes affect only the **exported game binaries**, leaving the editor binary fully functional.\n- If you ever update Godot or use a newer version, you'll need to reapply these changes and rebuild the export templates.\n\nThis approach ensures a clean separation between the development environment and production builds, enhancing security for your shipped games.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felrygh%2Fsecure-godot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felrygh%2Fsecure-godot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felrygh%2Fsecure-godot/lists"}