Implementation & Operations
Facial Attendance System
A guide to what was built, how face-only kiosk attendance works, how it is secured, and how administrators should deploy and test it.
Branch lockedEvery authorized kiosk is assigned to one branch.
Privacy firstNo raw camera image is uploaded or retained.
Two modesEmployee-ID verification or opt-in face-only identification.
Facial Attendance
Implementation Guide
Document version 1.0
Executive summary
The HRIS now includes an administrator-controlled facial-attendance kiosk on the login page. Administrators define the approved privacy policy, enroll employees, authorize a browser for one branch, and may separately enable face-only identification.
1:1Employee selects an enrolled branch record; only that template is checked.
1:NNo ID is entered; active templates in the kiosk branch are checked.
0 imagesRaw camera frames stored or uploaded by the feature.
Important legal and privacy boundaryTechnical safeguards support compliance, but they do not make a deployment lawful by themselves. The organization's DPO or legal/privacy officer must approve the real PIA, lawful basis, notice, necessity and proportionality assessment, fallback, retention, and employee-rights procedures. Face-only 1:N identification must be addressed explicitly.
Guide contents
1. Work completed3
2. How the system works4
3. Privacy and security5
4. Administration guide6
5. Employee kiosk guide7
6. Technical reference8
7. Performance and troubleshooting9
8. Testing and acceptance10
Design principles
Explicit activation
The feature is disabled by default. A policy approval gate must be completed before a device can be authorized.
Visible kiosk session
An operator opens the session once. It scans employees automatically and stops when the attendance window is closed.
Scoped matching
Face-only searches never compare against every company employee—only active enrollments in the assigned branch.
Safe rejection
Low-quality, spoof-like, below-threshold, and ambiguous matches fail without guessing or revealing candidates.
Section 1
Delivery summary
What was implemented
Work completed
1Tailwind administration page
Policy management, DPO approval, thresholds, device authorization, enrollment, revocation, status summaries, and audit visibility.
2Login-page kiosk
A clean modal available only to an authorized browser, with privacy notice, fallback, camera guidance, and punch confirmation.
3Encrypted enrollment
Face embeddings are generated in the browser and encrypted with AES-256-GCM before database storage.
4Face-only identification
Optional 1:N matching removes employee-ID entry while retaining company, brand, branch, threshold, and ambiguity boundaries.
5Authorized kiosk devices
Random, expiring, revocable browser credentials stored as hashes and delivered in protected cookies.
6Attendance integration
Successful matches write into the existing attendance schedule, late, undertime, and credit calculations.
7Retention automation
A scheduled command erases expired biometric ciphertext and removes old challenges and verification events.
8Performance tuning
Background preload, face-only warm-up, lighter camera input, model caching, and a slower eye-close action improve kiosk reliability.
Controls added to the admin policy
| Control | Purpose | Default |
| Main enablement | Turns facial attendance on for the selected brand. | Off |
| Face-only identification | Allows branch-scoped matching without employee ID. | Off |
| Similarity threshold | Minimum score required for a face match. | 0.55 |
| Ambiguity margin | Minimum lead of best candidate over second best. | 0.08 |
| Liveness / anti-spoof | Minimum assurance scores accepted by the server. | 0.60 / 0.60 |
| Retention | Defines expiry for templates and verification events. | 365 days |
Access pointAdministrators open Settings → Facial Attendance. Authorized employees use the facial-attendance panel on the login page after the admin logs out.
Section 2
Processing flow
How it works
How the system works
Enrollment
1. ExplainShow notice and fallback
›
2. CaptureGenerate embedding locally
›
3. AssureCheck live person and spoof score
›
4. EncryptAES-256-GCM at server
›
5. RetainSave expiry and audit
An enrollment belongs to the employee's company, brand, and assigned branch. Re-enrollment revokes the former template and erases its ciphertext.
Face-only attendance
1. StartOpen kiosk session once
›
2. VerifyEye-close, liveness and anti-spoof
›
3. ChallengeUse device-bound one-time token
›
4. MatchSearch assigned branch only
›
5. PunchRecord server time
Decision rules
| Check | Accepted when | Failure behavior |
| Device | Token is valid, active, unexpired, and branch-bound. | Kiosk panel is unavailable or request is denied. |
| Challenge | Hash, device, expiry, and unused state are valid. | Request is rejected; token cannot be replayed. |
| Live person | Eye-close signal and configured assurance scores pass. | Employee is told to retry or use fallback. |
| Similarity | Best score meets the configured threshold. | No employee identity is disclosed. |
| Ambiguity | Best score leads the second result by the margin. | System refuses to guess. |
| Duplicate | No accepted punch for employee/device in prior 60 seconds. | Duplicate punch is rejected. |
Attendance slot order
Morning inMorning outAfternoon inAfternoon out
The first empty slot is filled. The system then recalculates the existing schedule, rendered time, lateness, undertime, deductions, and credited days.
Section 3
Protection model
Privacy & security
Privacy and security controls
Data minimization
- Camera frames are processed locally in the browser.
- Raw photographs are not uploaded or stored.
- The submitted numerical embedding is not written to event logs.
- Rejected 1:N scans do not disclose nearby candidates.
- The camera operates only while the visible automatic kiosk session is open.
Access boundaries
- Admin functions require an authorized admin role.
- All administration is scoped to the selected brand.
- A kiosk is assigned to one branch.
- Device credentials expire and can be revoked remotely.
- Cross-origin requests require an exact configured HTTPS origin.
Credential and template protection
| Item | Protection |
| Kiosk token | 32 random bytes; only SHA-256 hash stored; raw token delivered in an HttpOnly cookie. |
| Same-origin cookie | SameSite=Strict; secure flag applied when HTTPS is detected. |
| Approved cross-origin cookie | Exact allowlisted HTTPS origin with Secure; SameSite=None. |
| Face template | AES-256-GCM ciphertext with separate IV and authentication tag. |
| Challenge | Random secret represented by a stored SHA-256 hash; expires after two minutes and is one-use. |
| Event | Stores decision metadata and scores, not raw frames or embeddings. |
Do not weaken thresholds to hide errorsA lower threshold may reduce false rejections while increasing false acceptance. Changes must be evaluated using representative staff, actual kiosk cameras, different lighting, and documented acceptance criteria.
Retention
The daily purge cryptographically erases expired templates, removes challenges expired for more than one day, and deletes verification events according to each brand's configured retention. The non-biometric attendance record follows the organization's separate attendance policy.
Section 4
Operator procedure
Administration guide
Administration guide
A. Install and configure
- Verify the existing attendance schema.
- Run the idempotent facial-attendance installer.
- Create a dedicated encryption secret and place it in the ignored local privacy configuration.
- Use HTTPS for every production camera page.
- Schedule the retention command to run daily.
php backend/scripts/check_facial_attendance_prerequisites.php
php backend/scripts/install_facial_attendance.php
php backend/scripts/purge_facial_attendance_data.php
B. Approve and save the policy
- Select the intended brand.
- Open Settings → Facial Attendance.
- Enter the approved notice version/text, lawful-basis and PIA references, DPO contact, fallback, and retention.
- Set thresholds based on pilot evidence.
- Enable facial attendance, confirm DPO/legal approval, and save.
- Enable 1:N separately only if the approved material explicitly covers face-only identification.
Built-in validationThe notice requires at least 160 characters, fallback at least 40 characters, retention 1–3650 days, valid threshold ranges, non-placeholder policy content, an encryption key, and approval confirmation.
C. Enroll employees
- Select an active employee with an assigned branch.
- Explain the approved notice and usable fallback.
- Record acknowledgment and capture a live face under good lighting.
- Confirm that the admin page shows an active enrollment and expiry date.
D. Authorize a kiosk
- Use the physical browser that will operate as the kiosk.
- Enter a clear device name and select its actual branch.
- Choose an authorization period and activate the browser.
- Log out to expose the kiosk panel on the login page.
Section 5
End-user procedure
Employee kiosk guide
Employee kiosk guide
Face-only mode
- Open Facial attendance on the login page.
- Review the privacy notice if needed.
- Stand in front of the camera; the active session starts automatically.
- Keep one face centered and move close enough.
- Close both eyes for one second when prompted, then open them.
- Wait for the confirmed employee name and punch slot, then step away. After 2.5 seconds, the kiosk prepares for the next employee automatically.
Employee-ID mode
- Open Facial attendance.
- Select your enrolled record from the branch-scoped dropdown.
- Confirm the displayed employee.
- Start the secure face scan.
- Complete the eye-close instruction.
- Wait for server confirmation.
Camera positioning
Light from front
Avoid a bright window behind the employee. Use steady, even lighting.
One person
Keep other faces outside the camera square during the live scan.
Close enough
The face should occupy a useful part of the frame without being cut off.
The fallback is part of the systemIf the employee cannot or should not complete biometric scanning, follow the displayed non-biometric attendance instructions. Repeated scanning is not a substitute for a workable fallback.
Understanding messages
| Message | Meaning and action |
| Center your face | No single usable face is visible; adjust position. |
| Only one person may be visible | Ask others to move outside the camera view. |
| Move closer | The detected face is too small for dependable processing. |
| Close both eyes | Hold both eyes closed for about one second, then reopen. |
| Confidence stayed too low | Improve lighting, remove glare, retry once, or use fallback. |
| Could not identify confidently | No safe unique match was found; use fallback rather than guessing. |
Section 6
Engineering map
Technical reference
Technical reference
Frontend modules
| Module | Responsibility |
FacialAttendanceAdmin.jsx | Tailwind administration, policy, enrollment, devices, and audit UI. |
FacialKioskPanel.jsx | Login-page panel, privacy notice, challenge, identification, and result flow. |
FaceCapture.jsx | Camera lifecycle, model status, capture action, and local error display. |
facialEngine.js | Human model preload, detection, face mesh, embedding, liveness, and anti-spoof. |
public/face-models/ | Locally hosted model manifests and weights. |
Backend modules
| Module | Responsibility |
_common.php | Validation, encryption, similarity, kiosk cookie/origin, scope, and audit helpers. |
device_status.php | Determines whether the browser is an active kiosk and returns policy display data. |
challenge.php | Rate-limited, device-bound, short-lived one-use challenge creation. |
punch.php | Assurance validation, 1:1 or 1:N matching, ambiguity rejection, and event recording. |
attendance_apply.php | Existing attendance slot and schedule/penalty integration. |
admin/ | Admin role gate, settings, device, enrollment, and revocation endpoints. |
Database tables
facial_attendance_settingsfacial_attendance_devicesemployee_face_templatesfacial_attendance_challengesfacial_attendance_eventsfacial_attendance_audit
Important operational limits
- Challenge validity: two minutes.
- Challenge rate: maximum 10 per device per minute.
- 1:N candidate limit: 500 active templates per branch.
- Duplicate accepted punch window: 60 seconds.
- Device authorization: 1–365 days.
- Policy retention range: 1–3650 days.
- Authoritative timezone: Asia/Manila.
Section 7
Support notes
Performance & troubleshooting
Performance and troubleshooting
Why the first scan can be slower
The first authorized kiosk visit loads and initializes approximately 10 MB of local face models. The implementation now begins this work in the background on the login page. Later scans in the same session reuse the initialized engine.
| Problem | Resolution |
| Employee dropdown appears | 1:N is off. The list includes only active facial enrollments in the kiosk branch. Enable 1:N separately to remove selection. |
| Feature is not installed | Run php backend/scripts/install_facial_attendance.php. |
| Feature is not enabled | Complete valid policy content, encryption, approval, and main enablement. |
| Branch selector is empty | Confirm an active branch belongs to the currently selected company and brand. |
| Cross-origin request denied | Use the Vite API proxy locally; in production allowlist only the exact HTTPS frontend origin. |
| Challenge could not be created | Check PHP logs, migrations, device state, branch scope, and active enrollment. |
| Model loading is slow | Keep the login page open briefly; verify static model responses and production caching. |
| Eye-close check times out | Close both eyes for a full second; improve lighting and camera position. |
Missing vite.svg | Clear old site data/service worker once and hard-refresh; dev PWA registration is disabled. |
Performance changes made
- Preload engine after active kiosk status is known.
- Use face-only warm-up rather than full-model warm-up.
- Disable the iris model because the face mesh supplies the eye-close gesture.
- Request a 480 x 480 camera stream instead of 720 x 720.
- Use a lightweight face-mesh stage for the eye-close gesture, followed by one full descriptor, liveness, and anti-spoof stage.
- Run the independent full-stage models through the library's supported asynchronous path.
- Do not reuse descriptor or assurance results across employees.
- Allow 45 seconds for capture while returning more specific failure messages.
- Reset failed model initialization so a subsequent scan can retry.
- Display separate local-scan and server-match timings after success.
Escalate persistent slowness with evidenceRecord kiosk CPU/GPU, browser version, camera resolution, model request timing, inference messages, lighting, and approximate seconds to first and subsequent scans. This distinguishes network loading from device inference and match-server latency.
Section 8
Release readiness
Testing & acceptance
Testing and acceptance
Verification already performed
- Idempotent migrations executed against local MariaDB.
- Identification columns and nullable no-ID challenges verified.
- PHP syntax checks passed for facial-attendance endpoints.
- Targeted ESLint checks passed for the React modules.
- A complete Vite production build succeeded.
- Employee/template SQL joins were corrected for database collation differences.
Production acceptance checklist
- DPO/legal approval and the PIA are documented.
- The notice accurately describes the selected 1:1 or 1:N behavior.
- A practical non-biometric fallback is available without retaliation or undue delay.
- The dedicated encryption key is securely configured and recoverably managed.
- HTTPS and exact frontend origins are configured.
- Each kiosk is assigned to the correct branch and expires appropriately.
- Only intended employees are enrolled and acknowledgment is recorded.
- False acceptance and rejection are measured with representative participants.
- All four attendance slots and schedule calculations are verified.
- Ambiguous, spoof, duplicate, expired, revoked-device, and revoked-template cases are tested.
- The purge job is scheduled, monitored, and tested.
- Incident, access-review, employee-request, and revocation procedures are exercised.
Known limitations
- Browser liveness and anti-spoof are MVP controls, not certified presentation-attack detection.
- 1:N comparison is synchronous and linear, with a 500-template branch cap.
- First-time performance depends on kiosk hardware and model delivery speed.
- Thresholds require organization-specific validation.
- Hands-free scanning is active only while the visible kiosk window remains open; closing it stops the camera and retries.
- The attendance policy currently fills four daily slots sequentially.
Recommended rolloutBegin with a supervised pilot, preserve the fallback, monitor failures without pressuring employees, review demographic and environmental performance, and obtain final DPO/legal sign-off before broader production use.