View Issue Details

IDProjectCategoryView StatusLast Update
0006336The Dark ModCodingpublic02.01.2024 16:58
Reporterstgatilov Assigned Tostgatilov  
PrioritylowSeverityfeatureReproducibilityN/A
Status resolvedResolutionfixed 
Product VersionTDM 2.11 
Target VersionTDM 2.12Fixed in VersionTDM 2.12 
Summary0006336: Support several independent user addon scripts.
DescriptionThanks to 0005179, there is a hardcoded script file which is included in tdm_main.script, and hardcoded global function name which is called on start.

However, several people make addons, and players want to install them by merely putting them into a proper directory.
For this to work, we need to include existing all script files matching a hardcoded template, and execute all global functions matching a hardcoded template.
Additional InformationDiscussion thread: https://forums.thedarkmod.com/index.php?/topic/22261-support-for-multiple-user-addons/
TagsNo tags attached.

Relationships

related to 0005179 resolvedDragofer Add support for scripts in user addons 

Activities

stgatilov

stgatilov

14.11.2023 11:29

administrator   ~0016174

Implemented in svn revs 10503 and 16844.

The new interface for user addons can be seen in tdm_main.script:

// dragofer: add support for users to add custom addon scripts to their base installation, without relying on tdm_custom_scripts.script which is often already in use by FM authors
// legacy approach 0005179: include one script which can be overrided by players
#include "script/tdm_user_addons.script"
// new approach 0006336: include all scripts with predefined prefix
#include "script/tdm_user_addons_*.script"

void tdm_main() {
...
    // dragofer: initialises any user addons included
    // legacy approach 0005179: run single function (immediately)
    user_addon_init();
    // new approach 0006336: run all functions with predefined prefix (in new threads)
    sys.callFunctionsByWildcard("user_addon_init_*");
}
Dragofer

Dragofer

17.11.2023 23:30

developer   ~0016179

Updated instructions for creating user addons:
https://wiki.thedarkmod.com/index.php?title=A_to_Z_Scripting:_Script_addons_for_players

Announcement thread in the editor's guild subforum (set to hidden for now until some points are cleared up):
https://forums.thedarkmod.com/index.php?/topic/22274-support-for-multiple-addons/
Fiver

Fiver

02.01.2024 00:15

reporter   ~0016313

I was trying to assess the security aspects of this implementation (executing code in arbitrary files added to a TDM folder). My main concern was that someone may add a file to the folder without the user's knowledge and that the content of that file was executed when the user started TDM.

But from what I understand, scripts are confined to only affect variables and objects created by TDM at runtime, and thus this implementation should not pose a risk. Right?
stgatilov

stgatilov

02.01.2024 08:35

administrator   ~0016314

If attacker can modify anything inside your TDM installation directory, then you are screwed.
There are so many opportunities for arbitrary code execution that executing game scripts is not even interesting.
Fiver

Fiver

02.01.2024 16:58

reporter   ~0016316

Yes, maybe you're right.
Is my description of the scripts' limitations correct?

Issue History

Date Modified Username Field Change
12.11.2023 11:43 stgatilov New Issue
12.11.2023 11:43 stgatilov Status new => assigned
12.11.2023 11:43 stgatilov Assigned To => stgatilov
12.11.2023 11:43 stgatilov Relationship added related to 0005179
12.11.2023 16:11 Dragofer Additional Information Updated
14.11.2023 11:29 stgatilov Note Added: 0016174
14.11.2023 11:29 stgatilov Status assigned => resolved
14.11.2023 11:29 stgatilov Resolution open => fixed
14.11.2023 11:29 stgatilov Fixed in Version => TDM 2.12
17.11.2023 23:30 Dragofer Note Added: 0016179
02.01.2024 00:15 Fiver Note Added: 0016313
02.01.2024 08:35 stgatilov Note Added: 0016314
02.01.2024 16:58 Fiver Note Added: 0016316