Troubleshooting

Troubleshoot attachment governance — Contact and Engagement Platform

Attachment governance failures can expose restricted documents or compromise their integrity when access controls, storage configuration, quarantine decisions, and retention records become inconsistent. This guide covers diagnosing those failures, verifying private-file protections across application and hosting boundaries, and recovering without compromising confidential records or audit evidence.

ProductContact and Engagement PlatformUpdatedNovember 20, 2026Reading time18 minutes

Application: Contact and Engagement Platform
Area: Attachment Governance & Privacy Operations
Status: Source-reviewed; deployed verification pending
Reviewed source commit: 3f246974276a5e582d09f8c48d21628b82626bc7
Estimated reading time: 17–20 minutes
Primary control: Restricted attachments must not be retrievable through public links.

Attachment failures must be diagnosed across more than WordPress. This guide connects the protected download handler, storage isolation, quarantine, scanner decisions, integrity records, retention lifecycle, and independent negative access tests into a reproducible incident procedure.

1. Goal

Identify and contain failures in private-document intake, storage, verification, access, quarantine, and retention without disclosing restricted attachments or destroying audit evidence. The primary acceptance criterion is that anonymous or unauthorized requests must not retrieve restricted attachment bytes through WordPress, the origin web server, or a CDN, while a permitted reviewer can retrieve a valid file through an authorized route.

A second criterion is accountability: every controlled status change and attempted retrieval must be attributable to the correct private record and policy. An HTTP denial or an audit row alone is not enough to establish end-to-end security.

2. Requirements

  • A staging environment matching the deployed web server and CDN routing, with a disposable synthetic document. Do not test with personal documents, client uploads, or confidential research files.
  • Authorized WordPress administrator and a separate test user without sc_intake_download_files; a browser session with no credentials; a reviewer account granted the minimum applicable capability.
  • Read-only access to the private quarantine workspace, storage health and reconciliation reports, retention-action history, and sanitized application/web-server events.
  • Release identifiers, configuration versions, UTC event times, case/inquiry link, attachment ID, expected SHA-256 and byte length, data owner, and approved risk classification.
  • A response-containment plan: if exposure is observed, disable the affected path at the origin and edge, preserve evidence, and follow the incident process before additional probing.

3. Implementation boundary and definitions

The inspected Engagement Intake implementation stores private attachment metadata apart from physical .qtn files, with quarantine and approved areas. The handler SC_EI_Admin::handle_attachment_download() checks a WordPress capability, a record-specific nonce, deletion/rejection state, an infected scan flag, and file integrity before calling SC_EI_Storage::stream_download(). See Storage implementation and Download handler and quarantine operations.

Restricted means subject to authorization and purpose-limited handling. Quarantined means not approved for normal controlled use; it does not mean that every privileged staff retrieval is prohibited. Approved means an operational file-status decision, not public publication authorization, research validity, or a grant of unrestricted redistribution.

This article is a source-reviewed troubleshooting protocol. It does not certify installed plug-in version, hosting rules, scanner availability, backups, access grants, or production privacy compliance.

4. Symptoms

  • Anonymous URL returns an attachment or a CDN-cached copy; a search index or public Media Library link exposes private file bytes.
  • A staff member gets 403/404/409 despite a visible file, or a user without the download capability receives a successful response.
  • Metadata says approved while the physical file is under quarantine/; SHA-256, size, scanner or retention state contradicts storage.
  • Integrity checks fail, approved documents disappear, a scan is not_configured or error, or a retention action remains queued despite expiry.
  • A download audit event exists but the requester reports an incomplete stream; a file is physically missing but its database row is not tombstoned.
  • The origin denies a URL while the CDN still serves it; a protection file exists but the current server does not enforce it.

5. Cause

Typical root causes are incorrect permission or nonce context, stale attachment ID, an unsupported storage path, web-root fallback misconfiguration, ignored server deny rules, CDN caching, a failed scanner, hash/size mismatch, interrupted file relocation, expired retention policy, a legal hold, or an incomplete deletion transaction.

Do not attribute a failure to the user or a particular component from its HTTP status alone. Reconcile the source record, WordPress authorization decision, physical path, origin response, edge response, and audit entries before declaring root cause.

