fix: payload cleanup (#13552)

* fix: payload cleanup

* Update eventType.ts

* Send whitelisted fields everywhere

* Removed a user select

* Removed extra usage of users

* Put back user field with fewer selects

* Added user pick

* Removed more users selects

* Another select removal

---------

Co-authored-by: Hariom <[email protected]>
Co-authored-by: Keith Williams <[email protected]>
This commit is contained in:
authored and GitHub committed 2024-02-06 11:20:08 -03:00
1 parent bba68e09a9
commit 66b5dfd796
19 files changed
+230 -48

No files matched your search

@@ -47,7 +47,7 @@ const loginWithTotp = async (user: { email: string }) =>
type UserTeams = {
teams: (Membership & {
team: Team;
team: Pick<Team, "metadata">;
})[];
};
@@ -106,7 +106,9 @@ const providers: Provider[] = [
throw new Error(ErrorCode.InternalServerError);
}
const user = await UserRepository.findByEmailAndIncludeProfiles({ email: credentials.email });
const user = await UserRepository.findByEmailAndIncludeProfilesAndPassword({
email: credentials.email,
});
// Don't leak information about it being username or password that is invalid
if (!user) {
throw new Error(ErrorCode.IncorrectEmailPassword);
@@ -273,7 +275,9 @@ if (isSAMLLoginEnabled) {
email?: string;
locale?: string;
}) => {
const user = await UserRepository.findByEmailAndIncludeProfiles({ email: profile.email || "" });
const user = await UserRepository.findByEmailAndIncludeProfilesAndPassword({
email: profile.email || "",
});
if (!user) {
throw new Error(ErrorCode.UserNotFound);
}
@@ -339,7 +343,7 @@ if (isSAMLLoginEnabled) {
}
const { id, firstName, lastName, email } = userInfo;
const user = await UserRepository.findByEmailAndIncludeProfiles({ email });
const user = await UserRepository.findByEmailAndIncludeProfilesAndPassword({ email });
if (!user) {
throw new Error(ErrorCode.UserNotFound);
}