Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event housekeeping #493

Merged
merged 4 commits into from
Sep 1, 2024
Merged

Event housekeeping #493

merged 4 commits into from
Sep 1, 2024

Conversation

LucientZ
Copy link
Collaborator

@LucientZ LucientZ commented Sep 1, 2024

This PR adds some enhancements to eventSignIn and eventSignOut

The most notable fix is a check to ensure users cannot simply sign in for other users:

// Only allow privileged users to sign-in for other users
const token = context.auth.token;
if (uid !== context.auth.uid && (token.admin !== true && token.officer !== true && token.developer !== true && token.secretary !== true && token.lead !== true && token.representative !== true)) {
    functions.logger.warn(`${context.auth.token} attempted to sign in as ${uid} with invalid permissions.`);
    throw new functions.https.HttpsError("permission-denied", `Invalid credentials`);
}

May want to possibly create a function which evaluates if a given user auth object is privileged so the boolean evaluation is more readable.

@LucientZ LucientZ requested a review from JasonIsAzn September 1, 2024 03:24
@LucientZ LucientZ merged commit 750f847 into dev Sep 1, 2024
1 check passed
@LucientZ LucientZ deleted the event-housekeeping branch September 1, 2024 03:38
@LucientZ LucientZ linked an issue Sep 1, 2024 that may be closed by this pull request
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.

Fix critical vulnerability in eventSignIn and eventSignOut
2 participants