6. Procedure: contain and capture a minimal incident record

  1. Identify the affected synthetic attachment ID, linked inquiry, environment, release, request time, actor class, URL surface (application/origin/edge), expected state, and observed status. Never paste a signed nonce URL or a private filesystem path into a public ticket.
  2. If protected bytes are publicly served, restrict the exposed route immediately, invalidate accessible edge copies, block further delivery, and preserve sanitized evidence and configuration snapshots. Treat this as a security incident, not merely a knowledge-base defect.
  3. For 403/404/409 failures, avoid changing permissions or status until the file row, nonce validity, actor capability, storage health, and latest integrity report are compared.
  4. Record a unique test run ID, commit, plugin versions, web-server and CDN ruleset revisions, tester roles, test data hash, test-case IDs, and independent reviewer identity.
  5. Keep original documents and subject identifiers in authorized systems; report only opaque synthetic test IDs, status codes, byte-disclosure flags, relevant hashes, and categorical findings.

7. Trace the actual WordPress download boundary

The documented private handler is a WordPress admin-post.php action, sc_ei_download_attachment. It requires sc_intake_download_files and a nonce bound to sc_ei_download_attachment_{id}, then rejects deleted/rejected records, infected files, and failed integrity checks. A denied capability is expected to return 403; an anonymous request may return 400 if WordPress has no public action handler; an unavailable record 404; a failed integrity check 409. A bad nonce is rejected by WordPress and should not disclose bytes. See Download handler and quarantine operations.

Inspect behavior, do not invent a public REST download endpoint. The private attachment route must be tested anonymously, with a low-privilege authenticated account, an invalid/expired nonce, a deleted record, and an authorized reviewer control. An application 200 response is not sufficient without a verified file hash, audit link, and correct recipient.

Test identity Expected control Failure indication
Anonymous No protected file bytes; commonly 400/401/403/404 or a verified non-file redirect File content or protected filename disclosed
Authenticated without download capability Access denied Byte disclosure or unauthorized audit entry
Reviewer with invalid nonce Access denied Nonce bypass
Reviewer, permitted active file 200 and verified digest/length Wrong file, incomplete stream, missing attribution
Reviewer, deleted/rejected or infected file No protected file bytes State bypass

8. Test direct origin and CDN exposure

A successful PHP permission check does not control static-file delivery. SC_EI_Storage::base_dir() prefers storage outside the document root but can fall back under WP_CONTENT_DIR. The plugin writes Apache/IIS-oriented deny files, yet their presence does not prove enforcement by Nginx, reverse proxies, caching layers, object-storage mirrors, or a misconfigured virtual host. See Storage implementation and Storage reliability and reconciliation.

Use a synthetic canary and a known staging route. Test WordPress, origin-direct (bypassing the CDN in an approved manner), and CDN endpoints separately. Follow redirects only to a controlled allowlisted host, and record whether protected canary bytes were served—not whether the denial page had a nonzero HTTP body.

# Authorized staging only. URLs must be known disposable canary surfaces.
# This reports HTTP status; it cannot by itself prove that file bytes were denied.
for name in APP_ORIGIN_URL DIRECT_ORIGIN_URL EDGE_URL; do
  url="${!name}"
  printf '%s: ' "$name"
  curl --silent --show-error --max-time 8 --output /dev/null \
    --write-out 'HTTP=%{http_code} bytes_returned=%{size_download}\n' "$url"
done
# Independently compare any returned payload against a synthetic canary fingerprint.
# Never run with a client document or publicize signed URLs.

If direct content is exposed, stop the trial and contain the route. Do not attempt bulk path enumeration, upload real secrets as canaries, or assume a 302 redirect protects data without checking its eventual destination.

9. Verify storage configuration without disclosing paths

Storage health reports whether the private base exists, is writable, is outside the WordPress and document roots, has protection files, is a symlink, and whether quarantine/approved directories are writable. The base path itself should not enter public reports. An outside-root result is preferable, but filesystem mounts, symlinks, and serving rules still warrant independent verification.

