fix: Some authentication notices not displayed, injection of arbitrary strings

This commit is contained in:
Tom Moor
2023-04-11 21:54:53 -04:00
parent 3e20c437fa
commit a9800165c1
3 changed files with 38 additions and 34 deletions

View File

@@ -7,7 +7,6 @@ import useQuery from "~/hooks/useQuery";
export default function Notices() { export default function Notices() {
const query = useQuery(); const query = useQuery();
const notice = query.get("notice"); const notice = query.get("notice");
const description = query.get("description");
if (!notice) { if (!notice) {
return null; return null;
@@ -15,12 +14,18 @@ export default function Notices() {
return ( return (
<Notice icon={<WarningIcon color="currentcolor" />}> <Notice icon={<WarningIcon color="currentcolor" />}>
{notice === "domain-not-allowed" && (
<Trans>
The domain associated with your email address has not been allowed for
this workspace.
</Trans>
)}
{notice === "domain-required" && ( {notice === "domain-required" && (
<Trans> <Trans>
Unable to sign-in. Please navigate to your team's custom URL, then try Unable to sign-in. Please navigate to your workspace's custom URL,
to sign-in again. then try to sign-in again.
<hr /> <hr />
If you were invited to a team, you will find a link to it in the If you were invited to a workspace, you will find a link to it in the
invite email. invite email.
</Trans> </Trans>
)} )}
@@ -33,7 +38,7 @@ export default function Notices() {
)} )}
{notice === "maximum-teams" && ( {notice === "maximum-teams" && (
<Trans> <Trans>
The team you authenticated with is not authorized on this The workspace you authenticated with is not authorized on this
installation. Try another? installation. Try another?
</Trans> </Trans>
)} )}
@@ -54,34 +59,28 @@ export default function Notices() {
try again in a few minutes. try again in a few minutes.
</Trans> </Trans>
)} )}
{(notice === "auth-error" || notice === "state-mismatch") && {(notice === "auth-error" || notice === "state-mismatch") && (
(description ? ( <Trans>
<>{description}</> Authentication failed we were unable to sign you in at this time.
) : ( Please try again.
<Trans> </Trans>
Authentication failed we were unable to sign you in at this time. )}
Please try again. {notice === "invalid-authentication" && (
</Trans> <Trans>
))} Authentication failed you do not have permission to access this
{notice === "invalid-authentication" && workspace.
(description ? ( </Trans>
<>{description}</> )}
) : (
<Trans>
Authentication failed you do not have permission to access this
team.
</Trans>
))}
{notice === "expired-token" && ( {notice === "expired-token" && (
<Trans> <Trans>
Sorry, it looks like that sign-in link is no longer valid, please try Sorry, it looks like that sign-in link is no longer valid, please try
requesting another. requesting another.
</Trans> </Trans>
)} )}
{notice === "suspended" && ( {(notice === "suspended" || notice === "user-suspended") && (
<Trans> <Trans>
Your account has been suspended. To re-activate your account, please Your account has been suspended. To re-activate your account, please
contact a team admin. contact a workspace admin.
</Trans> </Trans>
)} )}
{notice === "authentication-provider-disabled" && ( {notice === "authentication-provider-disabled" && (
@@ -92,16 +91,16 @@ export default function Notices() {
)} )}
{notice === "invite-required" && ( {notice === "invite-required" && (
<Trans> <Trans>
The team you are trying to join requires an invite before you can The workspace you are trying to join requires an invite before you can
create an account. create an account.
<hr /> <hr />
Please request an invite from your team admin and try again. Please request an invite from your workspace admin and try again.
</Trans> </Trans>
)} )}
{notice === "domain-not-allowed" && ( {notice === "domain-not-allowed" && (
<Trans> <Trans>
Sorry, your domain is not allowed. Please try again with an allowed Sorry, your domain is not allowed. Please try again with an allowed
team domain. workspace domain.
</Trans> </Trans>
)} )}
</Notice> </Notice>

View File

@@ -111,6 +111,10 @@ async function accountProvisioner({
} }
} }
if (err.id) {
throw err;
}
if (!result) { if (!result) {
throw InvalidAuthenticationError(err.message); throw InvalidAuthenticationError(err.message);
} }

View File

