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

[IAMRISK-3011] Auth0 V2 Captcha failOpen support #1382

Merged

Conversation

alexkoumarianos-okta
Copy link
Contributor

Changes

Made changes to allow auth0_v2 to handle failOpen by passing a distinct dummy token.

References

https://auth0team.atlassian.net/browse/IAMRISK-3011

test/web-auth/captcha.test.js Fixed Show fixed Hide fixed
test/web-auth/captcha.test.js Fixed Show fixed Hide fixed
Copy link
Contributor

@srijonsaha srijonsaha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice start, left some comments to address

@@ -189,6 +189,23 @@ function injectCaptchaScript(element, opts, callback, setValue) {
window.arkose = arkose;
callback(arkose);
};
} else if (opts.provider === AUTH0_V2_CAPTCHA_PROVIDER) {
var a0RetryCount = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't have a separate variable for Auth0 V2, we can use the retryCount variable since when this script runs there will always be one provider so the counter will only represent the retries for that provider.

@@ -189,6 +189,23 @@ function injectCaptchaScript(element, opts, callback, setValue) {
window.arkose = arkose;
callback(arkose);
};
} else if (opts.provider === AUTH0_V2_CAPTCHA_PROVIDER) {
var a0RetryCount = 0;
attributes['error-callback'] = function () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is correct. Are you trying to retry the script loading? That should be done through the attribute 'onerror' like Arkose example above. Also let's try to combine the code since it's identical to Arkose.

https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement#examples

if (a0RetryCount < MAX_RETRY) {
setValue();
globalForCaptchaProvider(challenge.provider).reset(widgetId);
a0RetryCount++;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's try to use the retryCount variable.

globalForCaptchaProvider(challenge.provider).reset(widgetId);
a0RetryCount++;
} else {
// similar implementation to ARKOSE_PROVIDER failOpen
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: no need for comment, let's remove

Copy link

@TSLarson TSLarson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@frederikprijck frederikprijck merged commit a8c4789 into auth0:master Jan 4, 2024
18 checks passed
@frederikprijck frederikprijck mentioned this pull request Jan 4, 2024
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.

4 participants