Skip to content

Commit cda4365

Browse files
committed
CH-273 access denied mitigation: auto hard reload once
1 parent 3b20f74 commit cda4365

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

deployment-configuration/helm/templates/auto-gatekeepers.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,30 @@ data:
7272
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
7373
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
7474
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
75+
<script>
76+
(function () {
77+
var cookieName = "ch_403_reloaded";
78+
var queryFlag = "gk403reloaded=1";
79+
var hasQueryFlag = window.location.search.indexOf(queryFlag) !== -1;
80+
var hasCookie = document.cookie.indexOf(cookieName + "=1") !== -1;
81+
82+
// Force one hard reload only once, then stop to avoid loops.
83+
if (!hasQueryFlag && !hasCookie) {
84+
var separator = window.location.search ? "&" : "?";
85+
var reloadUrl = window.location.pathname + window.location.search + separator + queryFlag + window.location.hash;
86+
document.cookie = cookieName + "=1; path=/; max-age=120; SameSite=Lax";
87+
window.location.replace(reloadUrl);
88+
return;
89+
}
90+
91+
// Show content only when not redirecting.
92+
document.documentElement.style.visibility = "visible";
93+
})();
94+
</script>
7595
<style>
96+
html {
97+
visibility: hidden;
98+
}
7699
.oops {
77100
font-size: 9em;
78101
letter-spacing: 2px;

0 commit comments

Comments
 (0)