Restricting file uploads in Rocket.Chat

Rocket.Chat file uploads can expose sensitive documents and malicious files if left at defaults. This page explains the settings, trade-offs and checks that lock uploads down for your environment.

On this page

Why restricting file uploads in Rocket.Chat matters for your deployment

Restricting uploads in a self-hosted Rocket.Chat workspace covers four things: how large a file can be, who can open a file, whether file URLs can be reached without a session, and what happens to content once it arrives. Files shared across many teams carry the same risks as email attachments, and the security team will want each of these four areas answered with a setting, a proxy rule or a written decision. The documented Rocket.Chat controls are restricting files to room members or to users who can access the room, and JWT protection of file URLs, which appends a token to file links only when a JWT secret is set. Maximum File Upload Size should also match the upload limit on your reverse proxy, so the application and the proxy reject the same files.

Blocked file types, EXIF metadata stripping and antivirus scanning are areas to confirm, not built-in promises. Check the current file upload documentation and your release notes for whether any of them exists in the version you run, and whether it is available on your plan. If a control is missing, the choice is between a product feature, a proxy or storage-layer scanner, or a documented accepted risk. Ask your partner or internal team to write that decision down before users are onboarded, because uploads that already exist are harder to clean up than uploads blocked at the start.

Start by inventorying where files are stored and served, including the file storage backend, the proxy configuration and any CDN or embedded clients that fetch file URLs. Then compare each control against the risks your security team has named, such as data leaking to users outside a project, links shared beyond their intended audience, or malicious files reaching endpoints. The result should be a short list of settings to change, tests to run and gaps to accept or close, which becomes the basis for a scoped hardening task rather than an open-ended review.

Which upload controls fit which risk

This table compares each upload control by the risk it addresses, the layer that owns it and when it fits. Native Rocket.Chat settings are separated from controls that depend on a reverse proxy, storage layer or external scanner, so you know who must configure and verify each one.

ControlRisk addressedOwner and typeWhen it fits
Maximum file upload sizeOversized uploads that exhaust disk, memory or bandwidthNative Rocket.Chat setting, paired with the proxy upload limitAlways. Set the Rocket.Chat limit to match the proxy limit so neither layer silently rejects or accepts a different size
Restrict files to room membersUsers reading files from rooms they have left or never joinedNative Rocket.Chat settingAny workspace with private channels or sensitive discussions
Restrict files to users who can access the roomAccess to files through rooms a user can see but is not a member ofNative Rocket.Chat settingWorkspaces where public channels hold material that should stay limited to readers of that room
JWT protection of file URLsShared or leaked file links being fetched by anyone who has the URLNative setting, but only effective when a JWT secret is configuredWhen file links can be copied, forwarded or cached outside the workspace. Confirm the token behavior in your version before relying on it
Blocked file typesExecutables, scripts and archives reaching users or being opened by othersNative configuration of allowed or blocked types, with proxy and endpoint controls for enforcementTeams that exchange only documents and images. Confirm how file extensions and MIME types are checked in your release
EXIF metadata strippingLocation, device and author data leaking inside shared photosNot a standard native control. Typically handled by a processing step, image pipeline or external toolField teams, healthcare, legal or public-facing groups that share photographs. Confirm whether your setup offers it before planning
Antivirus scanningMalware embedded in documents or archives uploaded by any userExternal scanner integrated at the storage or proxy layer, not a native Rocket.Chat settingAny workspace accepting external or unmanaged files. Confirm the scanner integration and how infected files are quarantined

How to set upload restrictions in order