@@ -628,19 +628,20 @@
"You signed in with {{ authProviderName }} last time.": "You signed in with {{ authProviderName }} last time.", "You signed in with {{ authProviderName }} last time.": "You signed in with {{ authProviderName }} last time.",
"Or": "Or", "Or": "Or",
"Already have an account? Go to <1>login</1>.": "Already have an account? Go to <1>login</1>.", "Already have an account? Go to <1>login</1>.": "Already have an account? Go to <1>login</1>.",
"Unable to sign-in. Please navigate to your team's custom URL, then try to sign-in again.<1></1>If you were invited to a team, you will find a link to it in the invite email.": "Unable to sign-in. Please navigate to your team's custom URL, then try to sign-in again.<1></1>If you were invited to a team, you will find a link to it in the invite email.", "The domain associated with your email address has not been allowed for this workspace.": "The domain associated with your email address has not been allowed for this workspace.",
"Unable to sign-in. Please navigate to your workspace's custom URL, then try to sign-in again.<1></1>If you were invited to a workspace, you will find a link to it in the invite email.": "Unable to sign-in. Please navigate to your workspace's custom URL, then try to sign-in again.<1></1>If you were invited to a workspace, you will find a link to it in the invite email.",
"Sorry, a new account cannot be created with a personal Gmail address.<1></1>Please use a Google Workspaces account instead.": "Sorry, a new account cannot be created with a personal Gmail address.<1></1>Please use a Google Workspaces account instead.", "Sorry, a new account cannot be created with a personal Gmail address.<1></1>Please use a Google Workspaces account instead.": "Sorry, a new account cannot be created with a personal Gmail address.<1></1>Please use a Google Workspaces account instead.",
"The team you authenticated with is not authorized on this installation. Try another?": "The team you authenticated with is not authorized on this installation. Try another?", "The workspace you authenticated with is not authorized on this installation. Try another?": "The workspace you authenticated with is not authorized on this installation. Try another?",
"We could not read the user info supplied by your identity provider.": "We could not read the user info supplied by your identity provider.", "We could not read the user info supplied by your identity provider.": "We could not read the user info supplied by your identity provider.",
"Your account uses email sign-in, please sign-in with email to continue.": "Your account uses email sign-in, please sign-in with email to continue.", "Your account uses email sign-in, please sign-in with email to continue.": "Your account uses email sign-in, please sign-in with email to continue.",
"An email sign-in link was recently sent, please check your inbox or try again in a few minutes.": "An email sign-in link was recently sent, please check your inbox or try again in a few minutes.", "An email sign-in link was recently sent, please check your inbox or try again in a few minutes.": "An email sign-in link was recently sent, please check your inbox or try again in a few minutes.",
"Authentication failed we were unable to sign you in at this time. Please try again.": "Authentication failed we were unable to sign you in at this time. Please try again.", "Authentication failed we were unable to sign you in at this time. Please try again.": "Authentication failed we were unable to sign you in at this time. Please try again.",
"Authentication failed you do not have permission to access this team.": "Authentication failed you do not have permission to access this team.", "Authentication failed you do not have permission to access this workspace.": "Authentication failed you do not have permission to access this workspace.",
"Sorry, it looks like that sign-in link is no longer valid, please try requesting another.": "Sorry, it looks like that sign-in link is no longer valid, please try requesting another.", "Sorry, it looks like that sign-in link is no longer valid, please try requesting another.": "Sorry, it looks like that sign-in link is no longer valid, please try requesting another.",
"Your account has been suspended. To re-activate your account, please contact a team admin.": "Your account has been suspended. To re-activate your account, please contact a team admin.", "Your account has been suspended. To re-activate your account, please contact a workspace admin.": "Your account has been suspended. To re-activate your account, please contact a workspace admin.",
"Authentication failed this login method was disabled by a team admin.": "Authentication failed this login method was disabled by a team admin.", "Authentication failed this login method was disabled by a team admin.": "Authentication failed this login method was disabled by a team admin.",
"The team you are trying to join requires an invite before you can create an account.<1></1>Please request an invite from your team admin and try again.": "The team you are trying to join requires an invite before you can create an account.<1></1>Please request an invite from your team admin and try again.", "The workspace you are trying to join requires an invite before you can create an account.<1></1>Please request an invite from your workspace admin and try again.": "The workspace you are trying to join requires an invite before you can create an account.<1></1>Please request an invite from your workspace admin and try again.",
"Sorry, your domain is not allowed. Please try again with an allowed team domain.": "Sorry, your domain is not allowed. Please try again with an allowed team domain.", "Sorry, your domain is not allowed. Please try again with an allowed workspace domain.": "Sorry, your domain is not allowed. Please try again with an allowed workspace domain.",
"Any collection": "Any collection", "Any collection": "Any collection",
"Any time": "Any time", "Any time": "Any time",
"Past day": "Past day", "Past day": "Past day",