> ## Documentation Index
> Fetch the complete documentation index at: https://docs.khanhng.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 5.3 Data Handling and Privacy

> Data Handling and Privacy for ReportGeneratorTool.

## Data inventory and retention standard

The periods below are service-policy defaults to implement and verify in storage, workflow history and telemetry. They do not describe retention already demonstrated by the repository.

| Information | Purpose | Retention standard |
| - | - | - |
| Portal credential reference | Authenticate a single job | Delete on completion or cancellation; maximum 24 hours |
| Raw CSV and chart image | Calculate metrics and render the PDF | Delete in cleanup after every outcome; failed cleanup reconciled within 24 hours |
| Temporary PDF | Upload and attach the report | Same cleanup rule as other temporary files |
| Stored PDF | Authorized download and email retry | 30 days from creation |
| Job and delivery metadata | Status and delivery investigation | 30 days from creation |
| Application diagnostic events | Troubleshooting without payloads | 30 days |
| Security audit events | Investigate access and administrative activity | 90 days, excluding credentials and report contents |
| Backup copies, when enabled | Recovery | Document the configured expiry, capped at 35 days |

Report metadata can remain until its scheduled purge even when the PDF is unavailable. Follow the API contract's 410 response while an expired report's metadata exists, and 404 after metadata is removed. Deletion jobs must cover blobs, database records, workflow history and temporary credential references. Keep only the minimal non-content audit record needed to show that deletion completed.

## Collection and processing

Collect one authorized device, the requested time range and the recipients needed for that report. Do not include passwords in filenames, blob names, report IDs or customer-visible errors. Use an opaque report ID as the storage object key and store the display filename as metadata. Escape client-supplied text before inserting it into report HTML. Sanitize attachment filenames and reject path separators and control characters.

Use one temporary directory per job with restrictive filesystem permissions. Delete it in a finally block after success, failure or cancellation. A cleanup failure must create a reconciliation task without marking unsafe cleanup as complete. Never choose another job's CSV from a shared directory.

## Storage and transport

Require HTTPS and valid certificates for API, portal and storage traffic. Use private report containers and authorize access through the service. Require encryption at rest in the selected storage service and verify its configuration before release. Exclude report bytes and credentials from shared caches. Return private, no-store cache headers on authenticated PDF downloads.

## Email boundary

Validate recipient syntax, count and workspace policy before queueing a job or retry. Use the 1-to-20-recipient contract limit and require explicit approval for external domains where workspace policy restricts them. Provider acceptance is not proof of inbox delivery. An email attachment creates a copy outside application retention and deletion controls. Do not promise to erase or recall recipient-mailbox copies. Use an authorized link-based delivery option instead of attachments when the workspace's information policy prohibits attachments; implement that delivery mode before enabling it.

## Privacy requests and service providers

Route deletion and correction requests through the workspace administrator. Verify requester authority, identify affected report IDs, record the action and report any retained backup or mailbox-copy limitations. The application does not replace a device portal's source-of-truth correction process.

Maintain an inventory of the hosting service, storage service, device portal, telemetry service and mail provider. Record processing purpose, configured region and applicable retention for each deployment. Do not claim a jurisdiction, lawful basis, contractual assurance or cross-border transfer arrangement without the workspace's approved policy and evidence.

The current code uploads PDFs to report-files, downloads the email attachment from Blob Storage and does not establish these retention controls. Sources: [src/functions/shared/utils/reportService.js](https://github.com/TQKNG/automation/blob/27045ec413f88cd2227ab08e18ec76db3e8e3d34/src/functions/shared/utils/reportService.js) and [src/functions/activity\_sendEmail.js](https://github.com/TQKNG/automation/blob/27045ec413f88cd2227ab08e18ec76db3e8e3d34/src/functions/activity_sendEmail.js).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.