Appearance
Document Preview
GhostAI provides rich visual document previews with built-in PII redaction. View uploaded files directly in the browser — with sensitive content automatically redacted — without downloading or opening them in external applications.
Supported Preview Formats
| Format | Viewer | Features |
|---|---|---|
| Native browser viewer | Page navigation, zoom, search, print | |
| Word (.docx) | HTML renderer | Formatted text, tables, lists, images |
| Excel (.xlsx) | Table renderer | All sheets with tab navigation, formatting |
| PowerPoint (.pptx) | PDF conversion | Full-fidelity slides via LibreOffice |
| CSV | Table renderer | Auto-parsed columns, formatting |
| HTML | Sandboxed iframe | Sanitized rendering with XSS protection |
| Markdown | React renderer | Full GFM support with syntax highlighting |
| Images | Native viewer | JPEG, PNG, GIF, WebP, BMP, TIFF |
| Parquet | Table renderer | Column names, row counts, sample data via pyarrow |
Security Indicators
Files with detected security threats display visual indicators in preview:
| Indicator | Meaning |
|---|---|
| Macro Warning | VBA or XLM macros detected in Office document |
| Encrypted Badge | File is password-protected and cannot be inspected |
| JavaScript Warning | PDF contains JavaScript actions |
| Steganography Alert | Statistical analysis suggests hidden data in image |
| Injection Warning | Prompt injection patterns detected in file content |
How It Works
┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────────┐
│ Upload │───▶│ Scan & │───▶│ Create │───▶│ Preview │
│ File │ │ Detect │ │ Redacted │ │ Modal │
└──────────┘ └──────────┘ └──────────┘ └──────────────┘
│ │
▼ ▼
┌──────────────┐ ┌──────────────────┐
│ Deep PII Scan│ │ Toggle: Redacted │
│ (hidden data)│ │ vs Original │
└──────────────┘ └──────────────────┘Preview Flow
- Upload: File is uploaded and encrypted at rest
- Scan: Multi-layer PII detection runs on all content
- Deep Scan: Hidden content is inspected (see below)
- Redaction: A redacted copy is created with PII removed
- Preview: Click the file to open the visual preview modal
- Toggle: Admins can switch between redacted and original views
Deep PII Scanning
GhostAI goes beyond surface-level text to find PII hidden in document metadata, comments, and embedded content.
Word Documents (.docx)
| Location | What's Scanned |
|---|---|
| Body text | All paragraphs, headings, lists |
| Comments | Review comments and replies |
| Tracked changes | Insertions, deletions, revisions |
| Headers/Footers | Running headers and page footers |
| Footnotes | Footnote and endnote content |
| Tables | All cell content |
| Text boxes | Floating text frames |
Excel Spreadsheets (.xlsx)
| Location | What's Scanned |
|---|---|
| Cell values | All visible cells across all sheets |
| Cell comments | Note and threaded comment text |
| Hidden sheets | Sheets marked as hidden |
| Named ranges | Range name definitions |
| Metadata | Document properties and custom fields |
PowerPoint (.pptx)
| Location | What's Scanned |
|---|---|
| Slide text | All text boxes, shapes, and placeholders |
| Speaker notes | Presenter notes per slide |
| Slide masters | Template text and branding |
| Embedded objects | Linked or embedded content |
| Tables & charts | Data within slide elements |
PDF Documents
| Location | What's Scanned |
|---|---|
| Page text | All extracted text content |
| Form fields | Interactive form data |
| Annotations | Comments, highlights, sticky notes |
| Embedded files | Attached documents |
| Metadata | Author, title, subject, keywords |
Images
| Detection | What's Scanned |
|---|---|
| OCR text | Visible text in the image |
| ID cards | Driver's licenses, passports, badges |
| Credit cards | Visible card numbers |
| Bank checks | Account numbers, routing numbers |
| Faces | For de-identification |
| EXIF metadata | GPS, device info, timestamps |
Redacted vs. Original View
Redacted View (Default)
The redacted view is shown by default for all users:
- Text documents: PII replaced with entity type labels (e.g.,
[PERSON],[US_SSN]) - Images: Sensitive regions blurred or covered with redaction boxes
- Bank checks/IDs: Entire image blurred for maximum protection
- PDFs: Redacted PDF with PII regions obscured
Original View (Admin Only)
Administrators and organization owners can toggle to the original, unredacted view:
- Protected by role-based access control
- Every access is audit-logged
- Visual warning banner: "ORIGINAL — Contains PII"
- Red border ring around the document
Access Control
Only users with admin or owner roles can view original (unredacted) files. All original file access is recorded in the audit log for compliance.
Download Options
Download Redacted Version
Download a copy of the file with all PII redacted:
- Documents: PII text replaced with placeholders
- Images: Sensitive regions blurred/covered
- Available to all users
Download Redaction Certificate
For compliance, download a PDF certificate documenting:
- File name and ID
- Date and time of redaction
- Number and types of PII entities found
- Redaction method used
- Compliance frameworks triggered (HIPAA, PCI-DSS, etc.)
Security Features
Content Sanitization
All rendered content is sanitized to prevent XSS attacks:
| Content Type | Protection |
|---|---|
| HTML files | DOMPurify sanitization, sandboxed iframe |
| SVG images | Script removal, event handler stripping |
| Markdown | HTML tag filtering, script blocking |
| CSS | Style attribute sanitization |
Rendering Isolation
- HTML and SVG rendered in
sandbox=""iframes - Content Security Policy (CSP) headers
- No external resource loading from rendered content
- Dangerous file types (HTML, SVG, CSS) force download instead of inline display
Encrypted File Handling
When a password-protected or encrypted file is detected:
- Clear message indicating the file is encrypted
- No attempt to brute-force or bypass encryption
- User advised to download and open locally
- Encrypted status recorded in scan results
Large File Performance
| Format | Limit | Behavior |
|---|---|---|
| HTML | 500 KB | Truncated with warning |
| Markdown | 200 KB | Truncated with warning |
| Excel | 1,000 rows | Paginated display |
| CSV | 1,000 rows | Paginated display |
| No limit | Browser native viewer handles pagination |
API Endpoints
Get File Preview Metadata
bash
curl http://localhost:8000/api/files/{file_id}/preview \
-H "Authorization: Bearer YOUR_TOKEN"Response:
json
{
"file_id": "abc123",
"filename": "report.docx",
"content_type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"text_content": "Extracted text...",
"pii_entities": [
{"type": "PERSON", "text": "John Smith", "start": 10, "end": 20}
],
"pii_redacted": true,
"has_sensitive_image_content": false,
"is_encrypted": false,
"deep_scan_locations": ["comments", "tracked_changes", "headers"]
}Get File (Redacted or Original)
bash
# Get redacted version (default)
curl http://localhost:8000/api/files/{file_id} \
-H "Authorization: Bearer YOUR_TOKEN"
# Get original version (admin only)
curl http://localhost:8000/api/files/{file_id}?original=1 \
-H "Authorization: Bearer YOUR_TOKEN"Convert to PDF (for PPTX)
bash
curl http://localhost:8000/api/files/{file_id}/as-pdf \
-H "Authorization: Bearer YOUR_TOKEN"Download Redacted Copy
bash
curl http://localhost:8000/api/files/{file_id}/download-redacted \
-H "Authorization: Bearer YOUR_TOKEN" \
-o redacted_report.docxConfiguration
LibreOffice (for PPTX Preview)
PPTX files are converted to PDF via LibreOffice for preview. Install it:
bash
# macOS
brew install --cask libreoffice
# Ubuntu/Debian
sudo apt-get install libreoffice
# Docker (included in GhostAI Docker image)Environment Variables
bash
# File preview settings
MAX_PREVIEW_SIZE=52428800 # Max file size for preview (50MB)
PPTX_CONVERSION_TIMEOUT=60 # LibreOffice conversion timeout (seconds)Best Practices
- Review redacted previews: Always verify redaction before sharing
- Use redaction certificates: For compliance documentation
- Limit original access: Restrict admin/owner roles to trusted users
- Monitor audit logs: Track who accesses original files
- Enable deep scanning: Catch PII in comments, notes, and metadata
- Download redacted copies: Share redacted versions instead of originals
RAG-Enhanced File Interaction
Files over 1 MB are automatically indexed for intelligent retrieval using RAG v2. When you ask a question about an attached file, GhostAI retrieves only the most relevant sections using hybrid BM25+semantic search. If multiple files are attached, cross-file retrieval lets you query across all of them at once — for example, comparing data in a CSV against definitions in a PDF.
See File Intelligence for full details.
Next Steps
- File Processing & RAG Intelligence — Full file scanning and retrieval capabilities
- PII Detection — Detection engine details
- Image Intelligence — Image content detection
- Dashboards — View detection analytics