# Run only in an authorized staging WP-CLI shell.
# Deliberately prints booleans, not the private directory path.
wp --path="$WP_ROOT" eval '
  if (!class_exists("SC_EI_Storage")) { exit(2); }
  $h = SC_EI_Storage::storage_health();
  foreach (["exists","outside_document_root","outside_wordpress_root",
            "protection_files","base_is_symlink","quarantine_writable",
            "approved_writable"] as $k) {
    printf("%s=%s\n", $k, json_encode($h[$k] ?? null));
  }
' 

If outside-root isolation fails, the safer remediation is a reviewed storage configuration and migration with verified backups—not changing the live path ad hoc after files are committed. The plugin documents path locking after first accepted upload; follow its storage recovery process.

10. Reconcile quarantine, approval, and scanner state

Quarantine status, validation status, scan status, physical storage area, and integrity status are separate variables. Approval requires a validated file, no infected result, and healthy storage verification; clean-required mode additionally requires clean. External scanning is optional unless that policy is enabled. The scanner interface can return clean, infected, error, skipped, or not_configured. See Quarantine operations and Scanner integration and clean-required policy.

Observed state Interpretation Correct next action
quarantined + not_configured Private review state; no malware-clearance proof Check scanner policy and reviewer authority
quarantined + clean Scan reported clean; not necessarily approved Verify integrity and human approval
approved + hash mismatch Metadata and physical bytes disagree Block download; preserve record for reconciliation
infected Unsafe artifact; download handler blocks Isolate and follow scanner incident procedure
deleted with physical file present Deletion completion not established Restrict file access; reconcile hold and deletion evidence
retention expired with file still present Not necessarily a defect: queue/approval still pending Inspect governed retention lifecycle

11. Diagnose upload-validation failures

The intake validator checks count/size limits, declared and detected media types, container signatures, content-specific restrictions, and SHA-256. The documented recommended defaults are five files, 20 MB each, and 180-day retention; PHP limits can be lower, and actual settings must be read from the environment. Supported formats in the cited contract are PDF, DOCX, XLSX, CSV, TXT, PNG, JPG/JPEG. See Upload validator and Document intake contract.

Disagreement between filename extension and detected content is a validation issue. CSV formula-like cells receive a flag rather than categorical rejection; DOCX/XLSX external resources and unsafe reference forms can be blocked. Investigate using a benign synthetic fixture only. Never bypass format checks by renaming a file or uploading it through the Media Library.

12. Diagnose integrity and path failures

SC_EI_Attachment_Repository::verify_record() checks path resolution, file existence, SHA-256, size, and expected area. It reports unresolvable, missing, hash_mismatch, size_mismatch, or misplaced. For a hash mismatch, the authorized download handler returns a 409 rather than the file. See Attachment metadata, integrity, and download audit.

# Offline only: a disposable fixture, NEVER a production file path.
python3 - <<'PY'
import hashlib
sample=b'synthetic-attachment-canary-v1\n'
print('sample_size=',len(sample))
print('sample_sha256=',hashlib.sha256(sample).hexdigest())
PY
# Compare the digest with the authorized staging metadata report.
# Do not paste attachment bytes into tickets or telemetry.

A SHA-256 match establishes byte consistency with a recorded hash—not malware safety, accuracy, licensing, scientific validity, or publication authorization. Inspect backup and restore provenance before any corrective writes.

13. Interpret storage reconciliation and restore failures

Storage reconciliation is bounded: the documented manual scan processes at most 1,000 active database records and 5,000 managed files per run. A capped report is partial, not proof of zero other defects. It identifies missing, mismatched, misplaced, unresolvable, and orphaned items. It does not automatically delete or repair these files. See Storage reliability and reconciliation.

For a misplaced record, capture its expected logical area and immutable digest before proposing a move. For an orphan, establish its original ownership and hold status before assigning or deleting it. Never perform blind filesystem cleanup, database rewrites, or unconditional path repair based on a summary count.

14. Check retention, legal holds, and incomplete deletion

