SuruchBoss / SuruchBoss/Cwork

CW-025 · Harden offline punch capture

Open
#23 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

attendance P1 phase-2 security
Dominant language
TypeScript
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Priority P1 · Area attendance · security · Estimate M · Phase 2

The server credits the instant a punch was captured, which is right — someone in a warehouse with no signal should not lose the time. But punch_queue.dart keeps that queue in SharedPreferences, which the owner of a rooted device can edit, so arrival times are forgeable.

Meanwhile the API accepts dto.isRootedDevice and the app never sends it: there is no root-detection dependency in pubspec.yaml, so ROOTED_DEVICE can never be raised.

Scope

  • Move the queue to flutter_secure_storage, which tokens already use.
  • Detect and send rooted/jailbroken status so the flag the backend is waiting for actually fires.
  • A configurable ceiling — 12 hours as the starting value — beyond which a queued punch is flagged for a manager to confirm. The real number comes from the pilot's flag rate; 12 is a placeholder, not a decision.
  • Confirmation runs through the existing approval engine, with only two outcomes: acknowledge, or reject the flag. It must never create or delete a punch: attendance_punches is append-only at the database level and that property is load-bearing.

Acceptance

  • A punch replayed 14 hours late is accepted, flagged, and appears in a manager's queue.
  • Confirming or rejecting writes no new punch and deletes none.
  • A rooted device produces ROOTED_DEVICE end to end.

Files mobile/lib/features/attendance/data/, backend/src/modules/attendance/, backend/src/modules/approvals/


Tracked in docs/backlog.md.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with mobile/lib/features/attendance/data/punch_queue.dart and the existing secure token storage, then trace the attendance API DTO and the approval engine in backend/src/modules/attendance/ and backend/src/modules/approvals/. Done means delayed punches can be flagged and queued for managers, rooted-device status reaches the backend, and approval outcomes create or delete no punches.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter, postgresql, typescript
Domain
backend, database, mobile, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.