Worked Examples

Validate scientifically attachment governance — Contact and Engagement Platform

Attachment governance protects restricted documents through controlled storage, access authorization, integrity verification, quarantine, and retention policies. This guide establishes a reproducible validation framework for determining whether those controls prevent unauthorized retrieval while preserving evidence, privacy, and accountable human review.

ProductContact and Engagement PlatformUpdatedNovember 20, 2026Reading time18 minutes

Application: Contact and Engagement Platform
Category: Attachment Governance, Privacy & Scientific Validation
Verification: Source reviewed; offline tests passed; staging and production not tested
Reading time: Approximately 18 minutes
Last editorial review: November 20, 2026
Scope: Authorized staging and synthetic materials only

Attachment governance must protect restricted file bytes and records across application permissions, private storage, file validation, scanner controls, retention decisions, and the web/CDN delivery path. The primary falsifiable test is whether an unauthorized request can retrieve the designated restricted synthetic attachment through a public URL. This procedure creates reproducible security evidence without treating a passing HTTP check as a general scientific claim.

1. Goal

Determine, with independently inspectable evidence, whether attachment governance prevents unauthorized retrieval of restricted file bytes and metadata while preserving legitimate authorized access, integrity checking, quarantine, and governed retention. The primary security assertion is narrower than the full platform security posture: restricted attachments cannot be retrieved through public links. A passing test of this assertion does not establish malware-detection accuracy, legal compliance, identity correctness, or the scientific validity of any document’s contents.

Operational verdicts must be evidence-based: pass only for the tested release, server, route, actor, content state, time, and observation; fail on a demonstrable unauthorized byte or private-metadata disclosure; inconclusive for incomplete coverage, ambiguous login pages, missing logs, or unsupported hosting assumptions. Do not claim site-wide assurance from an offline fixture or a healthy dashboard.

2. Requirements

  • An explicitly authorized isolated staging installation using disposable, nonidentifying synthetic attachments and accounts; no production files, real senders, or credentials.
  • A pinned plugin commit, active WordPress/PHP versions, HTTP server and reverse-proxy/CDN configuration, file-storage base path, site timezone, and enabled quarantine, scanner, and privacy policies.
  • Role fixtures: unauthenticated browser, authenticated account without file-download capability, authorized reviewer, and a separate tenant/organization or role where relevant to the deployed model. Do not infer tenant isolation from a role name alone.
  • Controlled fixtures with independently recorded byte count and SHA-256, including permitted PDF/TXT/PNG/CSV content, oversize and MIME-disagreement cases, and a non-malicious scanner-failure simulation.
  • Permission to inspect restricted audit records without exporting personal data. Confirm named test owner, independent reviewer, escalation contact, and retention of sanitized evidence packets.

Do not test public hostnames or attempt path traversal against production without explicit operational authorization. The examples below are offline; the 24-case staging matrix is not executed.

3. Definitions, security states, and evidence boundaries

An attachment record is metadata and an internal reference to stored bytes. Quarantined means held for privileged review, not necessarily inaccessible to authorized staff. Approved means authorized controlled-use state, not public distribution. Rejected/deleted mean the physical object should not be downloadable; metadata tombstones may remain. Scanner clean is one input into a policy, not proof of safety. Consent, legal hold, and retention are distinct governance authorities.

Separate an observed HTTP response, a file-content hash comparison, the corresponding authorization event, and a reviewer interpretation. A 403 response is a data point; a series of 403s alone cannot establish absence of alternative public file routes. A SHA-256 match establishes byte identity, not authenticity of the submitter or validity of the scientific claims in the file.

4. Research questions and preregistered hypotheses

H1 (privacy): anonymous clients, unauthorized accounts, and direct web/CDN paths obtain no synthetic restricted file bytes or case-private metadata under the tested configurations. H2 (positive control): the authorized reviewer can retrieve a permitted file only through the protected handler, and retrieved bytes match the original SHA-256. H3 (rejections): infected, deleted, rejected, and integrity-mismatched objects fail closed. H4 (audit): every permitted download has an attributable actor/event and blocked activities produce appropriate nonsecret evidence. H5 (governance): expiry, restriction, and legal holds do not silently bypass authorized privacy and retention decisions.

Predeclare the release scope, sample selection, required denial status classes, permitted redirect targets, and exact definition of “retrieval” before collecting results. Never change the acceptance criterion after inspecting failures without recording a protocol revision.

5. What the inspected source actually establishes

