Security Considerations for .NET Document Viewers in Enterprise Apps
← Back to Blog••8 min read

Security Considerations for .NET Document Viewers in Enterprise Apps

Introduction

Security architecture for embedded .NET document viewers with Doconut
Security architecture for embedded .NET document viewers with Doconut

Building a .NET‑based document viewer means you have to think about security from day one. When you embed a viewer into an enterprise .NET app, the burning question is how to keep the content confidential while still giving users a rich, interactive experience. Whether you’re building a DMS, a customer portal, or a legal‑tech workflow, you’ll need to protect intellectual property, personal data, and any regulatory‑mandated information at every step of the viewing pipeline. In this article we’ll walk senior developers and architects through the most common attack vectors, the architectural choices that keep risk low, and why Doconut’s universal document viewer is built to be the secure foundation for any document‑centric .NET solution.


1. Threat Landscape for Embedded Viewers

Even a beautifully crafted UI can become an attack surface if the viewer leaks data or runs untrusted code. Below are the three threat categories you’ll most likely run into:

ThreatTypical ManifestationBusiness Impact
Data exfiltrationDirect download links, unsecured APIs, or client‑side rendering that sends raw bytes to the browser.Loss of confidential contracts, PII breaches, regulatory fines.
Cross‑site scripting (XSS) & injectionMalicious markup inside a PDF or Office file that triggers script execution when rendered.Session hijacking, credential theft, ransomware pivot.
Unauthorized manipulationUsers adding or modifying annotations, then exporting the altered file without audit trails.Legal disputes, falsified records, compliance violations.

Because viewers often need to render complex formats (PDF, DOCX, DWG, etc.) and support features like annotation and OCR, the code paths get bigger—and bigger attack surfaces are more tempting. The first line of defense? Keep a clear separation between trusted server‑side processing and controlled client‑side interaction.


2. Server‑Side vs. Client‑Side Rendering in .NET

Why Server‑Side Matters

  • Zero data exposure – The raw file never leaves the trusted backend. Only rendered images or safe HTML fragments travel to the browser.
  • Centralized policy enforcement – Application-managed storage protection and visual markings can be applied before rendered pages reach the user.
  • Scalable isolation – Heavy‑weight conversion (e.g., turning a CAD DWG into a raster image) can run in isolated background jobs, limiting the blast radius of a compromised request.

When Client‑Side Is Acceptable

  • Low‑sensitivity previews (public brochures) where latency is the primary concern.
  • Environments where the entire infrastructure is air‑gapped and the client runs on a trusted corporate device.

Doconut’s Balanced Architecture

Doconut performs document rendering on the customer’s server and presents the result through an HTML5/JavaScript viewer. Optional conversion and annotation are also server-side, while Search uses only the document’s existing text layer. The viewer never needs third‑party plugins, and all rendering comes from streams that originate from the server‑side Viewer component. This design eliminates the “download‑the‑original‑file” pattern many insecure solutions fall back on.

How to register Doconut in an ASP.NET Core pipeline

Register Doconut according to the documentation for your installed version, then place its document-session and rendering requests behind the application’s authentication and authorization checks. By configuring the middleware to reject any request that does not meet your security criteria, you ensure that only vetted documents are rendered.


3. Controlling Access, Authentication, and Authorization

Access Control Strategy

Rather than exposing a static file path or a public URL, integrate Doconut with your existing identity provider. When a user requests a document, your server‑side code should:

  1. Verify the user’s identity and roles via the standard ASP.NET Core authentication pipeline.
  2. Perform any additional business‑logic checks (e.g., ensuring the user belongs to the correct department or has a specific claim).
  3. If the checks pass, establish the documented viewer session and return only the opaque session information required by the browser.

Annotation Permissions

Doconut’s Annotation Plugin provides annotation capabilities. The surrounding application must decide who can view or change annotations and enforce those decisions around the documented plugin API. This ensures that only authorized personnel can add or modify review comments.


4. Data Leakage Prevention: Encryption, Visual Markings, and Printing Policy

End‑to‑End Encryption

Configure HTTPS and any document-storage encryption in your hosting application and infrastructure. Doconut’s shared widget store is encrypted at rest with AES-256, but that does not encrypt customer documents stored elsewhere. The viewer only receives rasterized pages, never the original file, so the client never gains direct access to the source document.

