# EduCore SIS — deployment and security notes

## What is deployed

EduCore is an independent demonstration SIS. It has no PowerSchool, district, school identity, or other external school-record connection. Only synthetic demo records belong in this application.

- Cloudflare Pages: https://educore-sis.pages.dev
- Administrator portal: https://educore-sis.pages.dev/admin/
- Teacher portal: https://educore-sis.pages.dev/teacher/
- Student and parent portal: https://educore-sis.pages.dev/public/
- Substitute portal: https://educore-sis.pages.dev/sub/
- Attendance Bridge: https://educore-sis.pages.dev/apps/attendance-bridge/
- API Worker: https://educore-api.andrewsarmy-cf.workers.dev
- D1 database: educore-sis-db

The four portals use a same-origin Pages Function proxy at /api/*, so browser sessions are first-party cookies on the Pages site. The API Worker uses D1 and a strict Pages-origin allowlist.

## One required Cloudflare secret

The Worker is deployed as `educore-api`. In Cloudflare:

1. Open **Workers & Pages** → **educore-api** → **Settings** → **Variables and Secrets**.
2. Add a secret named exactly `andrewholmes_PASSWORD`.
3. Set its value to a new, unique password that has not been posted in chat, GitHub, or source code. Use a password you do not use anywhere else.
4. Save the secret and redeploy the Worker if Cloudflare prompts you.

The secret is used only for the initial `andrewholmes` administrator bootstrap. On the first successful sign-in, the Worker hashes the supplied password with PBKDF2-HMAC-SHA-256 and a random salt, stores only the hash in D1, and activates that administrator account. Later sign-ins validate against the stored hash; the Worker does not need the plaintext secret to authenticate that account after bootstrap. Do not put the secret value in Wrangler files, GitHub, or chat.

## Database

The original schema is `database/schema.sql`. The fictional demo expansion is `database/migrations/0002-functional-demo.sql`; it has been applied to the configured D1 database. It adds substitute role grants, announcements, substitute coverage records, and synthetic sample students, courses, sections, assignments, and grades.

## Important implementation limits

This is a functional development foundation, not a completed commercial SIS or a certified secure production system. Some workflows and CRUD screens remain incomplete. In particular, student/parent relationship provisioning, substitute coverage administration, notifications, imports/exports, full scheduling, report generation, password recovery, MFA, and comprehensive record-level authorization still need implementation and testing. The Attendance Bridge currently remains a local-only prototype and does not write attendance to the API.

Use only synthetic records. Do not enter actual student names, IDs, grades, attendance, parent details, or other education records. Do not describe this project as FERPA-certified or production-ready.

## Authentication and security

- Password hashes use PBKDF2-HMAC-SHA-256 with 310,000 iterations and a unique random salt.
- Sessions use random opaque tokens; only token hashes are stored in D1.
- Session cookies are HttpOnly, Secure, and SameSite=Lax.
- Mutating authenticated API requests require a CSRF token.
- Login attempts are rate-limited by username and hashed client IP.
- API access is deny-by-default for unknown routes and checks role permissions server-side.
- Audit events record authentication and selected data actions without recording passwords or session tokens.
- The public Pages site is accessible to anyone. A private GitHub repository does not make its deployed Pages site private.

Before any real-world school use, this would require a full security review, independent testing, MFA, password recovery, account lifecycle controls, tested school/class/guardian scoping, backups, monitoring, retention policies, and legal/privacy approval.