The administrative download handler checks sc_intake_download_files, an attachment-specific WordPress nonce, deletion/rejection status, infected status, and file integrity before streaming. The protected storage routine sets no-cache and attachment-oriented response headers; quarantined files can be streamed as application/octet-stream to an authorized user. See download handler and streaming headers.

Storage selection prefers a non-web directory but has a fallback under WP_CONTENT_DIR, protected with generated .htaccess, web.config, and index files. This is insufficient proof of denial under a particular Nginx, CDN, object storage, alias, or edge configuration. The storage-health report exposes outside_document_root, protection files, symlink state, and permissions; these must be verified, not assumed. See base directory and health and storage reliability guidance.

The upload validator inspects extension, detected MIME, format signatures, size, and SHA-256. Quarantine operations provide state changes, integrity verification, scanner policy, and audits; scanner integration itself is optional unless clean-required mode is enabled. Retention candidates are queued for human-controlled execution rather than deleted by the daily scheduler. See upload validation, quarantine controls, scanner scope, and privacy lifecycle.

Source baseline: commit 3f246974276a5e582d09f8c48d21628b82626bc7, dated August 8, 2026. These are source findings only; current deployed versions, hosting enforcement, and independent penetration-test results have not been verified.

6. Threat model and failure mechanisms

Model the attacker as an unauthenticated client or a signed-in user without the intended capability, with knowledge of a synthetic filename or guessed reference. Relevant exposure surfaces include the WordPress admin-post.php download action, unprotected direct-origin paths, CDN cache, WordPress REST metadata, accidentally published Media Library copies, backups, pre-signed links, and cross-context reuse. Test only owned fixtures and approved endpoints.

Failure modes include storage beneath a web root with ineffective deny rules; redirect or cache misconfiguration; missing capability/nonce checks in a new route; a valid nonce reused under a different actor; stale role permissions; link previews; object/tenant references resolved without an ownership check; an outdated scanner decision; a mismatched file hash; and a retention event misrepresented as completed deletion.

7. Study population, stratification, and independence

Define the study population as configured combinations of deployed release, environment, web server, storage root, actor authorization, surface, lifecycle state, file type, and policy version. Use stratification instead of randomly sampling only easy negative requests. The acceptance matrix includes anonymous origin/CDN probes, unprivileged downloads, cross-account cases (where applicable), infected/deleted/tampered states, legal holds, and an authorized positive control.

Unit of analysis: an independently labeled request/observation with its own trace reference. Repeated probes of the same path and same server configuration share a failure mechanism; do not treat them as independent coverage of distinct misconfigurations. Record repeated trials separately, but distinguish requests from unique risk strata and independent configurations.

8. Experimental design, controls, and reviewer roles

Use a prospectively documented test plan: generate synthetic file bytes, record expected hash and size, upload through the intended staging workflow, classify the record, and record a policy snapshot. Keep the person collecting responses separate from the person judging redacted evidence when feasible.

Negative controls: anonymous request, missing capability, nonexistent ID, invalid nonce, direct web-root guess, revoked account, cache replay, scanner error, deleted file. Positive controls: authorized reviewer, current nonce, intact file, recorded download audit. Cross-tenant controls apply only when the deployment has a verified organizational tenancy model. Do not manufacture a “wrong tenant” result using merely different display names.

Randomize test ordering within safe groups, repeat after login/logout, role changes, and cache invalidation, and record the ordering. This reduces false confidence from warm cache, reused cookies, and test-account privilege drift. Use no real malware or personally identifying documents.

9. Primary and secondary acceptance criteria

Primary criterion: zero observed restricted-byte and restricted-metadata retrievals among prespecified unauthorized/public-link probes, with each denial supported by response status/body classification, artifact hash comparison, and cache/redirect inspection. A 200 login page is not automatically a data leak; it is inconclusive until response classification proves no bytes or private fields and the test plan permits that behavior.

Secondary outcomes: authorized download correctness (hash match), correct role/nonce enforcement, storage root outside the document root or an independently verified web-server deny rule, absence of unsafe cache headers, scanner-policy response, 100% auditable positive downloads, hold-aware retention, and reproducible sanitized evidence. Acceptance must be all required cases pass; do not average an unauthorized disclosure away with successful functional checks.