This sequence moves from the proxy upload limit to Rocket.Chat's own size, access, token and content-handling settings, so each control is set once, in a known order, and verified before the next one depends on it.

  1. Confirm the proxy upload limit

    Before changing anything in Rocket.Chat, find the request body size limit enforced by the reverse proxy or load balancer in front of it, such as the client body size directive in NGINX or the equivalent setting in your ingress or cloud load balancer. Record the value and who owns that configuration, since the proxy is often managed by a different team. Confirm the limit with your network or platform team rather than assuming a default. Done means you have a written value that Rocket.Chat's settings will be matched against, and a test upload above that value fails at the proxy with an error before it reaches the application.

  2. Set maximum file upload size to match

    In the Rocket.Chat administration settings, open the file upload section and set Maximum File Upload Size to the same value as the proxy limit, or a value below it. Rocket.Chat's own limit should never exceed the proxy, because an upload that passes the application check but is cut off upstream produces confusing errors for users and leaves partial data. Make the change in a staging workspace first if you have one. Done means a file just under the limit uploads in a test room, and a file just over the limit is rejected by Rocket.Chat with a clear message, while the proxy rule is unchanged.

  3. Choose the file access rule

    Decide who can open uploaded files: members of the room where the file was posted, or any user who can access that room. Room-member-only access is the stricter choice because it narrows access to people already in the conversation, and it should be the default for workspaces handling sensitive material. Confirm the exact setting name and options for your Rocket.Chat version in the administration console, since the labels change between releases. Done means one test user who is not a room member cannot open a file link from that room, and a member can.

  4. Create the JWT secret before enabling protection

    Set a strong JWT secret in the file upload settings before you turn on JWT protection of file URLs. Rocket.Chat only appends a token to file URLs when a secret is set, so enabling the protection without one gives you no effect and a false sense of control. Generate the secret with a cryptographic random generator, store it in your secrets manager, and restrict who can view it in the admin console. Done means the secret field is populated, the value is recorded in your secrets system, and access to the setting is limited to named administrators.

  5. Enable JWT protection and verify tokenized URLs

    With the secret in place, enable JWT protection for file URLs. Then post a test file in a room, copy its link, and inspect the URL. It should carry a token parameter. Repeat the check after clearing the secret in a staging environment, or confirm with your vendor documentation, to show that tokens are added only when the secret exists. Also confirm that a request with the token removed or altered is refused. Done means a file URL from the test room includes a token, and a modified or tokenless request does not return the file.

  6. Define handling for blocked file types

    Write down which file types are blocked or allowed, such as executables, scripts, archives or macro-enabled documents, using the file type controls in the upload settings. Decide what users see when a file is blocked and whether administrators are notified. Keep the list in your change record so auditors and security reviewers can trace it. Note that filtering by extension alone does not confirm file content, so the next step covers content checks. Done means the allowed and blocked lists are documented, and a test upload of a blocked type is rejected with the message you expected.

  7. Add content scanning and metadata stripping

    Connect antivirus scanning and metadata handling only if your deployment supports the integration you choose. Confirm with your Rocket.Chat version and plan which scanning options are available, how scanning results are returned to users, and whether EXIF data is stripped from images before storage. Test with a harmless EICAR-style test file that your scanner is designed to flag, and with an image containing location metadata. Done means the scanner blocks or quarantines the test file, and the stripped image no longer exposes the embedded location fields when downloaded.

  8. Retest the full upload path and record evidence

    Run the complete test set end to end: an oversized upload, a blocked type, a non-member access attempt, a tokenized URL and a scanned file. Keep the results, screenshots and configuration values in your change record. Repeat this check after each Rocket.Chat upgrade and after any proxy or ingress change, because either can silently reset a limit. Done means every test produces the expected result, and the evidence is stored where your security team can review it.

How upload rules differ by deployment and audience

A single Docker Compose deployment usually has one reverse proxy in front of one Rocket.Chat container and one MongoDB replica set. Upload enforcement is therefore concentrated in two places: the proxy and the Rocket.Chat administration settings. Both must agree, because the Maximum File Upload Size setting should match the proxy's upload limit, and a mismatch makes users see failures that look like application bugs.

  • Size limits: Check the body size limit in the proxy configuration (for example, the client body size directive in nginx) and set Maximum File Upload Size in Rocket.Chat to the same ceiling.
  • Storage location: Files typically sit in the default store on the Rocket.Chat host or in a mounted volume. Confirm which store is active and that the volume is included in backups.
  • Access rules: Restrict files to room members or to users who can access the room, and enable JWT protection only after a JWT secret is set.
  • Proxy change control: Any change to the proxy limit needs a matching change in the admin panel, so record both in the same change ticket.
  • Single failure point: One host means one disk. Plan capacity and restore tests for the upload volume, since it cannot be shared across nodes.

