TX Sheet Control

Host Security and File Handling

Topic

TX Sheet Control validates the files it loads and processes documents within the limits you configure. Everything else is the task of the host application: authentication, authorization, upload policies, storage and request limits. The sections below separate what TX Sheet Control checks itself from what your application must provide.

Important

Not a Security Control. Worksheet protection and the viewer mode of a dashboard control what users can change in the interface. They do not replace authentication and authorization in your application.

What TX Sheet Control Checks

When it loads an XLSX file, TX Sheet Control rejects the file:

  • With document type declarations or entity definitions in its XML parts, also external entities that would read files of the server. The error has the code XML_DTD and the message "DTD and entity declarations are not allowed."
  • With unsafe or duplicate entry names in its ZIP archive, such as ../evil.txt. The error has the code ZIP and the message "Invalid or duplicate ZIP part name."

Decompression is limited by the size of the archive and of its parts, including the expanded size the archive declares. TX Sheet Control does not fetch the external references of a workbook, such as links to other workbooks. Loading is atomic: a file that fails validation leaves the open document unchanged.

Handle Untrusted Files

  • Size and time. Limit the upload size in the host, and stop processing that takes too long with a CancellationToken in .NET or the signal option in JavaScript.
  • Worksheet size. Limit the rows and columns a server control accepts with MaxRows and MaxColumns, as .NET Server Applications shows.
  • Content. Accept only the formats your application expects, and check the warnings that loading returns.
  • Output. Generate the names and locations of output files yourself, and store them where only authorized users can read them.
  • Paths. Do not build file paths, font directories or data provider URLs from user input, and do not serve private folders, such as tx-sheet-engine of a .NET application, as web content.

Send Only Authorized Data

The browser editor receives every value of the documents and data you send to it, also values that a dashboard widget hides. Send only the records the user is allowed to see, and fetch data through services that check the user's authorization. Validate the identifiers of data providers and queries on the server.

Serve the Browser Assets

The editor needs its script, the font catalog and the fonts from the origins you configure, and it makes no other requests. When your application sends a content security policy, allow the editor's inline styles and the data: images of its icons, for example:

Content-Security-Policy: default-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:

With default-src 'self' alone, the browser blocks the styles and icons of the editor. The editor fetches the catalog, which connect-src controls, and loads the fonts as web fonts, which font-src controls. When they come from another origin, add it to these directives and allow your page's origin with CORS headers on that server. A blocked catalog makes editor.ready reject with "Failed to fetch", a blocked font with "Could not load document font: Liberation Sans".

The ASP.NET Core Tag Helper loads the editor with external scripts and passes its configuration in a <script type="application/json"> element, which the browser does not execute. Your own scripts and event handlers must follow your policy as well.

Protect the License

The browser editor needs the license in the page, so users can read it. That is expected: a license only unlocks TX Sheet Control and contains no secrets of your application. Keep it out of public repositories, examples and support requests, as Licensing asks, and keep the secrets of your application on the server.

Log Operations Safely

Log error codes, warning categories, processing times, document sizes and page counts when they help you operate the application. Do not log license strings or customer content you do not need. Do not return internal exception details to unauthenticated clients.

Keep the Notices

Deploy the license and notice files of the fonts and of the third-party software with the application, as Included Fonts and Notices lists. Check the embedding rights of fonts you add before you embed them in PDF files.

Next Steps

  • Deployment Overview: see what each kind of application deploys and how you check it.
  • Licensing: configure the license file, and keep it out of public repositories and examples.
  • Backend Services: validate templates and data before processing on the server.