Worked Examples
Validate scientifically private inquiry intake — Contact and Engagement Platform
Evaluate private inquiry intake through reproducible checks of submission gates, consent-ledger persistence, private access controls, anti-abuse safeguards, document quarantine, and retention state. This developer guide provides read-only WordPress reconciliation, synthetic positive and negative tests, and quantitative acceptance criteria for determining whether an inquiry was received safely and can be audited without disclosing personal information.
Application: Contact and Engagement Platform
Component: Public Inquiry Intake, Consent & Privacy Controls
Source-reviewed version: 2.0.2, commit 3f246974276a5e582d09f8c48d21628b82626bc7
Verification status: Source-reviewed; independent synthetic checker 48/48 tests passed; deployment and staging validation pending
Estimated reading time: 20–24 minutes
Private inquiry intake should be evaluated as a multi-stage evidence chain: a submission passes server-side gates, creates exactly one private inquiry, preserves notice and authorization state, records consent and audit events, applies appropriate attachment quarantine, and remains unreadable to unauthorized users. A confirmation page proves only what the corresponding response and persisted evidence establish; it is not proof that every subsequent write succeeded.
Goal
Determine whether the specific implementation of private inquiry intake reliably accepts legitimate submissions while rejecting invalid or unauthorized activity, maintains reconstructable processing and consent evidence, and prevents disclosure of inquiry or attachment content. The primary acceptance requirement is: submission is permission-scoped and consent state is preserved. Because the public submission route is intentionally available without a logged-in account, “permission-scoped” here means bounded public write capabilities plus protected private reads and subsequent actions, not mandatory login for every sender.
- An accepted inquiry can be joined to the required notice event and creation/submission audit events without relying on the browser response alone.
- An invalid consent, integrity-gate, duplicate or rate-limited submission does not create an unauthorized inquiry or disclose private information.
- Documents are confined to protected storage and quarantine; partial upload failures are visible rather than silently treated as wholly successful.
- A change in privacy state, including withdrawal or erasure, is reflected in authorized workflows without silently discarding lawful retention evidence.
Requirements
- Obtain an authorized staging WordPress installation of the reviewed plugin; confirm the installed plugin/database versions and current policy settings before comparing source behavior.
- Use synthetic data only:
example.invalidemail domains, nonidentifying names, no real customer narratives, no real participant contacts, and no production attachments. - Record the population, evaluation window, environments, source commit, active form modes, WordPress/PHP versions, roles, configured abuse thresholds, and whether external scanning is required.
- Ensure administrative read capability for private inquiries (
sc_intake_view) and separate test roles without that capability. Do not bypass authorization for convenience. - Preserve the existing backup/restore process and a rollback point. Do not run deletion, public submission, scanner, or retention mutation tests against production.
Study design
Use a preregistered positive/negative test matrix combined with an observational audit of synthetic records. The unit of analysis is one attempted intake operation, linked to a synthetic request ID; the outcome is a validated sequence of responses and durable records. Stratify by general versus consulting or support forms, meeting request status, attachment presence, client role, and abuse-control scenario. Treat browser sessions and repeated submissions from the same synthetic identity as correlated observations rather than statistically independent trials.
Define success before tests begin. For example: zero accepted trials lacking required authorization, zero unauthorized private reads, zero released unscanned files, and complete matching notice-ledger events for all accepted synthetic inquiries. Record the number of eligible tests in each stratum and report unknown or unavailable outcomes instead of counting them as passes. These thresholds are proposed acceptance gates, not assertions about production performance.
Operational hypothesis and counterexamples
H₀ (testable engineering null): at least one submitted operation violates an intake invariant. H₁ (bounded acceptance claim): all predeclared invariants hold for the tested environment, protocol and synthetic cases. A failure to observe a defect in a finite sample does not establish that the production system is secure or that its use has a causal effect on user behavior. Counterexamples include successfully acknowledged intake with absent consent-ledger rows, a forbidden read returning HTTP 200, duplicate persistence after a replay, and document access before an approved scan.
Method
- Capture a pretest configuration snapshot: plugin build, form route, privacy notice version, capabilities, upload/scan settings, WordPress table schema, and site caches. Exclude secrets and person-identifying values from the evidence packet.
- Submit one eligible synthetic request for each supported form mode; capture only response code, generated reference, request ID, timing, and event counts. Do not copy confidential inquiry bodies into logs or reports.
- For each positive case, reconcile the private inquiry row to consent and audit ledgers and, when applicable, the protected attachment metadata.
- Run negative cases using intentionally missing consent, expired nonce, wrong attribution signature, short completion time, invalid inquiry type, duplicate body, replayed request ID, and restricted read roles.
- Execute storage and consent-ledger failure injection in isolated staging with restoration. Verify that the outcome is visible and the incident is not misclassified as a fully completed intake.
- Reconcile final state against the pretest snapshot, calculate denominators and uncertainty, document limitations, and require a concrete regression test for each observed defect.
Source-reviewed system boundaries
| Layer | Reviewed behavior | What remains to verify |
|---|---|---|
| Public write | POST /wp-json/sc-engagement-intake/v1/submit calls SC_EI_Form_Handler::process(); permission callback is public by design. |
Anti-abuse and request-envelope gates still work under actual reverse proxies and caching. |
| Private read | GET /wp-json/sc-engagement-intake/v1/inquiries and /inquiries/{id} require sc_intake_view. |
WordPress role, multisite, cache, CDN, and any alternative route do not leak records. |
| Main record | SC_EI_Inquiry_Repository::create() inserts into sc_ei_inquiries with notice version, notice timestamp, calendar consent and retention metadata. |
A success response corresponds to a durable, unique record and stable reference. |
| Privacy ledger | capture_public_consent() is triggered by sc_ei_public_inquiry_created. |
Consent rows are durable and failures can be detected, retried safely or reported. |
| Uploads | SC_EI_Upload_Manager::process_inquiry_uploads() can report attachment errors while keeping the inquiry. |
Client and operator accurately distinguish accepted inquiry from incomplete attachment set. |
| Retention | Privacy/Retention Center uses governed requests, holds, approvals and execution. | Policy selection, identity verification, legal holds and erasure outcomes have been tested for the target deployment. |
Submission and consent gates
The reviewed handler applies WordPress nonce verification, upload envelope checks, honeypot rejection, form timing and attribution signatures, type-specific required fields, privacy acknowledgement and authorization-to-share acknowledgement. An additional calendar-invitation acknowledgement is required when a meeting is requested, and upload authorization is required when documents are selected. It also uses hashed rate-limit identities, a short duplicate-content window, and a request ID lock/success cache.
# The following is a source map, not a replay-ready public request:
POST /wp-json/sc-engagement-intake/v1/submit
sc_ei_nonce -> wp_verify_nonce(...)
form_started_at, form_id -> timing signature + time window
form_mode, source_page -> attribution signature
privacy_consent -> required acknowledgement
authorization_consent -> required authority-to-share statement
calendar_invite_consent -> conditional on meeting_requested
document_upload_consent -> conditional on files selected
request_id -> replay lock + cached success
A malformed or missing nonce is a rejected request, not an invitation to disable CSRF checks. When clients report expired forms, investigate full-page caching of dynamic tokens and time windows; do not reduce safeguards to make an automated test pass. Existing source constants limit the general text area to 12,000 characters and relevant links to 10, but application- and server-level request size limits must be checked separately.
Consent ledger persistence gap
The reviewed source first saves the inquiry, builds the success result and caches it, and then invokes do_action('sc_ei_public_inquiry_created', ...). The consent callback calls record_consent(), which returns a WordPress error when its database insert fails; the callback does not check that return value. Therefore the handler may return an inquiry-success response even when the separate consent ledger is incomplete. This is a source-reviewed reliability risk, not evidence that it has occurred in production. The inquiry itself retains consent_version and consent_at, which helps reconcile missing ledger entries but does not replace the ledger.
Staging fault-injection requirement
- In an isolated staging snapshot, submit a synthetic request with valid consent and verify one inquiry and one matching
privacy_noticegrant. - Introduce a narrowly scoped, reversible consent-event INSERT failure; do not disable or corrupt the live production table.
- Repeat the synthetic submission with a new request ID. Capture the response, inquiry count, consent-ledger count and hardening/audit diagnostics.
- Restore the table immediately. The test should fail the acceptance gate if a successful response is observed without a visible incomplete-consent state or a recoverable operator alert.
- Use a dedicated engineering patch and integration test to make ledger-persistence failures observable and reconcilable. Do not silently invent consent events; derive corrections only from preserved, time-stamped, authentic submission evidence.
Permission and privacy boundaries
An anonymous sender can submit a form but cannot thereby retrieve a private inquiry. The reviewer role and administrative roles receive specific WordPress capabilities, and REST reads use current_user_can('sc_intake_view'). Inspect every private view, search, attachment download, WordPress REST response and operational export for an equivalent check. A successful WordPress nonce is not a substitute for record-level authorization; logged-in roles should be tested independently.
# Authorized staging only: response-code check, no response body retained.
SITE='https://staging.example.invalid'
code=$(curl -sS -o /dev/null -w '%{http_code}' "$SITE/wp-json/sc-engagement-intake/v1/inquiries")
printf 'Anonymous private-list HTTP status: %s\n' "$code"
case "$code" in 401|403) echo 'Read access correctly denied';; *) echo 'Investigate'; exit 1;; esac
The accepted HTTP error may be 401 or 403 depending on the WordPress authentication context. Test whether CDN caches preserve that denial and never serve a private response under an anonymous cache key. Public confirmation references may still be sensitive if they act as lookup tokens in another subsystem; treat them as pseudonymous handles, not declassified identifiers.
Attachment-specific validation
An inquiry can be accepted while one or more files fail validation, scanner processing, durable storage or size checks. The source returns attachment_count and attachment_errors; its browser redirect includes a file-warning marker. Consequently, separate submission success from attachment completeness in metrics and user-facing statuses. Validate the file extension/MIME/signature safeguards, quarantine path, content hash, external scanner requirements, storage integrity, release capability and deletion lifecycle.
- If storage cannot initialize, the source returns an inquiry with an attachment error instead of claiming all documents were accepted.
- If external scanning is mandatory, a non-clean scanner outcome must not be treated as an approved downloadable attachment.
- A clean scanner result is a bounded security check, not scientific verification of file contents or sender authorization.
- Never copy a real submitted document into a public issue, test fixture, CI artifact or open-source repository.
Ingest identity, duplicates and replays
The source uses a submitted request_id as a transient success key and an option-backed processing lock. The success cache lasts approximately 15 minutes and the duplicate-content transient approximately 10 minutes; those mechanisms are not a substitute for a durable uniqueness constraint under arbitrary distributed failures. A replay that returns a cached success must not create a second inquiry. A repeated request after cache expiry requires explicit expected behavior in the test protocol.
| Test | Expected result | Evidence |
|---|---|---|
| Two simultaneous identical request IDs | At most one persisted inquiry; other response indicates in-progress or existing success. | Durable inquiry count and sanitized request ID mapping. |
| Replay within cached-success window | Stable confirmation reference without a second insert. | Reference equality and record count. |
| Repeated body with new request ID | Duplicate mechanism rejects within governed window. | No unexpected new row; duplicate error category. |
| False-positive duplicate | Semantically distinct legitimate request must not be silently lost. | Reviewed synthetic variants and rate-limit response. |
| Partial write/exception | No contradictory success or duplicate state. | DB row count, audit events, recovery report. |
Evidence model and linkage
The production inquiry table includes id, reference, consent_version, consent_at, calendar_invite_consent, privacy_status, retention_until and created_at. Consent events are stored in sc_ei_consent_events with type, action, version, source and occurrence time. Audit events occupy sc_ei_audit_log. Attachment rows contain scan and quarantine state. The table prefix is the installation-specific WordPress prefix plus sc_ei_.
Do not assume that privacy_consent, authorization_consent and nonce_valid are columns in the production database: these names in the downloadable independent checker are synthetic observation fields expressing which acceptance gates were exercised. Treat them as test evidence, not a proposed migration or real service API.
Read-only WordPress reconciliation
The package includes read_only_reconciliation.php, which uses SC_EI_Database::table() to select the correct physical tables and calculates aggregate counts without returning any sender details. Use it first in authorized staging, and only by an operator entitled to inspect private records. If used in production, even aggregate counts need a disclosure review because very small groups can re-identify participants. This script does not repair records, certify the ledger or perform automated reconciliation.
# From a trusted WordPress host, with the companion PHP file stored OUTSIDE public webroot:
WP_PATH=/home1/pctrqumy/public_html
wp --path="$WP_PATH" eval-file /absolute/private/path/read_only_reconciliation.php
# Output fields include:
# inquiry_count, missing_consent_anchor, missing_notice_ledger,
# missing_calendar_ledger, missing_created_audit, missing_submitted_audit,
# attachment_count, released_without_clean_scan
The query window is seven days. Align it with the actual experiment window and explicitly separate synthetic from real traffic in staging or a dedicated test installation. Do not publish individual id, reference, contact_email, metadata_json, message fields or private storage paths. The script is provided verbatim in the download so the full SQL and column names are reviewable before execution.
Synthetic diagnostic packet
The independent checker accepts a deliberately restricted JSON packet consisting of inquiry anchors, expected consent events, audit categories, request-gate outcomes, attachment statuses, access-test status codes and public response field names. It never connects to WordPress and never requires live sender data. Its output is a list of code-labeled findings, not an automated correction plan.
cd private_inquiry_intake_validation
python3 -m unittest -v test_intake_checker
python3 intake_checker.py fixtures/valid_intake.json --output valid_report.json
python3 intake_checker.py fixtures/invalid_intake.json --output invalid_report.json || test "$?" -eq 2
# Recorded source-package results:
# 48/48 unit tests passed
# valid synthetic packet: 0 findings
# deliberately invalid packet: 26 findings (exit 2)
The invalid fixture covers missing notice entries, absent audit events, invalid timestamps, missing authorization, a duplicate request ID, a malformed private-read authorization result, unscanned file release and a simulated public disclosure. These cases are artificial inputs to the checker; they are not detected production incidents.
Quantitative measures and uncertainty
For each stratum, report the numerator, denominator, protocol version, date window, and classification of inconclusive outcomes. Primary metrics include: valid acceptance rate = accepted eligible attempts / eligible valid attempts; false acceptance rate = accepted ineligible attempts / ineligible attempts; notice-ledger completeness = accepted inquiries with a matching notice grant / accepted inquiries; authorization leakage rate = unauthorized successful private reads / unauthorized read attempts; and attachment quarantine compliance = protected/quarantined documents / all accepted documents. Do not combine these rates into one opaque quality score.
For a binomial proportion p = x/n, use the Wilson interval when reporting uncertainty; for clustered trials or retries, report results by independent synthetic identity or session instead of assuming independence. A zero-failure sample is not a guarantee: the rough rule-of-three upper bound for an unobserved failure probability is 3/n (only a large-sample approximation under independent Bernoulli trials). A 30-case clean sample does not justify a “100% secure” claim.
# Pure Python: two-sided Wilson score interval, z=1.96 for ~95% confidence.
from math import sqrt
def wilson(x: int, n: int, z: float = 1.96):
if n <= 0 or not 0 <= x <= n:
raise ValueError('Require 0 <= successes <= trials and trials > 0')
p = x / n
d = 1 + z * z / n
m = (p + z * z / (2 * n)) / d
h = z * sqrt(p * (1-p) / n + z*z / (4*n*n)) / d
return (m-h, m+h)
print(tuple(round(v, 4) for v in wilson(30, 30)))
Bias, representativeness and confounding
Synthetic coverage tests protocol invariants but may miss real user behavior, assistive technologies, stale browser caches, international character sets, missing JavaScript, regional privacy constraints, network interruptions or third-party service latency. Observational inquiry completion rates can be confounded by form mode, traffic source, user language, time zone, attachment requirements and device type. A higher conversion rate does not demonstrate that privacy safeguards improved; such causal claims require a separate justified study design. Preserve rejected attempts as aggregate operational events rather than extracting person-identifying stories for an illustrative article.
Symptoms
| Symptom | First nonsecret evidence | Likely boundary |
|---|---|---|
| Success notice but no consent event | Notice-ledger aggregate mismatch for the same synthetic window. | Post-save consent hook or consent table write failure. |
| Anonymous private data response | Status code plus field-name inventory, no values. | WordPress capability checks or caching. |
| Duplicate inquiries after retry | Synthetic request IDs and count of durable rows. | Request-lock/cache or distributed replay assumption. |
| Consent fields appear correct, meeting creation blocked | Meeting request, calendar acknowledgement and scheduling state. | Conditional Teams authorization/time zone. |
| Inquiry accepted but files absent | Accepted attachment count and error categories. | Attachment validation, scanner or protected storage. |
| Repeated 429 or 409 | Rate and duplicate error classes; no raw identities. | Abuse ledger, duplicate transient or request lock. |
| Privacy state disagrees with consent withdrawal | State and withdrawal event categories. | Privacy workflow/restriction transition. |
| Admin sees inquiry but service says missing | Authenticated context, schema health, request ID and DB health events. | Migration, persistence or stale cache. |
Cause
Different symptoms arise at different layers. Expired form signatures, invalid consent and conditional authorization are input-gate failures. Successful responses without matching ledger or audit events are persistence and observability failures. Anonymous reads that reveal private material are authorization or cache-control failures. Duplicate rows are idempotency failures. Missing or unscanned documents may be partial-intake outcomes, not failed inquiry creation. These distinctions determine the recovery path and prevent a failed permission check from being “fixed” by publishing private information or disabling a control.
Troubleshooting
- Identify the exact route and form variant; capture redacted request ID, response code, server timestamp, plugin version, and source commit.
- Verify server-side nonce, timing and attribution gates with expired and tampered synthetic inputs. Do not test real submissions for abuse.
- Confirm the immutable evidence anchors in the inquiry: reference, consent notice version/time, privacy state, retention deadline, and review state.
- Check the notice-ledger and audit categories with aggregate, read-only queries. Treat missing entries as an incident requiring evidence-preserving investigation.
- Check conditional consent for meetings and documents, using one positive and one negative case per branch.
- Test protected private read endpoints as an anonymous visitor and a separately authenticated reviewer. Log only status codes and field names.
- Review attachment scanner/quarantine metadata; do not release files to verify whether quarantining worked.
- If an external connector, notification or storage service failed, verify the private inquiry and receipt state before retrying any side-effecting operation.
Diagnostics by HTTP status
| Observed status | Meaning in reviewed REST handler | Next check |
|---|---|---|
400 |
Input/consent/signature failures (most validation errors). | Error code; form cache and conditional required fields. |
409 |
Duplicate submission or request already processing. | Reference cache, request lock and inquiry count. |
413 |
Payload too large or upload truncated. | Ingress proxy, PHP upload limits, effective attachment policy. |
429 |
Request rate limited. | Hash-based abuse ledger and configured thresholds. |
500 |
Storage failure categories. | DB migration/health and sanitized hardening event ID. |
503 |
Upload environment or external storage unavailable. | Storage readiness; no arbitrary retries. |
201 |
Public submit response constructed. | Independently verify ledger, audit and attachment results. |
Resolution
The correct remediation depends on the failed invariant. Restore configuration or replace stale nonce-bearing HTML when form-gate failures arise from caching. Repair a missing database table or schema mismatch through a tested migration and backup procedure, rather than manually inserting inferred consent. For a ledger gap, preserve the accepted inquiry and its original consent metadata; explicitly record the incident and reconstruct only evidence that was actually captured. When private data is exposed, disable the leaking route or cache path, rotate credentials when indicated, preserve redacted incident evidence, and verify an anonymous denial before reopening. Do not replay a public POST until the request ID and durable record count have been reconciled.
For attachment errors, keep the valid inquiry, communicate that files were not fully accepted, and request a new authorized upload under the normal quarantine controls. Respect holds and retention decisions before any cleanup. Restoration from backup is appropriate only when it is authorized, scoped, and reconciled with newer valid records. Every corrective action needs a before-and-after check and an explicit no-unintended-publication assertion.
Verification
Complete the following acceptance checks on the target deployment before assigning any last-verified version. Record build identifiers and durable evidence references, not private payloads.
- Positive receipt: five synthetic inquiry types or form variants accepted under valid gates, with unique references and matching private records. Confirm that any unsupported type is rejected.
- Consent: every accepted sample has valid consent version/time and corresponding
privacy_noticeevent; calendar consent is mandatory only when the meeting workflow requires it. - Negative controls: missing privacy acknowledgement, missing authorization-to-share, invalid nonce/signature and malformed request each result in no accepted inquiry.
- Permissions: anonymous private-list/detail reads are denied, while an authorized reviewer can retrieve only the expected private records. No public response body contains sender-identifying data.
- Replays: concurrent and repeated request IDs do not create extra durable inquiries; duplicate prevention is checked across cache and relevant timeout boundaries.
- Attachments: files remain protected; scanner-required cases never release an unverified result; partial attachment failures produce distinguishable error evidence.
- Fault injection: consent-ledger insert failure and audit/persistence failures are surfaced and cannot be counted as fully verified successes.
- Retention and privacy: withdrawal restriction, holds and authorized erasure workflow are tested without exposing or prematurely deleting protected content.
- Recovery: demonstrate rollback or repair in staging, confirm no unauthorized publication, and document permanent regression tests.
The staging acceptance matrix in the package enumerates individual test IDs and evidence fields. The 48 passing offline tests prove only that the separate synthetic checker behaves as specified. They do not satisfy this deployment verification list.
Reporting boundary
Publish only aggregate findings, protocol versions, test IDs, redacted error classes, audit completeness rates, relevant limitations and required corrective actions. If a population is small, suppress or aggregate further so operational counts do not identify individuals. Do not publish names, email addresses, inquiry narratives, legal-hold reasons, attachment paths, consent evidence text, access tokens, or exact private inquiry timestamps. Avoid suggesting that acceptance of a privacy notice by itself establishes a legally sufficient basis for processing across all jurisdictions.
Separate operational evidence from scientific inference: a well-instrumented, repeatable workflow supports an engineering assessment of reliability and privacy controls, but it does not prove truth of information submitted by a person, absence of bias, or lawful processing in every jurisdiction. Keep dates, environment, exclusions, unknown cases, statistical uncertainty and risk classifications available for authorized review.
Technical references
- Form validation, duplicate and success handling (pinned source revision).
- REST submission and private-read permission callbacks (pinned source revision).
- Private inquiry repository (pinned source revision).
- Consent event capture and record persistence (pinned source revision).
- Private upload and scanner pipeline (pinned source revision).
- Physical database table contracts (pinned source revision).
- WordPress capabilities (pinned source revision).
- Privacy and Retention Center operations (pinned source revision).
- Security and reliability operations (pinned source revision).
- Static inquiry persistence checks (pinned source revision).
- W3C PROV Overview — provenance interpretation; not a certification standard for privacy compliance.
- NIST Privacy Framework — privacy risk management context.
- OWASP Application Security Verification Standard — applicable security verification practices.
- WordPress REST authentication guidance — permission and nonce boundaries.
Source integrity statement: All code paths and contract examples above refer to the pinned repository revision; runtime queries and fault injection are prescribed staging tests, not executed production evidence. Independent checker fixtures are deliberately synthetic and contain no private inquiry content.
