Table of Contents
ToggleIntroduction
A law firm automates their client intake forms using Docassemble. Beautiful workflow, clean UI, clients love it. Then six months later, someone realizes that with a simple URL tweak, any authenticated user could access any other client’s documents. No breach notification was sent. No one noticed for weeks.
This isn’t a hypothetical. Variations of this story happen in legal tech more than anyone publicly admits.
Legal automation tools like Docassemble are genuinely powerful — they can transform how law firms, legal aid organizations, and courts serve clients at scale. But with that power comes a serious responsibility. You’re handling attorney-client privileged communications, sensitive personal data, financial disclosures, immigration records, and family court documents. The kind of data that, if exposed, doesn’t just hurt your reputation — it destroys trust and potentially harms real people.
This guide covers Docassemble security best practices that go beyond basic setup. Whether you’re a solo developer, a legal tech team, or a law firm managing your own deployment, this is your practical handbook for building secure, audit-ready legal automation workflows.
Why Security Matters in Legal Automation Workflows
Before we get into the technical specifics, let’s establish why legal automation sits in a uniquely high-risk category.
When you automate a legal workflow, you’re not just digitizing a form. You’re creating a system that:
- Stores privileged communications between attorneys and clients — legally protected information
- Processes PII at scale — names, social security numbers, immigration status, medical histories, financial records
- Interacts with multiple user types — clients, paralegals, attorneys, admins, sometimes opposing counsel
- May integrate with court systems, case management platforms, or government APIs
In the US, legal professionals are bound by ethics rules — most jurisdictions follow the ABA Model Rules of Professional Conduct — which include a duty of competence that now explicitly encompasses technology and data security. A security failure in a legal app isn’t just a technical problem. It can be a bar complaint, a malpractice claim, or both.
Add to that the patchwork of US data privacy laws — HIPAA if health data is involved, FERPA for education-adjacent work, state-level laws like CCPA in California — and you start to understand why treating docassemble security as an afterthought is genuinely dangerous.
Right. Now let’s build it properly.
Start With Strong Access Control
Access control is the foundation everything else rests on. Get this wrong and no amount of encryption or monitoring will save you.
The fundamental principle here is least privilege: every user, every role, every API integration should have access to exactly the resources they need — and nothing more. Not “probably fine” access. Not “we’ll lock it down later” access. Exactly what they need, right from the start.
In Docassemble’s native framework, access control is managed through roles and privileges assigned to user accounts. But the default configuration is designed for flexibility, not maximum security — which means it’s on you to tighten it.
Start with these questions before writing a single line of interview logic:
- Who are the user types in this system? (Client, paralegal, attorney, admin, super-admin?)
- What data does each user type need to read? What do they need to write?
- Are there interview sessions that should be completely isolated between users?
- Can a logged-in user ever navigate to another user’s session or document?
Answering these before building saves you from the URL-manipulation vulnerability described in the opening. Session isolation, object-level authorization checks, and role-based content rendering aren’t optional in legal apps — they’re table stakes.
Define User Roles Before Building the App
This section deserves its own heading because it’s the step most developers skip in the excitement of building features.
User role definition is an architecture decision, not a UI decision. The roles you define before building determine how your data model, your interview branches, your file storage, and your API integrations are structured.
A well-structured role hierarchy for a legal automation application might look like:
- Client: Can initiate and complete their own interviews, upload their own documents, view their own generated outputs. Cannot see any other client’s data — ever.
- Paralegal: Can view assigned client interviews, annotate or flag responses, cannot modify completed submissions without attorney approval.
- Attorney: Can review, edit, and finalize documents; can see all matters assigned to them; cannot access matters outside their scope.
- Admin: Manages user accounts, permissions, and configurations. Does not need access to client matter content — and shouldn’t have it by default.
- Super-Admin / DevOps: Infrastructure-level access only. If your DevOps engineer can read client intake forms through the admin panel, your role architecture has a problem.
Map these roles on paper before touching your Docassemble configuration. Then enforce them at the application layer, the database layer, and the API layer — not just the UI layer. Because determined users don’t always use the UI.
Protect Sensitive Legal and Client Data
Data protection in a legal context means more than just “we use HTTPS.” (Though we’ll get to docassemble HTTPS setup shortly — and yes, it’s mandatory.)
Here’s a layered approach to data protection:
Classify Your Data First Not all data in a legal app is equally sensitive. A client’s name and email address are PII. Their immigration status, mental health history, or financial affidavit is highly sensitive PII. Your encryption, access controls, and retention policies should reflect that tiered sensitivity.
Encrypt Data at Rest Database-level encryption using AES-256 should be standard. If you’re deploying Docassemble on a cloud provider — AWS, GCP, Azure — enable encryption on your database instance and file storage. This is usually a checkbox, but it’s a checkbox many people forget to check.
Enforce HTTPS Everywhere Docassemble HTTPS setup isn’t optional. All traffic between clients and your server — and between your server and any integrated APIs — must be encrypted in transit using TLS 1.2 minimum, TLS 1.3 preferred. Let’s Encrypt makes this free and automatable. There is no excuse in 2024 for a legal app running on HTTP.
Field-Level Encryption for the Most Sensitive Data For fields like SSNs, financial account numbers, or medical record identifiers, consider application-level encryption on top of database encryption. Two layers. Because when it comes to this category of data, paranoia is a feature.
Secure Your Backups Your backups are a copy of your most sensitive data. They need the same encryption standards as your live database. An encrypted database with an unencrypted backup sitting on a public S3 bucket is not a security strategy — it’s a liability waiting to be triggered.
Use Secure Authentication for Every User
Docassemble authentication configuration is one of the most impactful security decisions you’ll make — and one of the most commonly misconfigured.
Default Docassemble installations support several authentication methods. Here’s how to harden them:
Enforce Strong Password Policies Minimum 12 characters, complexity requirements, and rate-limited login attempts. Lockout after repeated failures. Log every failed attempt.
Implement Multi-Factor Authentication (MFA) For attorney and admin accounts, MFA is non-negotiable. TOTP (Google Authenticator, Authy) is the minimum. For high-sensitivity deployments, hardware tokens are worth considering. Client-facing accounts should be strongly encouraged to enable MFA, even if not mandated.
Consider SSO for Law Firm Deployments If you’re deploying for a law firm that already uses Microsoft 365 or Google Workspace, integrating with their existing SSO (Single Sign-On) infrastructure using SAML or OAuth 2.0 dramatically reduces credential management risk and aligns with existing IT security policies.
Session Management Idle sessions should time out automatically — 15 to 30 minutes for sensitive legal workflows. Implement forced re-authentication for high-stakes actions like submitting a final document or authorizing a filing. Session tokens should be rotated after login and stored securely.
Secure Password Reset Flows Password reset tokens must be single-use, time-limited (60 minutes maximum), and delivered to a verified email address. A password reset flow that can be abused is a full authentication bypass. This is not theoretical — it’s one of the most commonly exploited vulnerabilities in web applications.
Build Audit Trails for Important Actions
If you’re building legal automation tools and you don’t have comprehensive audit trails, you’re not just missing a SOC 2 checkbox — you’re missing something that attorneys literally need for professional liability purposes.
An audit trail in a legal Docassemble application should capture:
- User authentication events — logins, logouts, failed attempts, MFA triggers, password changes
- Interview actions — session started, interview step completed, response modified, session abandoned
- Document events — document generated, downloaded, shared, deleted
- Administrative actions — user created, role changed, permission modified, account deactivated
- Data access events — who viewed which client record and when
Engineering requirements that actually matter:
- Logs must be immutable — stored separately from application data, write-once. An audit log that can be edited is not an audit log.
- Logs must be timestamped with UTC precision and tied to authenticated user identity
- Logs must be retained for a meaningful period — at minimum one year accessible, longer for archived records depending on your state bar’s record retention requirements
- Logs should be monitored — not just stored. A log file no one reads is an expensive decoration.
If you’re integrating AI or LLM capabilities into your workflows through docassemble AI and LLM integration, audit trails become even more critical. You need to log what AI-assisted suggestions were presented, which were accepted or modified by the user, and what final output was generated. This creates the human-oversight paper trail that responsible AI deployment in legal contexts demands.
Manage File Uploads and Document Storage Carefully
Legal apps handle a lot of file uploads. Identification documents, financial statements, medical records, signed agreements — all coming in from users whose technical sophistication ranges from “power user” to “my grandchildren helped me click upload.”
This creates real attack surface that’s often underestimated.
Validate File Types Rigorously Accept only what you expect. If your intake form needs a PDF or JPG, only accept PDFs and JPGs — validate at the MIME type level, not just the file extension. File extension spoofing is trivially easy. A renamed .exe masquerading as a .pdf is not something you want executing on your server.
Scan Uploaded Files for Malware Integrate a virus scanning solution for every file uploaded. ClamAV is open-source and Docassemble-deployable. Commercial cloud-based options are also available. Either way, don’t let unscanned files reach your storage.
Isolate File Storage by User Each client’s uploaded documents should be stored in an isolated path or container with access controls that prevent cross-user access. A URL like /uploads/client_documents/interview_23847/id_scan.pdf that’s guessable by incrementing the interview ID is a catastrophic design flaw.
Apply Retention Policies to Uploaded Files Files that are no longer needed should be deleted on a defined schedule, not kept indefinitely. This reduces your breach exposure and aligns with data minimization principles.
Secure Data Sharing Between Clients, Lawyers, and Admins
Legal workflows almost always involve multiple parties who need controlled access to the same information at different stages.
A client fills out an intake form. A paralegal reviews it. An attorney adds notes. A document is generated and shared with the client for signature. Each of these steps involves a different actor accessing the same underlying data — and each handoff is a potential security gap.
Build sharing with these principles:
- Explicit sharing, not implicit access — a paralegal should see a client’s file because they were assigned to it, not because they’re logged in and the client ID is in a URL
- Time-limited sharing links for document delivery — when you send a client a link to their generated document, that link should expire after a defined period (24–72 hours is reasonable)
- Audit every share event — who shared what with whom, when, and whether it was accessed
- No “reply-all” data exposure — when notifying multiple parties, ensure you’re not cc’ing everyone on communications that should be role-restricted
Docassemble API security becomes particularly important here if you’re using the Docassemble API to push documents to external systems — a case management platform, a document signing service, or a client portal. API keys should be scoped to minimum necessary permissions, rotated regularly, and stored in a secrets manager, never hardcoded.
Follow Safe Data Retention and Deletion Practices
Here’s a concept that surprises many legal app developers: storing data you don’t need is a liability, not an asset.
Every piece of client data you retain beyond its useful life is data that could be exposed in a breach, subpoenaed in litigation you didn’t anticipate, or subject to a data subject access request under state privacy laws.
Build retention policies into your application from the start:
- Define how long each category of data is retained (intake responses, uploaded documents, generated outputs, audit logs)
- Automate deletion at the end of the retention period — relying on manual deletion is relying on someone to remember
- Implement soft deletes with a hard delete schedule — tombstone records before permanently removing them, in case of appeals or disputes
- Document your retention policy and make it accessible in your privacy notice — clients have a right to know
When a client requests deletion of their data (which is a legal right under several US state laws and growing), your system should be able to execute that deletion completely — including uploaded files, database records, generated documents, and derived data — without requiring a developer to write one-off SQL queries at midnight.
Docassemble data encryption of retained data is the last line of defense when retention periods end — ensuring that data awaiting scheduled deletion can’t be read if accessed improperly in the interim.
Monitor Unusual Activity and System Errors
Security monitoring in legal apps is the difference between catching a problem in hour one and discovering it three months later when a journalist calls.
What to monitor:
- Failed login spikes — five failed logins from the same IP in two minutes is a brute force attempt
- Unusual access patterns — a paralegal account accessing 400 client records in 10 minutes is not normal behavior
- Off-hours administrative activity — config changes at 3am deserve a second look
- API error rate spikes — sudden increases in 401 or 403 errors from an integration may indicate credential compromise
- Large data exports — someone downloading 2GB of client documents in a single session warrants investigation
Build alerting that actually wakes someone up for critical events. A monitoring dashboard that no one looks at is just an expensive screenshot.
Document your incident response process before you need it: who gets notified, what’s the containment procedure, when do clients get notified, what’s the regulatory notification timeline? Most US states have breach notification laws with specific timelines — typically 30 to 72 hours for covered entities. Knowing this in advance is considerably more useful than discovering it at 11pm on a Friday.
Common Security Mistakes in Docassemble Projects
Consider this a greatest hits list — except none of these are hits you want to have:
- Running Docassemble on HTTP in production. We’ve covered this. HTTPS setup is table stakes. There is no scenario where this is acceptable for a legal app.
- Using the default secret key without changing it. Docassemble’s SECRET_KEY is used for session security. The default is a well-known string. If you didn’t change it, your sessions are compromised.
- Leaving the Docassemble Playground accessible in production. The Playground lets you execute Python code on the server. Leaving it accessible to non-admin users is essentially handing them a command prompt.
- Storing API keys in interview YAML files. They end up in version control. Version control ends up on GitHub. GitHub is public. This chain of events happens more than anyone admits.
- No session isolation between users. Interview sessions should be completely isolated. Ensure that a user cannot access another user’s session by guessing or manipulating a session ID.
- Skipping penetration testing before launch. “We didn’t find any vulnerabilities” and “we didn’t look for any vulnerabilities” are not the same statement. Get a qualified third party to test your application before going live.
- No process for dependency updates. Docassemble and its Python dependencies receive security updates. Running outdated packages is running known vulnerabilities. Automate dependency scanning and establish an update cadence.
Final Thoughts
There’s a pattern in legal tech — and in software generally — where security gets treated like the coat of paint you apply after the house is built. It looks fine from the outside. But the foundation is still wood, and it still burns.
In legal automation, this approach isn’t just technically flawed — it’s ethically problematic. The clients using your Docassemble workflows are often in vulnerable situations: facing eviction, navigating immigration proceedings, dealing with family law crises. They’re trusting your system with the most sensitive details of their lives because they have no other option.
That trust deserves more than a checkbox. It deserves architecture that protects them by design, audit trails that create accountability, access controls that enforce the principle of least privilege, and monitoring that catches problems before they become catastrophes.
The good news is that building secure legal automation isn’t mysterious. It’s methodical. Define your roles before you build. Log everything that matters. Encrypt everything sensitive. Test before you launch. Monitor after you launch.
And if you’re integrating modern capabilities like AI-assisted document generation into your workflows, partner with developers who understand both the power and the responsibility — teams that have built docassemble security into production legal apps before and know where the landmines are buried.
Build the trust in. Don’t laminate it on afterward.
FAQ
1. What are docassemble security best practices?
Docassemble security best practices are the steps used to protect legal automation workflows, client data, uploaded documents, user access, and system activity. These practices include secure login, role-based access, audit trails, encryption, safe file handling, and proper data retention rules.
2. Why are docassemble security best practices important for law firms?
Docassemble security best practices are important because law firms handle sensitive client information, case details, legal documents, IDs, financial records, and confidential communications. If the platform is not secured properly, it can create privacy risks, compliance issues, and trust problems with clients.
3. How does access control improve Docassemble security?
Access control improves Docassemble security by making sure users only see the information and workflows they are allowed to access. For example, clients, lawyers, admins, and support users should have different permissions. This reduces the risk of accidental data exposure or unauthorized access.
4. Should Docassemble workflows include audit trails?
Yes. Audit trails are an important part of docassemble security best practices because they help track key actions such as logins, document uploads, form submissions, edits, downloads, approvals, and admin changes. This gives law firms a clear record of what happened and when.
5. How should legal documents and client data be handled in Docassemble?
Legal documents and client data should be stored securely, encrypted where possible, and accessed only by authorized users. Law firms should also define how long data is kept, when it should be deleted, and who can download or share files. Safe data handling is a key part of docassemble security best practices.
6. What are common Docassemble security mistakes to avoid?
Common mistakes include weak passwords, shared admin accounts, missing user roles, no audit logs, unsecured file uploads, poor backup practices, and storing sensitive data longer than needed. These issues can create security gaps even if the workflow itself works properly.
7. How can a law firm start applying docassemble security best practices?
A law firm can start by reviewing user roles, securing login access, enabling audit trails, protecting uploaded files, checking hosting security, and setting clear data retention rules. The best approach is to think about security during the planning and development stage, not after the Docassemble workflow is already live.