我試圖將「通過Google進行身份驗證」嵌入到我正在處理的簡單Web應用程序中。我用下面的代碼來做到這一點。安全錯誤 - 該頁面包含來自第三方域的一個或多個腳本文件
<html>
<head>
<title> Home </title>
<script src = "https://apis.google.com/js/platform.js?onload=onLoadCallback" ></script>
<script>
function changePage() {
if (!gapi.auth2.getAuthInstance().isSignedIn.get()) {
window.location.href = "login.jsp";
}
}
</script>
<script>
gapi.load('auth2', function() {
gapi.auth2.init().then(changePage);
});
</script>
<script>
</script>
<script>
var user;
function signOut() {
var auth2 = gapi.auth2.getAuthInstance();
user = auth2.signOut().then(changePage);
}
;
</script>
<meta name="google-signin-client_id" content="xxxxxxxxxxxx">
</head>
<body style="background-color:azure;">
<div class="vertcal-center">
<div class="myclass">
<h1>Welcome to home page
</h1>
<button type="button" class="button" onclick="signOut()">Log Out</button>
</div>
</div>
</body>
</html>
然而,當我在我的代碼跑ZAP分析,它給了我一個低風險警告,指出"The page includes one or more script files from a third-party domain"
。它指出跟隨線作爲問題的線。
<script src = "https://apis.google.com/js/platform.js?onload=onLoadCallback" ></script>
我指OWASP tutorial它描述了這個問題,據我所知,這會帶來他們所提到的3個險這些
控制權變更的客戶端應用程序的損失。
在客戶端系統上執行任意代碼。
將敏感信息泄露或泄露給第三方。
不過,我也明白,如果我要使用谷歌認證,我必須相信谷歌並假定他們不會做什麼壞事這裏。
有沒有更好的方法在我的代碼中做到這一點,以便ZAP不會警告我?
可以忽略此警報嗎?
是否有任何安全問題引起的外部JavaScript將通過使用上述提到的防止?或者他們只是避免ZAP警告? –
「完整性」屬性確保腳本未被篡改 - 如果是,則完整性值將錯誤,並且瀏覽器不應加載腳本。 –