Before going live, upload a file slightly over the proxy limit and confirm the rejection message, then confirm that a room non-member cannot open the file URL.

Security and operational considerations for upload controls

Upload controls only hold if they are configured consistently across the proxy, the application and the storage layer, and if the people running them know what each setting protects. The cards below cover the decisions that most often decide whether file restrictions work in production and stay working after the first deployment.

Managing the JWT secret

JWT protection appends a token to file URLs only when a JWT secret is set, so the secret is what makes those URLs meaningful. Store it in your secrets manager rather than in plain configuration files, restrict who can read it, and plan a rotation procedure before go-live. Confirm with your Rocket.Chat administrators how a rotation invalidates links that users already hold, since older URLs may stop working.

File upload docs

Leaked URLs without JWT

If JWT protection is off, a file URL is the only thing standing between an outsider and the file. A URL copied from a chat, a log, a browser history or a forwarded email can expose the file to anyone who holds it, even if they are no longer a room member. Test this directly: copy a file URL from a private room, open it in a logged-out browser, and record the result before you accept the configuration.

Proxy and app limit mismatch

Maximum File Upload Size in the application and the upload limit at your reverse proxy or load balancer are set in different places, and they can disagree. When the proxy is lower, large uploads fail at the proxy and users may see errors that do not name the cause. Confirm both values together during change control, then test a file just under each limit from a desktop client and a mobile client.

Logging and retention of uploads

Uploaded files are business records in many organizations, and the retention settings that govern messages may not govern files in the same way. Decide whether files must be kept, for how long, and who can export or delete them. Confirm with your compliance team which file records need to be retained and whether your deployment's audit trail covers file events, since tamper-evident audit trails are listed as a paid plan capability.

Rocket.Chat pricing

Antivirus scanning and latency

Scanning uploads adds work between the moment a user attaches a file and the moment the file becomes available to others. The delay grows with file size and with the load on the scanning service, and a scanner outage can either block uploads or let them through depending on how you wire it. Measure upload latency at peak load, define what happens when the scanner is unavailable, and confirm which integration points your chosen scanner supports before you commit.

EXIF stripping changes files

Removing EXIF metadata alters the file itself, which can affect users who rely on capture dates, GPS data or camera settings, and it can also break files that expect embedded metadata. Test the setting with the workflows your users actually run, such as sharing photos for inspection, medical images or evidence, before you enable it broadly. Document which file types are affected so that support teams can answer questions when a user reports a changed image.

How file access and JWT protection work together

Two separate controls decide who can reach an uploaded file in Rocket.Chat, and they do different jobs. The room restriction limits file access to room members, or to users who can access the room, so the server checks membership when a file is requested. JWT protection works on the URL itself. When it is active, Rocket.Chat appends a token to file URLs, so the link carries a credential. The token is added only when a JWT secret is set. Without that secret, enabling JWT protection changes nothing you can observe. Read the Rocket.Chat file upload documentation before you configure either control, so you know which request each one governs.

When access is denied, expect the request to be refused and no file content returned. The documentation does not spell out the exact status code or message, so confirm both in your version by testing with an account that is not a room member and with a link copied from a member. Also test what happens to a link after someone leaves a room or is removed from the workspace. The documentation describes the token being appended to file URLs but does not describe token lifetime or revocation, so ask whether a copied URL keeps working. Storage backend and caching behavior also need confirmation. If files are served from object storage or sit behind a CDN or proxy cache, a cached response may outlive a membership change. Settle these questions before you rely on the controls for sensitive channels.

