Skip to content

Let the attendance account scan without making it an admin - #26

Open
Krishna-Das20 wants to merge 2 commits into
fed-tech:mainfrom
Krishna-Das20:main
Open

Let the attendance account scan without making it an admin#26
Krishna-Das20 wants to merge 2 commits into
fed-tech:mainfrom
Krishna-Das20:main

Conversation

@Krishna-Das20

Copy link
Copy Markdown
Collaborator

Restricting markAttendance to ADMIN closed a real hole — a participant can mint their own QR through /api/form/attendanceCode and post it back to mark themselves present — but it also locked out attendance@fedkiit.com, which is a plain USER and exists only to run a scanner at the door. Since that shipped, nobody has been able to scan.

Promoting the account to ADMIN would fix it and also hand a shared login the ability to edit and delete events and export payment proofs, so instead the check becomes a permission of its own. FORM_ATTENDANCE_MARK holds the six senior-executive roles the Express author wrote and then commented out in routes/api/forms/formRoutes.js, and FORM_ATTENDANCE_ALLOWED_EMAILS names addresses that qualify regardless of role, the way FORM_ANALYTICS_ALLOWED_EMAILS already did.

The account stays a USER, so it gains the scanner page and markAttendance and nothing else: addForm, editForm and deleteForm still ask isAdmin. Verified across eight role and address combinations.

export-attendance stays ADMIN-only. It includes payment proof screenshots, which is a wider disclosure than scanning and a separate decision.

Restricting markAttendance to ADMIN closed a real hole — a participant
can mint their own QR through /api/form/attendanceCode and post it back
to mark themselves present — but it also locked out
attendance@fedkiit.com, which is a plain USER and exists only to run a
scanner at the door. Since that shipped, nobody has been able to scan.

Promoting the account to ADMIN would fix it and also hand a shared login
the ability to edit and delete events and export payment proofs, so
instead the check becomes a permission of its own. FORM_ATTENDANCE_MARK
holds the six senior-executive roles the Express author wrote and then
commented out in routes/api/forms/formRoutes.js, and
FORM_ATTENDANCE_ALLOWED_EMAILS names addresses that qualify regardless
of role, the way FORM_ANALYTICS_ALLOWED_EMAILS already did.

The account stays a USER, so it gains the scanner page and
markAttendance and nothing else: addForm, editForm and deleteForm still
ask isAdmin. Verified across eight role and address combinations.

export-attendance stays ADMIN-only. It includes payment proof
screenshots, which is a wider disclosure than scanning and a separate
decision.
@vercel

vercel Bot commented Aug 11, 2026

Copy link
Copy Markdown

@Krishna-Das20 is attempting to deploy a commit to the fedkiitgmailcom's projects Team on Vercel.

A member of the Team first needs to authorize it.

Takes the new work from satyampandey-1105:my-changes — the /Insights page,
the social-posts CRUD API, the management panel and the SocialPost model
— without merging the branch itself. It was cut from Beta (fed-tech#12) and is 86
commits behind, so a real merge conflicted in next.config.ts and tried to
restore src/layouts/Navbar/Navbar.tsx, a file since deleted. Taking the
paths instead avoids reconciling two histories at all.

Replaces the x-admin-secret header with the session check every other
admin route uses. The header was a stopgap for a contributor without an
admin account, but it authenticated nobody in particular: one shared
password, no record of who changed a post, and the browser had to hold
the secret to send it — kept in sessionStorage and a cookie that was
neither httpOnly nor Secure, readable by any script on the page for a
day. The session cookie is httpOnly and already identifies the person.

/profile/social is gated server-side like /profile/attendance, so a
signed-in participant who types the path does not get a screen of
controls that all fail.

The unfiltered GET is now ADMIN-only. It returns posts an admin has
deliberately hidden, so leaving it open meant unpublishing a post still
left it readable to anyone who dropped the query string. ?visible=true
stays public; the /Insights page does not use the route either way,
since SocialFeed reads Prisma directly.

Insights is reachable from the navbar, which said "Insights" but pointed
at /Blog. /Blog and /Social now redirect there, as do the lowercase
forms, so existing links keep working.

Verified against a running server: anonymous 401 on every mutating
route, signed-in non-admin 403, admin full create/toggle/delete. The old
secret header no longer grants anything.

Not taken: the bcryptjs removal from serverExternalPackages, an em-dash
corrupted to a replacement character, a tsconfig include pointing at a
global.d.ts the branch does not contain, the seed script, and 942 lines
of AI planning notes under .agents/ and .kilo/.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant