<<
Back to Steam Workshop OverviewWhy To Use
- Want to support a larger number of items. A Ready-To-Use workshop makes it easier to support a large number of items, mods, or maps in your game, that are either simple or complex in nature. By building the creation and editing tools up front, you enable customers to do more with your game.
- Want authors to be able to update content any time. Authors of ready-to-use items can update their items, which means they can edit content, patch bugs, or expand the content and experience of their mod or item.
Getting Started
The best way to get started is to think about what kind of content is best suited for your customers to create to expand your game. For multi-player games you may have different kinds of content that makes sense than if you have a single-player game. Once you've figured that out, then you'll need to think about how your client will load the content and what kind of tools are necessary for customers to create that content. If you've got a game that customers are excited about, then they'll figure out ways of making the content for your game. But, as mentioned earlier, if you wish to support large scale modding of your game, you'll find it useful to release as much of your own development tools as possible to aid in the creation of content and modification of your game logic.
Once you've got basic modding up and running, then you'll need to integrate the
ISteamUGC API so that your client can know which Workshop files the user is subscribed to and can download content as necessary. From there, enabling the option to sell items in this environment is trivial. The Steam Workshop takes care of collecting bank and tax info from authors, provides the tools for specifying pricing, provides the necessary user agreements, and handles all the backend payment processing and tax witholding. Your game just needs to figure out which files to load into your game client.
Security Best Practices
Because your game will be loading user-generated content that cannot always be trusted, it's important to thoughtfully set up your workshop and make it harder for malicious content to be shipped in workshop items.
Depending on how your game incorporates items, and what types of files are allowed, the following best practices can help harden workshop item loading code and reduce the risk of malicious content, buffer overflows, and other security issues. This is not an exhaustive list and you'll need to conduct additional security research as you implement your workshop.
Knowing Your Workshop
As you integrate workshop support for your game, you should have an idea of what specific content will be supported. Your system should be designed to support specific file types in a defined manner, and not support anything else. For example, your game might support workshop maps where users create a .json file describing level geometry (positions, sizes and object types from a fixed list). The game in turn should be designed to only read .json files via a plain parser, and reject other behavior.
- Maintain an explicit list of permitted file names, extensions, and content types that are used by your game's workshop
- Compare the files included in each workshop item against your expected file types and structure, and reject anything unexpected.
- If your workshop is only expecting to load data, then do not allow items to contain scripts, executables, resource packs, or other executable content.
- Ensure the game cannot load or execute hidden code that could be hidden in an item that should be data-only.
- If expected file sizes of user items are predictable, enforce reasonable file-size limits.
Validation and Safely Parsing Item Data
Allowing encrypted or compressed files makes it much easier for attackers to hide malicious behavior.
If you must support this in your workshop, please make sure you harden the process.
- Use a well-vetted, up-to-date deserialization method appropriate for each supported file type.
- Do not use or allow
BinaryFormatter, or other risky serializers in your workshop. Read more about these risks in the following Microsoft guide: Deserialization risks in use of BinaryFormatter and related types
- If you are using Unity, pay specific attention to their best practices - Unity serialization best practices
- Compare the contents of each workshop item against the format and structure the game expects and reject malformed or inconsistent data.
- Validate every field against a fixed schema before using it. Reject missing, unexpected, or out-of-range values.
Secure File Access and Path Handling
Treat every workshop item and its contents as untrusted.
- Retrieve workshop installation information using ISteamUGC::GetItemInstallInfo and read files directly from the item's Steam installation directory.
- Never copy workshop files into the game's directory, admin folders, or other sensitive locations.
- Resolve all file lookups relative to a hardcoded directory of that specific workshop item's ID folder.
- Do not pass raw file paths from workshop items directly to operating system functions, such as
File.Read
- Validate any file path to ensure it remains within the permitted workshop directory, including protection against symbolic-link or equivalent path-based escapes where applicable.
- Reject paths containing ".." or other dangerous characters, rooted paths, unexpected separators, or other disallowed path components.
- Character filtering alone is not sufficient; verify the final resolved path remains inside the allowed root.
- Only open files whose names, locations, and types match the expected allowlist.
Preventing Code Execution
Data-Only workshops should not allow items to trigger arbitrary code execution or allow unrestricted network access.
- Do not expose the UnityEvent function
Application.OpenURL(), as this allows a mod to execute code on a machine. Learn more from Unity here.
- If network access is necessary, route every request through a dedicated validation function.
- Make that function require HTTPS as well as an explicitly approved list of hosts.
- Validate the parsed URL's scheme and hostname rather than relying on string matching alone.
- Avoid exposing other functions or events that allow workshop content to invoke arbitrary system actions, launch processes, or bypass the game's intended restrictions.
Reduce Resource-Exhaustion
Even if not malicious, unoptimized workshop item code can cause crashes or other issues with your game.
- If processing images or model data in native code, use memory-safe, well-vetted libraries with appropriate bounds checking, or standard engine asset importers.
- Avoid writing custom binary parsers from scratch unless necessary and thoroughly reviewed. Corrupted or deliberately malformed files can trigger heap or stack buffer overflows.
- Validate dimensions, counts, offsets, lengths, and other size-related values before allocating memory.
- Set reasonable limits on file sizes, decoded asset dimensions, object counts, and memory-intensive operations.
- Reject invalid assets instead of continuing with partially validated data.
Allowing Code Execution
If you plan to allow Workshop content that is essentially executable code, such as C#, we strongly urge you to instead use a scripting language that can be more effectively sandboxed. A workshop that runs a scripting language in a sandbox can be safer than a game loading arbitrary C# code.
If you are not able to manage sandboxing for your Workshop items, you can take advantage of a
workshop approval queue (see section below).
In addition to the best practices outlined for data-only workshops above, you can use the following resources below that other developers have shared with us. This is not an exhaustive list and you should do your own research when building the sandbox for your game's workshop.
- Use Lua sandboxing, which sets up a restricted execution environment. This allows untrusted or user-submitted Lua code to run without letting it access the host system's file system, network, operating system commands, or private memory.
- Use Assembly-level sandboxing and Code Access Security for .NET Core - example guide
- Ensure that the sandbox is escape-proofed, with no access to system or native libraries.
- Validate any downloaded Workshop content and reject or delete files that should have never been there.
Implementing A Workshop Approval Queue
Another option for managing workshop security is to enable Steam's approval system which allows your team to review and approve new and recently updated items. After enabling approval mode for a workshop, your team will be able to evaluate or test each item before it is available to customers.
Once enabled, items will be queued into a system where members of your team can claim items to evaluate.
https://steamcommunity.com/sharedfiles/moderationqueueview/?appid= (need to include your game’s appid in that URL)
How to claim items to moderate:Re-fill queue will claim 20 items for your account. They can be returned to the queue, but will also automatically return if untouched for a number of hours.
Alternatively, you can setup your own UI and integrate directly with the approval system. Some games use systems to automatically moderate these items and approve via API.
IPublishedFileModerationService InterfaceModerating Your Workshop
Moderation of the reported content in your game's workshop hub is a collaborative effort. While Steam's moderation team can quickly respond to reported content that may post a risk to players, you know your game better and how content specifically behaves with your game's engine.
Therefore, reported content in your workshop hub can be escalated in both directions:
- Steam's moderation staff may need to escalate certain items to your attention so that your team can evaluate them in greater detail with an understanding of how that content may be executing or behaving within the game.
- If your team identifies malicious workshop items, you can escalate them to Steam's moderation team with further details so that we can take appropriate actions, such as locking content and/or contacting affected players.
Integration Work
Here are some of the typical components to think about for integration of the Ready-To-Use Workshop model with your game:
- Loading content into a single-player game client - If you intend for content submitted by customers to be ready to use within your game, then you'll need to structure your game appropriately to handle content in that way. Typically this means your game will need to check for files to load. If you are building a new implementation, we suggest that your game client first check for the Steam user's list of subscribed files and then load the corresponding folders. You will also need to have some kind of staging environment so that mod creators have a place to work on their mods and be able to load from that directory.
- Loading content into a multi-player game client - If you have items or content that multiple users need in order for the game to function properly, you can download those items to all clients that need the particular item. For example, if a single user has subscribed to a custom map on the workshop and then invites his friends to join that match, your game should be able to recognize that it is a custom map and download the content from the Workshop for the other users before fully connecting to that match.
- Uploading entries from item authors - You'll need a tool for item authors to upload their entries to your Workshop using the ISteamUGC API. This can be as simple as a form in your game or it can be a stand-alone app. Since the items you are accepting should be ready-to-use, then your submission tool should accept just the file formats your game client expects to load, along with an preview image. Depending on the content you are asking authors to upload, you might need your own editing tools (especially necessary for any large-scale modding of your game such as game logic, gameplay, or anything beyond changes to existing visuals). For example, most moddable games have released their own developer tools so that mod-authors can utilize the same tools that the developer has used. These tools can also restrict and validate the content being submitted if you wish to control things like which files can be overwritten or what aspects of the game can be changed. As part of the information you provide to potential Workshop item authors, you'll also want to create a style guide and potentially a set of guidelines about the kinds of content you are looking for and the kinds of content you don't wish to see posted.
See the Steam Workshop Implementation Guide for detailed information on how to get started using the Steam Workshop portion of the Steamworks API.
Getting Items to Customers
With the Ready-To-Use Workshop model, items listed in the Workshop are automatically available to subscribe to (if free) or to purchase (if paid) and then are automatically downloaded via the Steam client (Integration of the
ISteamUGC API with your product is necessary for this to work correctly. See the technical documentation on the
Steam Workshop Implementation Guide). The Steam Workshop handles keeping the client up to date with any mod updates. If the mod was purchased, then Steam handles purchase of the item, payment processing, payments to the authors, payments to the game developer, and any necessary tax withholding.
If you wish, you can build an in-game Workshop browser to list the same set of items.