The privacy-retention implementation queues candidate actions; expiration alone does not physically delete an attachment. Authorized execution checks approval state and legal holds, deletes the protected file, and then records the tombstone. A failure after physical deletion but before a database update may produce attachment_tombstone_failed. See Retention engine and Privacy and retention center.

  • Queued: preserve existing content until required review and approval; treat the queue as a work item, not proof of erasure.
  • Blocked by hold: do not override the hold merely because a retention deadline passed; capture hold authority and review date privately.
  • Failed delete: inspect nonsecret error codes such as physical_delete_failed, without retrying blindly.
  • Missing file with active row: establish whether deletion partially completed; do not fabricate a successful tombstone or restore data contrary to an erasure decision.
  • Deleted row with accessible bytes: treat as urgent exposure and check filesystem mirrors, backups, and CDN behavior under appropriate authorization.

15. Assess audit completeness and delivery uncertainty

The download handler records an attachment-download event before calling the stream function. Therefore an audit event can establish an authorized attempted transfer but cannot independently prove a complete byte delivery. Preserve request timestamps, response status, completed stream length, synthetic digest, source record, capability decision, and reviewer identity. Do not collect live content as a substitute for telemetry.

An independent reviewer should confirm that private audit records have actor, attachment reference, policy version, operation, timestamp, and outcome; event metadata should not contain raw file bytes or private correspondence. Avoid interpreting a count of downloads as a count of successful complete deliveries.

16. Diagnostic decision table

Symptom Likely domain Safe diagnostic Escalation
403 for authorized reviewer Capability/nonce Compare role and fresh nonce in staging WordPress access owner
409 on download Integrity Run private verification and compare digest/size Storage custodian
200 from direct static URL Origin/CDN exposure Stop canary test and preserve sanitized result Security incident
Approved record cannot be located Path/database mismatch Read-only reconciliation and backup manifest Storage operations
Not-configured scanner External integration Check probe, policy, and clean-required flag Scanner owner
Expired file still exists Retention workflow Inspect queue, approvals, and legal holds Privacy lead
Audit says downloaded but stream failed Event/transport gap Compare stream evidence and request ID Application operator

17. Controlled evidence collection schema

The companion Python checker uses a proposed synthetic test receipt, not an installed Platform REST API. Its schema stores categorical disclosure results and never requires a client document, nonce, cookie, storage path, or credential. The seven core trials comprise six denied-access cases and one authorized positive control.

{
  "schema": "sc.attachment-troubleshooting.synthetic.v1",
  "synthetic": true,
  "target": {
    "attachment_ref": "synthetic-att-001",
    "classification": "restricted",
    "quarantine_status": "approved",
    "scan_status": "clean",
    "storage": {
      "outside_document_root": true,
      "path_resolves": true,
      "digest_match": true,
      "size_match": true,
      "cdn_excluded": true
    }
  },
  "trials": [
    {"name":"anonymous_origin","tested":true,"http_status":403,
     "protected_payload_bytes":0,"file_exposed":false}
  ],
  "events": [
    {"event":"attachment_downloaded","actor":"synthetic-reviewer",
     "attachment_ref":"synthetic-att-001"}
  ],
  "retention": {
    "cron_queue_only": true,
    "deleted_on_hold": false,
    "destructive_action_without_approval": false
  }
}

This abridged illustration is not a passing complete receipt: it omits five additional negative trials and the authorized positive trial. Use packaged synthetic-pass.json as the executable example. Never publish original sensitive supporting evidence.

18. Reproduce the offline evidence check

The package contains attachment_evidence_check.py, test_attachment_evidence_check.py, and passing/failing JSON fixtures. No external packages, network access, WordPress installation, or real credentials are needed. An explicit synthetic: true flag is mandatory.

cd sc-attachment-governance-troubleshooting
python3 -m unittest -v test_attachment_evidence_check.py
python3 attachment_evidence_check.py synthetic-pass.json
python3 attachment_evidence_check.py synthetic-fail.json
# Expected: passing fixture exits 0; failing fixture exits 2.
# Test receipts validate the checker, not deployed access controls.

Acceptance requires all negative canary trials denied with zero restricted payload bytes disclosed, a correctly hashed authorized download, storage integrity, one attributed positive-control download event, and no unapproved destructive retention event. The checker deliberately rejects missing or mismatched results.

19. Quantify the evidence without overstating certainty