10. Procedure

  1. Freeze and record the tested Git SHA, plugin version, schema revision, WordPress/PHP runtime, server/CDN configuration, relevant environment overrides, scanner mode, storage root classification, and access policy.
  2. Use only disposable staging accounts with documented capabilities. Obtain a fresh synthetic fixture ID and expected SHA-256. Do not place its absolute storage path, URL, or authentication tokens in public reports.
  3. Capture pretest storage-health, quarantine, scanner-readiness, and retention/hold state with authorized UI tools. Redact metadata before exporting evidence.
  4. Execute the predeclared matrix in small controlled batches. Record HTTP status, response class, whether fixture bytes or private fields appeared, cache headers, response correlation IDs, and audit references.
  5. For authorized downloads, compare the received file against the original test fixture, not merely against a mutable database field. Verify the event actor and timestamp.
  6. When an unexpected disclosure occurs, stop testing, isolate the synthetic fixture, preserve evidence in approved private storage, and initiate the incident process. Do not circulate the exposed URL or copy of the file.

11. Direct-origin and CDN public-link denial

In staging, request only the synthetic attachment at its known controlled origin and any enabled CDN route. Test both approved and quarantined storage areas when the host may expose either. Observe GET and HEAD responses, but do not regard HEAD denial as proof that GET is safe. Evaluate redirects without automatically following them into other services; validate cache misses and hits, and check Age, Cache-Control, and related headers. Confirm no fixture bytes, private metadata, or permanent public redirect escapes.

A .htaccess file is an Apache-specific signal, not universal enforcement. On Nginx or a CDN, confirm equivalent active routing controls through deployment evidence and a controlled HTTP test. The safest default is storage physically outside the entire web-served directory. Verify symlinks and published backups separately.

12. Authenticated download authorization and integrity

Test the real WordPress action admin_post_sc_ei_download_attachment in staging, using fresh authorized nonce generation. The handler’s intended gates are sc_intake_download_files, a record-bound nonce, nondeleted state, noninfected scan state, and a successful recorded integrity check. A valid nonce is not a substitute for permission; a staff account without the capability must be denied.

Independently fingerprint the synthetic test fixture and the controlled, authorized download; do not hash or move private production files into a public working directory:

python3 - <<'PYHASH'
from pathlib import Path
import hashlib
for filename in ('synthetic-original.txt', 'synthetic-authorized-download.txt'):
    b=Path(filename).read_bytes()
    print(filename, len(b), hashlib.sha256(b).hexdigest())
PYHASH

For an authorized positive control, assert Content-Disposition: attachment, secure no-cache headers, no inline HTML execution, exact file length, and SHA-256 identity. Inspect the access audit under the same actor and attachment reference. Repeat for a quarantined test file only if the organization explicitly permits privileged inspection; do not assume quarantine forbids every authorized download.

13. Upload validation, file formats, and integrity

Measure how often extension, server-detected MIME, structural signature, and byte size agree on permitted staging formats. Include benign mismatches and oversize files, then verify that rejection prevents the bytes reaching approved state. File validation is not equivalent to malware scanning. Review OOXML linked-content rejection and the documented CSV formula warning before human review.

Test corruption only in disposable storage by replacing a known fixture with a different safe byte sequence through a permitted staging test harness. The expected result is failed SHA-256 verification and a blocked download. Preserve pre/post hashes and do not alter any real document or production evidence.

14. Scanner policy and quarantine evidence

The scanner bridge can return clean, infected, error, skipped, or not_configured. The plugin does not supply a malware engine. Verify clean-required mode with a deliberately simulated error/timeout; it should prevent new unverified uploads from being accepted when the policy requires a clean scan. Use an external scanner test fixture only under separately approved security test rules.

Validate that quarantined attachments are not promoted to approved status merely because metadata says “clean.” Verify the human release capability, actual integrity check, and audit entry. A clean scanner result is not evidence of scientific truth, benign file behavior under every parser, or absence of all threats.

15. Retention, legal holds, and deletion verification

Test an expired synthetic attachment, one with a recorded legal hold, and one deliberately approved for deletion by authorized testers. The documented retention process queues candidates; scheduling does not itself delete bytes. Check that a hold blocks execution even if a due date has passed. For an authorized deletion test, verify the physical file is absent, the database tombstone is recorded, and the old public/direct and admin routes cannot retrieve bytes.

Do not delete retention candidates while “testing” on production. If physical deletion succeeds but the tombstone update fails, record the partial outcome and reconcile safely; re-running destructive actions without inspection can destroy evidence. Backup-retention and replica deletion require separate assessment.

16. Privacy-safe provenance and chain of custody

A minimal sanitized example (the full test packet is included with this article) records no path, credentials, or raw file bytes:

{
  "id": "SYN-NEG-01",
  "surface": "origin_direct",
  "principal": "anonymous",
  "phase": "quarantined",
  "mode": "deny",
  "result": "observed",
  "http_status": 403,
  "request_or_probe_id": "synthetic-probe-01",
  "fixture_bytes_exposed": false,
  "private_fields_exposed": false,
  "public_cache": false,
  "redirect_to_public_object": false
}

The validation record should include test protocol ID/revision, pinned source commit, test environment category (not secrets or host credentials), actor role, requested capability, target pseudonymous fixture reference, observation time in UTC, intended access result, HTTP status, sanitized response classification, fixture SHA-256, storage-integrity verdict, audit-event reference, and reviewer sign-off.

Protect original raw traffic and file bytes inside approved private evidence storage. Public articles should include synthetic examples, aggregate counts, and nonsecret findings only. Avoid publishing real attachment IDs, storage paths, URLs with tokens, names, email addresses, file contents, user sessions, or internal endpoint topology that exposes live targets.

17. Quantitative analysis, uncertainty, and bias

Report the exact numerator and denominator for each stratum. Define unauthorized retrieval rate as observed prohibited fixture exposures divided by observed unauthorized attempts for the specified surface and policy state; report successful authorized downloads separately. Also report coverage (distinct tested strata / preregistered strata), inconclusive cases, missing audit records, and protocol deviations.

Check the reporting arithmetic directly:

from math import pow
n = 100
upper_95 = 1.0 - 0.05 ** (1.0 / n)
print(f"{upper_95:.4%}")  # ~2.95%, if trials were independent

For zero observed exposures in n independent Bernoulli trials, a one-sided exact 95% upper confidence bound for the underlying exposure probability is:

p_upper = 1 - 0.05^(1/n). For example, zero exposures in 100 independent, representative attempts yields an upper bound of approximately 2.95%, not 0%. This calculation is descriptive only if independence and representative sampling are defensible. Sequential retries, same-path repetition, and correlated misconfiguration make this bound optimistic; discuss that limitation explicitly and provide stratum-specific results rather than only pooled percentages.

Bias checks: partial test coverage, access-role misconfiguration, cached negative responses, missing origin requests, a known-ID selection bias, retention clocks, scanner simulated errors, and the possibility that tester privileges exceed real production roles. A reproducible test is not automatically representative or independently validated.

18. Runnable offline evidence validation

The companion Python script accepts a synthetic JSON evidence packet and checks expected denials, authorized positive controls, provenance fields, private-field exposure flags, cache behavior, unsafe redirects, and misuse of source-level policy states. It uses the Python standard library and makes no HTTP or database calls. Its JSON model is an instructional artifact, not a deployed platform API contract.

cd sc-attachment-governance-scientific-validation
python3 -m unittest -v test_validate_attachment_governance.py
python3 validate_attachment_governance.py synthetic-packet.json \
  --output offline-valid-report.json
python3 validate_attachment_governance.py deliberately-invalid-packet.json \
  --output offline-invalid-report.json
# Last command intentionally exits with status 2.

The first fixture deliberately represents successful synthetic denials and one authorized download; the second deliberately contains disallowed exposure and hash mismatches. Their results establish checker behavior only. Replace with a separately approved staging evidence adapter only after verifying access controls, safe field collection, fixture handling, and record retention.

19. Symptoms

Typical observations include: an anonymous request returning a file body, a direct URL serving .qtn bytes, an unexpected 302 to an unprotected object, a 200 from a public cache, unauthorized API metadata, a download after deletion, an infected-file download, a missing SHA-256 block, a document-root storage path, absent audit entries, or an “approved” record with invalid storage integrity.

Do not equate an expected 403 with success if the same bytes remain accessible through another URL. Do not equate 200 with a leak until response classification establishes that private bytes or fields were exposed.

20. Cause

Investigate root causes by layer: identity (capability missing or overbroad), application (nonce/record checks bypassed), storage (fallback path, symlink, world-readable backup), server (Apache deny files ignored by Nginx or aliases), edge (CDN caching), policy (scanner/retention settings changed), and evidence (test fixture mixed up with a real file or missing audit).

Source review is a hypothesis generator, not an incident report. A failure can be attributed only after reconciling the observed response with the exact deployed release, configuration, and route.

21. Troubleshooting