Set the JWT secret before you enable protection, and verify the result. The order matters because the token is generated only when a secret exists, so a check run before the secret is saved can pass for the wrong reason. A practical test is to copy a file URL from an authorized session, confirm that a token parameter has been appended, then request the same URL with the token removed and confirm that it is refused. Store the secret in your secret management system, record who can change it, and plan rotation, since rotating it may break existing links. Confirm that behavior in your version. Finally, confirm that your reverse proxy passes the full file URL, including its query string, unchanged, because a proxy that strips or rewrites the token would make the protection ineffective.

Limits to confirm in your environment

The upload controls on this page depend on your Rocket.Chat version, your reverse proxy and your storage backend, and the options differ between releases. Treat each item below as a question to answer from the vendor documentation for the exact version you run, then test it in a staging environment before production.

Supported file type blocking options

Confirm which file type restrictions your version exposes in the administration settings, and whether they are allow lists, block lists or both. Check how the setting matches extensions versus actual content, since a renamed executable may pass an extension-only rule. Record the exact behavior in your build, because the options available in a Starter, Community or paid deployment can differ. Test each blocked type with an upload from a normal user account.

File upload docs

Antivirus and EXIF stripping requirements

Find out whether malware scanning and EXIF metadata removal are built into your version or require an add-on, a marketplace app or an external scanning service. If an external service is needed, confirm how files reach it, what happens when it is unavailable, and whether uploads are held until a scan completes. Ask who owns the scanner's signature updates and log retention.

Proxy upload limit and body size

The Maximum File Upload Size setting should match the upload limit on your reverse proxy or load balancer, and the proxy's body size limit must also allow the request overhead. Confirm what the proxy returns when a file is too large, and whether the client shows a usable error. Check every hop in the path, including any CDN or ingress controller, because the smallest limit wins.

Storage backend constraints for large files

Confirm the file storage backend you chose supports the largest size you allow, and check any per-object limits, timeouts or temporary disk requirements during upload. Verify that backups include uploaded files and that restore time fits your recovery targets for large attachments. Ask your storage team how stored files are encrypted and who can read the storage bucket or volume directly.

JWT URL protection behavior

Confirm that a JWT secret is configured, because file URLs receive a token only when one is set. Test that a copied file link stops working for a user without room access, and check how long tokens remain valid. Verify whether links are cached by browsers, proxies or email clients, since a cached URL may still serve the file after access is removed.

Retention and export for recordkeeping

Check whether file retention and deletion settings apply to uploaded files as well as messages, and whether an export includes the files themselves. Confirm how a deleted file is handled in backups and in any audit trail your plan provides. Compare these behaviors with the recordkeeping obligations that apply to your organization before you enable automatic deletion.

Questions teams ask before restricting uploads

How much effort does a basic upload restriction take compared with a full antivirus and EXIF pipeline?

A basic restriction is mostly configuration: setting Maximum File Upload Size, restricting who can access files, and choosing a JWT secret so file URLs are protected. A full pipeline adds work the admin console cannot do alone: an antivirus scanning service, a quarantine path, metadata stripping for images and documents, and tests that prove each step runs. The second category is where most of the effort sits, because it involves additional infrastructure, failure handling and ongoing maintenance of the scanner. Ask the partner to split its estimate into configuration, integration and testing so you can see which part you are paying for.

Can our internal team restrict uploads without outside help?

Often yes for the configuration layer, provided someone on the team can administer Rocket.Chat, edit the reverse proxy and verify behavior with test files. Outside help is most useful for the parts that cross teams or need independent checks: scanner integration, a test plan that covers blocked types and access paths, and a review of how the proxy and application limits interact. Be honest about who will own the settings after go-live, since a change to the proxy can silently undo an application limit.

What does the work need from our team before it starts?

Plan for four inputs. First, access to the reverse proxy configuration and its upload limit settings. Second, an account with the admin role in the Rocket.Chat workspace to change file and access settings. Third, a written test plan listing file types, sizes, room types and user roles that must be checked, including users who are not room members. Fourth, a named storage owner who can confirm where uploaded files are kept, how long they remain and who can read the storage backend directly. Without the storage owner, access rules in the application can be correct while the underlying files remain reachable.