Report direct-access failures as a numerator and denominator for each surface, actor, release, and time window. If no unauthorized retrievals occur in n independent comparable trials, the one-sided 95% exact upper bound for the failure probability is 1 − 0.05^(1/n). For 30 trials it is approximately 9.50%; for 100 trials, 2.95%. Zero observed leaks does not prove zero risk.

Web tests may share one CDN cache, web-server rule, credential, or underlying failure, violating independence. Disclose dependence, coverage, exclusions, configuration revisions, and observation duration. Use adverse path tests alongside representative samples. Scientific truth of attachment contents is outside this operational validation.

20. Troubleshooting

  • Cannot reproduce an alleged public file URL: check origin/edge DNS, vhost, redirect chains, historical cache state, and whether it targeted another deployment; preserve only approved nonsecret logs.
  • Cannot authenticate reviewer: validate role, least-privilege capability mapping, nonce freshness, and attachment ID. Do not grant broad administrator roles just to pass a test.
  • Integrity result changes: freeze writes to the object, inspect backup/restore history, and reconcile digest and file-location evidence.
  • Scanner conflicts with approval: inspect clean-required policy, provider/version readiness, scan timestamp, and human decisions.
  • Retention count does not match files: distinguish candidates, queued actions, approved actions, executed/tombstoned items, and orphans.
  • CDN serves content after origin restriction: classify as separate edge exposure; invalidate caches under change control and independently retest.

21. Resolution

Select a bounded action addressing the proven cause while preserving evidence. For authorization defects, restore capability and nonce enforcement in a tested release. For direct static exposure, disable public serving at origin/edge and move new files to a verified non-web directory; migrate existing files only with a backup, approved change, and hash-backed reconciliation. For integrity mismatches, quarantine pending authorized restore or replacement; never overwrite a file merely to make a hash test pass.

For scanner failures, restore the verified integration and repeat synthetic readiness checks before allowing clean-required intake. For retention anomalies, follow queue, approval, hold, execution, tombstone, and verification. Roll back changes introducing unauthorized paths. Close only after independent reviewer confirmation on the corrected deployed configuration.

22. Verification

  1. All six negative canary trials fail closed across application, origin, CDN, low-privilege user, expired nonce, and unavailable record; no protected file bytes are disclosed.
  2. An authorized reviewer retrieves exactly the expected synthetic content with a matching SHA-256 and attributable audit; do not infer complete delivery from audit alone.
  3. Storage health, path containment, web-server denial, scanner settings, file state, and retention state match the accepted configuration.
  4. Quarantined files remain private; infected and rejected/deleted records cannot be downloaded; cross-context authority checks are exercised.
  5. No public API, WordPress Media Library object, link, CDN cache, public export, or diagnostic ticket discloses private bytes or privileged metadata.
  6. Reviewer records test run, server/CDN revisions, synthetic fixture fingerprint, executed cases, exceptions, corrections, residual risk, and an explicit deployment-verification decision.

23. Independent staging acceptance matrix

The package contains a 24-case execution matrix marked not run. It covers anonymous and authorized retrieval, origin/CDN separation, path traversal and symlink checks, integrity mismatch, scanner outage, legal holds, audit attribution, recovery, and rollback. It is a test plan, not evidence that the deployment is secure.

24. Publication and reporting boundary

Keep raw logs, real filenames, attachment bytes, requester identities, directory locations, and privileged links in approved private stores. Public reports may disclose aggregate denominators, synthetic IDs, categorical results, checker version, pinned commit, and statistical uncertainty. Label each statement as source review, synthetic test, staging evidence, or production confirmation.

Reproducibility alone does not eliminate biased test selection, correlated failures, environmental divergence, or absent independent review. No attachment-access test establishes the scientific or legal validity of the underlying document.

25. Technical references

Implementation review pinned to repository commit 3f246974276a5e582d09f8c48d21628b82626bc7 (August 8, 2026). These are source references—not deployed verification:

Supplementary guidance: OWASP Web Security Testing Guide (access controls); NIST SP 800-53 Rev. 5 (access control and audit); NIST Digital Identity Guidelines. Confirm applicability against current normative guidance.

Scroll to Top