# Private attachments — Leenkat Forms 1.0.1

Private entry uploads are private WordPress Media Library attachments. Their
Media Library URL is a permission-checked download endpoint. Private records
generate no public thumbnails, previews or image metadata.

Active storage follows wp_upload_dir(), including custom uploads and Multisite:
* New form objects: leenkat-forms/{form_id}/
* Compatibility objects/backups: leenkat-forms-private-{site_identity}/
* Entry and SQLite migration leases: leenkat-forms/locks/

A verified deny-all .htaccess is installed before private objects, partial
objects or intent markers are written. Parent and target directories are
protected. Existing registered objects receive protection during the bounded
upgrade. Apache denies direct requests with normal AuthConfig overrides enabled.
Nginx and Apache with overrides disabled do not interpret .htaccess: encryption
remains mandatory and direct requests can return only ciphertext. Ciphertext
HTTP 200 alone does not establish reviewer approval.

Sodium XChaCha20-Poly1305 secretstream authenticates each chunk, object identity
and stream ending. Full length and SHA-256 verification precede plaintext
delivery. Authorized downloads and the standard WordPress mailer read verified
plaintext in memory. No decrypted public temporary files are written. There is
no plaintext fallback. Preserve the database storage key and WordPress salts
with backups. Losing the key can make encrypted files unrecoverable.

Administrative downloads require the entry capability, ownership checks and an
action-specific nonce. Email links use separate scoped signed tokens, normally
valid for seven days. Administrative URLs are not email bearer URLs.

Historical private-file upgrade
1. Back up the database, uploads, historical private directory, keys and salts.
   Verify hashes and recovery before moving a site.
2. The former ABSPATH-parent layout is used only to discover historical sources,
   never for new storage writes. Discovery is recorded in a WordPress option.
   If a site moved before discovery, the existing
   LEENKAT_FORMS_LEGACY_STORAGE_DIR configuration constant can identify its
   restored private source outside public roots. Do not edit plugin files.
3. Authorized administration or scheduled maintenance copies at most 100
   registered records per batch. Historical plaintext streams directly into
   authenticated encrypted compatibility objects in uploads. Original keys,
   entry references and signed-link identities stay unchanged. Originals are
   retained. New journals and cursors use WordPress options.
4. Copies must match recorded length and SHA-256. Repeated runs reuse verified
   objects. Interrupted owned ciphertext partials can be retried under an
   exclusive lease. A corrupt completed object fails closed.
5. Copied historical identities resolve through uploads without the former
   installation path. Keep originals and the matching backup until a separately
   approved retention decision. Failed verification never removes the source.

Rollback
Restore a matching database, plugin, files, keys and salts snapshot. The
submitted WPCS-clean 1.0.1 baseline can still use retained historical originals
and unchanged identities. Preserve and reconcile post-snapshot submissions
before rollback. Different 1.0.1 review builds are not interchangeable backups.
Do not discard newer entries or remove originals merely because a copy exists.

Uninstall
Deactivation retains data. Standard WordPress uninstall retains it by default.
Explicit complete deletion verifies ownership and integrity, uses a durable
file-first journal, and refuses unknown files, active leases or inconsistent
configuration. Interrupted cleanup can resume with the same configuration.
Fixed deny files and empty database-lock inodes may remain, containing no user
data. Destructive network-wide uninstall remains unsupported and refuses to
remove site data. Keep the backup for recovery.

Protection requires a supported local filesystem and a secure WordPress
installation. Full database, key and filesystem compromise is outside the
direct-public-file threat model. Legacy public uploads still use the separate
Attachment Security migration and explicit source-removal approval.

