Skip to content

Feedback on Lua Sandboxing Restrictions: Request for a Power-User Toggle Flag #5992

Description

@Vactarian

First of all, thank you to the team for the incredible, tireless work you put into maintaining DFHack. It is an indispensable framework that completely transforms how many of us experience Dwarf Fortress.

I wanted to provide some constructive feedback regarding the safety overhauls implemented in the DFHack 50.11 release cycle (specifically November/December 2023), which introduced strict sandboxing to the Lua environment by removing native OS functions like os.execute and io.popen, alongside subsequent blocks on launching local execution shortcuts (.lnk and .exe files) from configuration paths.

While the intent to protect the broader user base from malicious mod packages is entirely understandable, enforcing an unyielding, mandatory sandbox significantly degrades the experience for power users while introducing a fundamental paradox: DFHack operates natively as an extension library directly integrated into the game's executable stack with full system privileges, yet it draws an arbitrary line at preventing users from utilizing those exact same custom automation capabilities within their own workspace.

Malicious actors intent on exploitation will always bypass high-level script restrictions through memory manipulation or alternative execution pathways. Consequently, a mandatory sandbox does not truly secure the ecosystem; it simply acts as security theater that penalizes legitimate power users who have already established a baseline of trust with the scripts they choose to install.

The most glaring impact of this model occurs when attempting to synchronize essential sidecar utilities like soundsense-rs with the game. To ensure that the Steam client can natively track playtime hours, manage cloud saves, and maintain the Steam overlay, the game must be launched directly through Steam.

In an open environment, automating a companion tool alongside the game should be a trivial task—achieved via a single, clean command line in a startup script or by placing a minimized shortcut in an initialization folder.

Instead, because the framework aggressively blocks these native inter-process communication pathways, power users are forced to waste time constructing fragile, multi-layered external architectures. We are forced to chain hidden VBScripts and background batch scripts just to intercept Steam's launch parameters, handle background execution, and forcefully pull windows back into active focus.

To resolve this structural barrier without compromising the safety of casual users, I respectfully request the implementation of a simple, opt-in initialization switch or command-line flag (e.g., an environment variable, a startup argument like --allow-external-scripts, or a GUI checkbox toggle with a clear warning prompt).

This would allow advanced users to knowingly disable the sandbox safety net at their own risk, restoring full API and system execution capabilities to those who heavily value custom automation and seamless workflow integration.

Thank you for considering this QOL adjustment for the power user community.

[Correction: DFHack isn't an external injector anymore; it runs as a native extension library.]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions