Confidential files
The Confidential files app (files_confidential) classifies files automatically and marks them with a collaborative
tag. You define a list of classification labels. Each label is linked to a tag and has rules that decide when a file
gets that label: text in the document, TSCP/BAILS policy categories, or document metadata.
The app only assigns tags. To restrict, retain, or otherwise act on classified files, combine the tags with other apps, for example Files access control or Retention of files.
Requirements
Nextcloud 33 or later.
The PHP extensions
dom,libxml, andzip.To enforce access restrictions based on the assigned tags: the File Access Control app.
How it works
Every time a file is created or its content changes, the app checks it against all classification labels:
TSCP/BAILS categories: a label matches if the document carries all category IDs configured for the label.
Metadata: a label matches if the document has all configured metadata keys with exactly the configured values.
Content: a label matches if the document text contains one of the label’s keywords, built-in search expressions, or regular expressions. Matching is case-insensitive.
A file receives at most one classification label. If labels from different rule types match, the label that is higher in the list wins.
The app also removes any of its own tags that no longer apply. If a document is edited and no longer matches a label, its classification tag is removed. If it now matches a different label, the tag is replaced. Tags that are not used by a classification label are never touched.
Every change of classification is written to the audit log when the admin_audit app is enabled.
Note
Files are only classified when they are written. Files that already exist when you enable the app or change the rules are not classified until their content changes.
Supported file types
Rule type |
File types |
|---|---|
Content (keywords and expressions) |
Plain text, Markdown, CSV, HTML, PDF, ODT/OTT/OTH/ODM, DOCX/DOCM/DOTX/DOTM |
Metadata |
Microsoft Word, Excel, and PowerPoint (OOXML formats such as DOCX, XLSX, PPTX, and their macro and template variants) |
TSCP/BAILS categories |
Microsoft OOXML formats as above, and OpenDocument formats (text, spreadsheet, presentation, graphics, and their templates) |
Content rules only read the text layer of PDF files and do not perform OCR, so scanned PDFs without a text layer cannot be classified.
Files in end-to-end encrypted folders cannot be read by the server and cannot therefore be classified.
Configuration
Install and enable the Confidential files app as described in Apps management, then open .
Classification rules
Click the Add new label button.
In the Select or create tag field, pick an existing tag or type a name to create a new one. Use restricted or invisible tags so that regular users cannot remove the classification.
Add one or more rules:
… if document has TSCP policy category ID: one or more BAILS category IDs.
… or if document has all metadata values: pairs of Metadata key and Metadata value. For OOXML files these are the custom document properties stored in
docProps/custom.xml.… or if document contains: keywords, regular expressions, or built-in search expressions. The built-in expressions cover common personal data such as e-mail addresses, IBANs, credit card numbers, and several national ID and driver’s license formats.
Changes are saved automatically. You can only add a new label once every existing label has a tag.
Example: Block access to classified documents
This example blocks access to any document that contains the word Confidential for everyone outside the Legal
group.
In , add a label with the restricted tag
Confidentialand the keywordConfidential.In , add a File Access Control rule with these conditions:
File collaborative tag is
ConfidentialUser group membership is not member of
Legal
Upload a document containing the word
Confidential. The file gets theConfidentialtag, and users outside theLegalgroup can no longer open, download, or sync it.
See Files access control for details and common pitfalls, such as public links.