# Phase 11 Production Remediation RC1 — Manifest

Developer / platform owner: SmartersWeb Canada  
Public product: YOUR BRAND Finance Tracker  
Canonical demo deployment: https://demo.fairewebhost.ca/finance-tracker/  
Base path: /finance-tracker/

## RC1 purpose

This is the first production-audit remediation release. It does not claim that the application is production-ready by itself.

## Audit findings addressed in source

- FT-001 — release secret/runtime-data hygiene: full RC1 package excludes `.env`, logs, session registry, and uploaded receipt runtime data.
- FT-002 — production configuration: strong independent application/accounting/provider-token keys, safe DB configuration, HTTPS, debug/demo checks are enforced by production preflight.
- FT-003 — account deletion lifecycle: confirmation now enters Phase 11 privacy review; no unimplemented automatic deletion is promised.
- FT-005 — receipt entitlement bypass: fixed against the actual multipart upload fields.
- FT-006 — reset/verification bearer-token logging: removed.
- FT-007 — `faierwebhost.ca` typo: removed from RC1 source/docs/config examples.
- FT-008 — email verification: configurable gate, default-on in production.
- FT-009 — QA/audit data sanitization: documented release and sanitized-fixture process.
- FT-010 — immutable asset caching: local asset URLs are versioned automatically.
- FT-011 — confirmation modal focus management: implemented.
- FT-013 — Google/Facebook OAuth TLS verification: made explicit.
- FT-014 — support attachment orphan cleanup: implemented.

## Production blocker that remains open

FT-004 is not solvable from source alone: deployment/runtime evidence is still required for cross-tenant IDOR/role testing, SSL/private-path behaviour, clean migration execution, cron heartbeats, protected backups, successful restore drill, SMTP, monitoring, and provider sandbox tests.

## Database migration

No new RC1 database migration is required. RC1 uses the existing Phase 11 `privacy_requests` schema.

## Complete changed/new files

- `/.env.example` — Complete secret-free Phase 11/RC1 environment template with the canonical deployment hostname, production encryption-key requirements, and configurable email-verification enforcement.
- `/.gitignore` — Prevents real environment files and runtime logs, exports, backups, sessions, receipts, billing proofs, and support attachments from entering source/release repositories.
- `/.htaccess` — Preserves private-path protections and documents immutable asset caching as safe only because RC1 fingerprints asset URLs.
- `/api/receipt-upload.php` — Fixes the Phase 9 entitlement bypass by enforcing scan/storage limits from the exact normalized receipt_files/receipt_file/camera upload objects that are subsequently stored.
- `/api/security/confirm-account-deletion.php` — Routes confirmed account deletion into the Phase 11 privacy-request workflow, revokes sessions, and performs no automatic deletion, billing mutation, ownership transfer, or provider disconnect.
- `/api/security/request-account-deletion.php` — Changes self-service deletion language/state so confirmation leads to privacy review rather than an unimplemented automatic deletion schedule.
- `/app/auth.php` — Prevents unverified users from receiving a production workspace session when email verification is required, including OAuth-created users.
- `/app/bootstrap.php` — Runs the RC1 production configuration preflight during application bootstrap.
- `/app/config.php` — Corrects the canonical hostname, removes the duplicate PayPal client-ID definition, adds email-verification configuration, and adds fail-closed production configuration preflight validation.
- `/app/functions.php` — Adds automatic file-version query strings to local asset URLs so updated CSS/JS/image assets do not remain stale behind immutable browser caching.
- `/app/services/FacebookAuthService.php` — Adds explicit TLS peer/hostname verification and returns a distinct email-verification-required result when a session is denied.
- `/app/services/GoogleAuthService.php` — Adds explicit TLS peer/hostname verification and returns a distinct email-verification-required result when a session is denied.
- `/app/services/SupportService.php` — Removes a securely uploaded support file if the corresponding database insert fails, preventing private orphan files.
- `/app/views/modals.php` — Adds the confirmation modal description relationship required by its improved focus/accessibility behaviour.
- `/assets/js/app.js` — Adds confirmation-modal initial focus, Tab focus containment, Escape close, focus restoration, and preserves existing interaction behaviour.
- `/auth/facebook-callback.php` — Adds clear handling for the production email-verification-required OAuth state.
- `/auth/google-callback.php` — Adds clear handling for the production email-verification-required OAuth state.
- `/dashboard/privacy.php` — Accurately presents deletion as a reviewed privacy operation and safely handles legacy scheduled deletion metadata.
- `/docs/live-integrations-readiness.md` — Corrects the canonical deployment/callback hostname in live-integration readiness documentation.
- `/docs/phase-11-production-remediation-rc1-files.md` — Lists the complete replacement/new files included in RC1.
- `/docs/phase-11-production-remediation-rc1.md` — Documents RC1 scope, safety decisions, deployment order, and remaining runtime launch-gate evidence.
- `/docs/qa-data-sanitization.md` — Defines secret/runtime-data exclusion and sanitized QA/audit database-export handling.
- `/forgot-password.php` — Removes password-reset bearer URLs from demo application logs.
- `/login.php` — Handles the production email-verification gate without creating an authenticated session and exposes a safe verification-resend route.
- `/register.php` — Removes verification-link bearer tokens from demo application logs while preserving secure email delivery.
- `/resend-verification.php` — Rate-limited, non-enumerating email-verification resend flow that never logs verification bearer tokens.
- `/tests/manual/production-remediation-rc1-tests.md` — Manual regression suite for configuration preflight, email verification, receipt entitlements, privacy deletion review, modal focus, asset versioning, and OAuth TLS.

## QA

```text
Phase 11 Production Remediation RC1 QA
PHP files: 266; failures: 0
JavaScript files: 6; failures: 0
Real .env files in release: 0
Runtime data files outside .htaccess: 0
Misspelled demo.faierwebhost.ca occurrences: 0
Logged reset/verification URL field occurrences: 0
Wrong receipt multipart field references: 0
Correct receipt multipart field references: 1
Deletion privacy-review status references: 2
Automatic deletion enabled true occurrences in deletion flow: 0
Production preflight definitions/calls: 2
Email verification gate locations: 3
OAuth TLS explicit verification files: 2
Asset version URL sample: https://demo.fairewebhost.ca/finance-tracker/assets/js/app.js?v=1787252525
Result: PASS
Production preflight safe-config test: PASS
```

## Deployment safety

The UPDATE package intentionally does not contain deletion markers for a live server's `.env`, logs, or customer uploads. Merge source/config-example files only. Preserve the server's protected `.env` and runtime storage.

The FULL package is a clean source release and therefore excludes all runtime data.

## Live providers

Keep `LIVE_INTEGRATIONS_ENABLED=false` until the Phase 10 provider activation gates and the remaining runtime audit evidence are complete.
