Personal data in Salesforce files: what a scan can read.
Salesforce Files vs Attachments: where are files stored?
In four places, and the names matter because each is queried differently.
- ContentDocument is the file itself, as uploaded to Salesforce Files or a content library.
- ContentVersion is one version of that file, and holds its content. A file replaced twice is one ContentDocument and three ContentVersions.
- ContentDocumentLink is where the file is shared. Salesforce describes it as the link between a file or note and the users, groups, records and libraries it is shared with.
- Attachment is the older object: a file a user uploaded and attached to one parent record. Orgs that have been live for years usually hold both kinds.
The two differ in size as well. Salesforce's comparison gives a maximum of 2 GB for a Salesforce file and 25 MB for a file attachment. Both accept any file type.
Are Salesforce attachments being retired?
Many people ask. Salesforce's own comparison of the ways to hold a file still lists Attachments as one of them, for adding a file to a specific record from the Attachments related list. We found no retirement date on the pages we read. Whatever Salesforce decides, the attachments already in an org stay where they are until someone moves them, so a review of personal data has to cover both.
Notes written in the enhanced notes editor are files too. They are linked to records through ContentDocumentLink in the same way.
Salesforce's documentation for this section: ContentDocument, ContentVersion, ContentDocumentLink, Attachment, Differences Between Files, Documents and Attachments.
Does a query on ContentDocument return every file?
Not necessarily, and this catches people out. Salesforce's reference says that, depending on how files are shared, a query on ContentDocument or ContentVersion without an ID does not return all the files a user has access to. Its example: a user who can see a file only because it is shared with a record they can see will not get that file back from a plain query.
So the first honest answer to “how many files do we hold?” is usually a lower bound. Any tool that gives you a file count should say which files it could see and which it could not. Salesforce allows up to 30 million documents in an org, so the gap can be large.
Salesforce's documentation for this section: ContentVersion, ContentDocument.
Does Salesforce Data Detect scan files and attachments?
No. Salesforce's documentation lists what Data Detect scans: text, long text, long text area, encrypted text and rich text fields. Files and attachments are not among them. That is not a flaw in Data Detect. It is a field scanner, and it does that job inside the platform. But it means a clean Data Detect result says nothing about your files.
For what Data Detect and Salesforce's other tools do cover, see our guide to Shield, Data Detect and Security Center.
Salesforce's documentation for this section: Create a Data Detect Policy and Run a Scan, Get Started with Data Detect.
What can be read from a file inside Salesforce, and what cannot?
It depends on the file. This is what Org Warden does with each kind, including the kinds it cannot read. We set it out in full because the limits are where a file scan either earns trust or loses it.
Word and Excel files (.docx, .xlsx), text, CSV, HTML, XML, JSON, notes
PDFs that contain text, and older Word and Excel files (.doc, .xls)
Scanned documents, photographs, images
Saved emails (.msg, .eml), archives, audio, video
Large files
Password-protected files
Three more limits worth knowing before you rely on any figure:
- Only the latest version of a file is read. An earlier version that held something the current one does not is not scanned.
- A file that arrived by email belongs to the email message, not to the case. The pack says so, because counting files per case would under-report.
- What the search index says lags behind what was uploaded, so every count that comes from it is a lower bound.
Can personal data inside a PDF be found?
Partly, and it is worth being exact. Org Warden does not open PDFs. For a PDF that contains text, it asks Salesforce's search index whether particular words are in it: a health condition, a blood type, a term from one of its vocabularies. A match tells you the word is in the file. It is evidence of a term, not a validated finding, and the pack labels it that way.
What this cannot do is find a number. A rule that checks a card number's check digit, or the shape of a National Insurance number, needs the text in hand, and the index does not give it. Most of Org Warden's rules are of that kind, so for PDFs most rules are listed in the pack as not asked. A scanned PDF, which is a picture, cannot be reached at all.
If most of your sensitive documents are scanned PDFs, no tool that works inside Salesforce without sending the files elsewhere will read them. That is a real limit, and a reason to know how many such files you hold and where they are attached.
What does a file scan report, and what leaves the org?
An Org Warden file scan sorts every file it can see into one of four groups: read, asked about through the search index, excluded with the reason, or not reached. The four add up to the files counted, so nothing is silently dropped.
Findings are counts: this rule matched in this many files of this type. No file name, title or path is in the Evidence Pack, and no file content or record ID. Where a count is under five, the exact number is withheld.
Seven questions to ask about any file scan.
- Which file types are opened and read, and which are only searched?
- What happens to a PDF? To a scanned PDF?
- Is there a size above which a file is not read, and are those files listed?
- Is every version of a file read, or only the latest?
- Whose access does the scan run with, and which files could it not see?
- Do the files, or anything from inside them, leave the org?
- Does the result say what was not read, or only what was found?
Our own answers to all seven are in the sections above. The last question matters most: a scan that reports only what it found leaves you unable to say what you have checked.
Questions people ask about files in Salesforce.
Does Salesforce Data Detect scan files and attachments?
No. Salesforce’s documentation lists the field types Data Detect scans: text, long text, long text area, encrypted text and rich text. Files and attachments are not among them.
What is the difference between ContentDocument and ContentVersion?
ContentDocument represents the file. ContentVersion represents one version of it, and holds the content. Upload a new version of a file and you have one ContentDocument with two ContentVersions.
What is ContentDocumentLink?
It is the record of where a file is shared. Salesforce describes it as the link between a file and the users, groups, records and libraries it is shared with. One file attached to three cases has three links.
Does a query on ContentDocument return every file?
Not necessarily. Salesforce’s reference says a query without an ID does not return all the files a user has access to: a file the user can see only because it is shared with a record they can see is not returned.
Can personal data inside a PDF in Salesforce be found?
Partly. Org Warden does not open PDFs. It asks Salesforce’s own search index whether words from its health and other vocabularies appear in them. That shows a term is present. It cannot validate a card number or a National Insurance number, and a scanned PDF with no text in it cannot be reached at all.
Are Salesforce attachments deprecated?
Salesforce’s comparison of Files, Documents and Attachments still lists Attachments as a way to add a file to a record, with a 25 MB limit against 2 GB for Salesforce Files. We found no retirement date on the pages we read. Attachments already in an org stay there until someone moves them.
Salesforce Files vs Attachments: what is the difference?
Attachment is the older object: a file uploaded and attached to one parent record. Salesforce Files use ContentDocument and can be shared in many places. An org that has been live for years usually has both.
Book a demo.
In a demo we take you through the Console on a demonstration estate whose data is all made up: a rule opened onto every org where it matched, and an Evidence Pack checked by its hash.