What drives the cost of this work up?

The main drivers are the number of Rocket.Chat instances, the scanner you need to integrate, and the compliance evidence you must produce. Multi-instance designs, which the reference architectures place above 500 concurrent users, need the same settings applied consistently and tested on each node, and they require a paid plan. Each scanner integration adds a service to deploy, secure and monitor. Compliance evidence, such as documented test results and change records for an assessment, adds documentation and retesting. DeployOpen prepares systems and evidence for assessments, but independent auditors issue any audit report.

How long does testing take, and how does scope change it?

Duration depends on scope, and no fixed figure applies to every environment. A restriction limited to size and file type can be verified in a short cycle with a defined set of test files. Adding room-level access checks, JWT protection on file URLs, and scanner behavior for infected and oversized files expands the matrix of tests. Multiple instances and multiple proxies extend the work further. Ask for the test matrix in the proposal and the number of retest rounds included, so the timeline follows from written scope rather than estimate.

What should we ask for in a written quote for this work?

Ask for the scope in writing: the exact settings covered, the proxy and instances in scope, and the scanner integration if included. Request deliverables such as the configuration record, the test plan and results, and a runbook for changes. Ask which items are one-time work and which recur, such as scanner signature updates or retesting after upgrades. Confirm what the quote excludes, including storage migration, changes to other platforms and any compliance documentation beyond the evidence described. DeployOpen agrees scope, deliverables and timelines in writing before work starts.

Does restricting uploads affect how users reach files from mobile or desktop clients?

It can. Protected file URLs depend on the JWT secret and on the access rules you set, so clients that rely on older links or cached sessions may need to refresh. Test with the official mobile and desktop clients on the versions your users run, not only the web app. Confirm your Rocket.Chat version is still supported, because the vendor notes that unsupported versions may lose compatibility with official clients, and that affects how you validate this change.

How an upload passes the proxy, access checks and content controls

The diagram starts with a user sending a file through the reverse proxy, which enforces the upload size limit before the request reaches Rocket.Chat. Rocket.Chat then checks room membership and the allowed file types, and writes the file to storage. Optional scanning or metadata stripping sits between application and storage. On download, Rocket.Chat checks access and the JWT token before serving the file, so confirm each boundary enforces its own control.

Upload and download paths across proxy, application and storage trust boundaries.

Rolling out tighter upload limits without breaking workflows

Tightening upload controls on a live Rocket.Chat workspace fails most often because users learn about the change when their upload is refused. Announce the new Maximum File Upload Size, the blocked file types and the effective date before the change, and say what users should do instead (compress, share a link from approved storage, or request an exception). Keep the message short and list the exact types that are blocked, so people do not have to guess which files are affected. Tell administrators which settings change together, because a size limit set in Rocket.Chat that is larger than the proxy's upload limit will still fail at the proxy with an error that users cannot interpret.

Test with representative files before any change reaches users. Build a list from the teams that upload most often, such as design, finance, support and clinical or legal staff if they apply, and include the file types they actually use at the sizes they actually produce. Run the list on a non-production workspace that has the same reverse proxy, file storage and access settings as production, and check each result from both a room member and a non-member account, since the access rules decide who can open a file as well as who can send one. Record which files fail and whether the failure is the Rocket.Chat setting, the proxy or the client. Confirm the exact behavior of each setting against the Rocket.Chat file upload documentation for your version before you rely on it.

After the change, watch for failed uploads in the server logs and the reverse proxy logs, and compare the two. A rejection in the proxy log with a 413-style response points to the proxy limit, while a rejection that only appears in Rocket.Chat points to the workspace setting or the blocked type list. Review failures weekly for the first few weeks and route repeated failures to the owners of the affected workflow. Plan an exception path before you need it: define who can approve a blocked or oversized file type, what evidence the requester provides, where the approved file is stored, and when the exception expires. Keep exceptions narrow and recorded, so the tighter policy stays enforceable.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.