Observation Minimum diagnostic evidence Safe next action
Public direct URL succeeds Origin vs CDN response classification, fixture hash, active storage root and deny configuration Contain synthetic exposure; inspect server aliases/CDN and relocate out of web root if approved
Authorized route unexpectedly denies Role/capability snapshot, fresh nonce, record state, scanner status Renew the test session; inspect capability and policy without weakening them
Tampered file still served Original byte hash, stored hash, actual streamed hash, verification audit Stop distribution and isolate fixture; investigate integrity checks
Attachment appears after deletion Retention action state, file stat, tombstone, CDN cache, backup policy Reconcile physical deletion, caches, and replica retention without blind deletion
Missing access audit Request ID, actor role, attachment reference, corresponding event timestamps Treat evidence as incomplete; inspect persistence and audit permission
Scanner status inconsistent Provider/version, test timestamp, clean-required flag, scanner operation log Block promotion; run isolated scanner readiness checks

22. Resolution

For confirmed unauthorized exposure, suspend the affected public distribution path using approved change controls, disable unsafe CDN caching, and preserve immutable incident evidence privately. Correct server/edge deny policy or move storage outside the web root through a backed-up, versioned, human-approved migration. Do not “fix” access issues by granting broad roles or switching off scanner requirements.

For inconclusive tests, classify the result as not verified, repair the measurement process, and rerun controls. Restore only after independent reviewers verify negative and positive paths, rollback readiness, correct retention/legal-hold behavior, and no unexpected changes to private records. Audit the change; do not delete history.

23. Verification

Minimum staged acceptance: all 24 listed cases independently executed against a documented staging release, zero unauthorized file/metadata disclosures, documented authorized positive-control hash match, correct audit, no public cache artifacts, and reviewed retention/hold outcomes. Confirm behavior after a cold session, role switch, server/CDN cache refresh, and application restart. Flag each result PASS / FAIL / INCONCLUSIVE / NOT RUN with the exact test time and evidence reference.

Required reviewer sign-off: protocol version, coverage, unresolved exceptions, interpretation of confidence intervals, hosting-specific caveats, independent verification outcome, and a separate production change approval. Offline green tests cannot change deployed verification status.

24. Scientific reporting and publication boundary

Publish a methods-and-results statement that identifies the study population, environment, test count by stratum, negative and positive controls, all excluded and inconclusive observations, confidence bounds (when justified), limitations, and conflicts of interest. Distinguish a software security validation conclusion from a scientific conclusion about underlying data. Preserve full private proof only in an authorized audit repository; public results should contain redacted evidence references and aggregate findings.

Sample conclusion wording after a real test: “In the specified staging configuration, none of the n preregistered unauthorized trials returned the designated synthetic attachment bytes. This supports the tested access boundary; untested hosting configurations and alternate delivery surfaces remain outside scope.” Until tests are performed, report: “Source-reviewed validation protocol; no deployed attachment-access verification performed.”

25. Limitations and independent review

The inspected repository commit may not match current deployment. WordPress permissions and nonces do not protect files that a web server serves directly. Server configuration may change outside GitHub. A clean file can still contain unsafe parser content; a SHA-256 hash does not establish provenance of the uploaded original. Retention deletion may not cover backups/CDN replicas. Role-based checks do not imply organization-level tenant isolation.

Independent review should verify protocol preregistration, reproduce at least a sample of negative and positive tests, inspect config drift and evidence integrity, check for untested delivery channels, and challenge assumptions about independence, bias, consent, and disclosure. Do not mark the article independently certified until those checks are recorded.

26. Technical references and source verification

Pinned source: Contact and Engagement / Engagement Intake at 3f246974276a (repository commit dated August 8, 2026; inspected November 20, 2026).

  1. DOCUMENT-INTAKE.md
  2. STORAGE-RELIABILITY.md
  3. QUARANTINE-OPERATIONS.md
  4. SCANNER-INTEGRATION.md
  5. PRIVACY-RETENTION-CENTER.md
  6. class-sc-ei-storage.php
  7. class-sc-ei-admin.php
  8. class-sc-ei-attachment-repository.php
  9. class-sc-ei-upload-validator.php
  10. class-sc-ei-upload-manager.php
  11. class-sc-ei-file-scanner.php
  12. class-sc-ei-retention-engine.php
  13. OWASP Web Security Testing Guide — authorization and file-handling test methodology.
  14. OWASP File Upload Cheat Sheet — file type, storage, and access security.
  15. NIST SP 800-53 Rev. 5, Update 1 — access control, audit, system integrity, and data protection.

Evidence status: Source-reviewed; offline fixtures and tests executed; no production or staging file retrievals performed. All staged case outcomes remain NOT RUN. Reviewer acceptance is pending.

Scroll to Top