Skip to content

Commit

Permalink
Include token & auth in Entra redirect state (#442)
Browse files Browse the repository at this point in the history
  • Loading branch information
mclmax authored May 27, 2024
1 parent d1d7461 commit ac0bba1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
13 changes: 8 additions & 5 deletions frontend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,11 +586,14 @@ async def azure_css_landing(
"""
info = ""
if admin_consent == "True":
tenant_id = tenant
if css := state:
css = b64decode(unquote(state)).decode()
if css is not None and tenant_id is not None:
(success, info) = install_azure_css(tenant_id, css)
css = None
token = None
token_auth = None

css, token, token_auth = b64decode(unquote(state)).decode().split(":")

if css is not None and tenant is not None:
(success, info) = install_azure_css(tenant, css)
info += " We have uninstalled our application from you tenant, revoking all of our permissions."
else:
info = "Installation failed due to lack of sufficient granted permissions."
Expand Down
5 changes: 4 additions & 1 deletion templates/generate_new.html
Original file line number Diff line number Diff line change
Expand Up @@ -1508,7 +1508,10 @@ <h3>Your log4shell token is active!</h3>
}
var _handleEntraClonedWebsiteResponse = function(data) {
$('#result_entra_cloned_website').append(data['css']);
state = escape(btoa(data['css']));
const encodedCss = btoa(data['css']);
const encodedData = btoa(`${encodedCss}:${data['token']}:${data['auth_token']}`);
state = encodeURIComponent(encodedData);

redirect = window.location.origin + '/azure_css_landing';
loc = "https://login.microsoftonline.com/common/adminconsent?client_id=" + data['client_id'] + "&state=" + state + "&redirect_uri=" + redirect;
$('#azure_popup').attr('onclick', 'window.open("' + loc + '"); return false;')
Expand Down

0 comments on commit ac0bba1

Please sign in to comment.