Visual Markings (Watermarks) via Annotations

Because rendering is performed on the server, you can add a user‑specific annotation—such as a semi‑transparent text overlay containing the viewer’s name, email, and timestamp—before the page is sent to the browser. This approach discourages screenshotting and provides forensic evidence if a leak occurs, while staying within Doconut’s verified annotation capabilities.

Custom Watermarking and Application-Managed Printing

Many enterprises define authorization and copy limits for printing. Doconut can add a custom watermark to rendered pages, and its samples include a browser print view for those pages. Print authorization, device restrictions, quotas, and print-job management belong to the surrounding application.


Immutable Audit Trails

The surrounding application can persist annotation data together with its own timestamps and user identifiers. It must design and operate any audit trail itself because Doconut does not provide built-in immutable logging.

Doconut Search works with text already present in the document. Image-only or scanned files require an external OCR step, and the application must protect any extracted text it creates.

Regulatory Alignment

Because Doconut is self-hosted, documents are not sent to a third-party viewing service. This can help customers meet their obligations, but Doconut does not guarantee GDPR, HIPAA, PCI-DSS, or other compliance and does not provide built-in audit logs.


6. How Doconut Turns Security Requirements Into a Competitive Advantage

Security RequirementDoconut FeatureBusiness Benefit
Zero data exfiltrationServer‑side conversion & stream‑based renderingConfidential files never leave the trusted environment.
XSS protectionSanitized HTML output, no client‑side script execution from documentsReduces attack surface without extra coding effort.
Application-owned authorizationIntegration behind ASP.NET authentication and authorization checksLets the host application decide who may open documents or use annotations.
Visual markingsCustom watermark on rendered pagesLets the application add identifying or contextual text to the displayed pages.
Application-owned loggingHost-application request and annotation recordsKeeps audit and reporting policy in the system that owns user identity and authorization.
Text-layer searchSearch Plugin uses text already present in the documentFinds matching content in supported documents that contain a text layer.
Cross‑platform deliveryHTML5 viewer works on any browser, integrates with React, Angular, Vue, or BlazorFuture‑proofs your investment across desktop, mobile, and kiosk deployments.

By handling the heavy lifting on the server, Doconut lets you focus on business logic—whether that’s routing a contract through a multi‑stage approval workflow or exposing engineering drawings in a secure portal. The same codebase works across .NET 6, .NET Core, and the latest .NET 8, giving you a experience without vendor lock‑in.

Try it yourself – Doconut offers a 30-day temporary evaluation license. Confirm which released plugins are included in the evaluation before testing.


Key Takeaways

  • Server‑side rendering and stream‑based delivery eliminate stale‑link attacks and keep raw files inside the trusted perimeter.
  • Application-managed policy enforcement can combine storage protection with Doconut’s custom watermarks and released Annotation Plugin.
  • Application-owned authorization checks can be applied before opening a document or enabling annotation.
  • Custom watermarks can add identifying text to rendered pages; the surrounding application owns printing policy and controls.
  • Audit logs must be created and retained by the surrounding application.
  • HTML5 viewer works on any modern browser, making it ideal for React, Angular, Vue, or Blazor front‑ends.
  • Doconut’s 30-day temporary evaluation license lets you test the SDK with representative files and deployment conditions.

Common Questions

Q1: Does Doconut require Microsoft Office to be installed on the server for Word or Excel conversion?
A: No. Doconut’s Converter Plugin performs all Office‑to‑PDF and other format conversions on the server without needing a local Office installation.

Q2: Can I use Doconut in an air‑gapped environment?
A: Yes. Because Doconut processes documents entirely on‑premises and does not depend on external SaaS services, it works in isolated networks.

Q3: How does Doconut handle large files?
A: Doconut streams document pages on demand, loading only the required portions into memory. This paging approach works well with background jobs and large‑scale workloads.

Q4: Is the viewer accessible for users with disabilities?
A: Doconut does not carry a guaranteed WCAG or ADA compliance claim. Assess the complete application and implement the accessibility work required by your users and obligations.

Q5: Where can I get an evaluation license?
A: Visit the official Doconut site (https://doconut.com) and request a 30-day temporary evaluation license. Confirm plugin access for that evaluation; OCR is not a Doconut capability.

#document viewer#security#.NET#enterprise architecture#annotation