Skip to content

Commit 0216032

Browse files
edge case for allowed_logout_urls (#97)
1 parent 174c9cb commit 0216032

File tree

4 files changed

+51
-3
lines changed

4 files changed

+51
-3
lines changed

analyzer/lib/clients/checkAllowedLogoutUrl.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ function checkURLsForApp(app) {
7777
return report;
7878
}
7979
allowed_logout_urls.forEach((url) => {
80+
if (!url) {
81+
// Skip null/undefined/empty URLs and log warning
82+
console.warn(`[WARNING] App "${app.name}" (${app.client_id}) has null/undefined URL in allowed_logout_urls`);
83+
return;
84+
}
8085
const subArr = insecurePatterns.filter((str) => url.includes(str));
8186
if (subArr.length > 0) {
8287
report.push({

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@auth0/auth0-checkmate",
3-
"version": "1.6.14",
3+
"version": "1.6.15",
44
"description": "A command line tool for checking configuration of your Auth0 tenant",
55
"main": "analyzer/report.js",
66
"scripts": {

tests/clients/checkAllowedLogoutUrl.test.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,4 +146,47 @@ describe("checkAllowedLogoutUrl", function () {
146146
]);
147147
});
148148
});
149+
150+
it("should handle null/undefined URLs in allowed_logout_urls array without crashing", function () {
151+
const options = {
152+
clients: [
153+
{
154+
name: "Test App with Null URLs",
155+
client_id: "client_with_null",
156+
allowed_logout_urls: ["https://contoso.com", null, "http://localhost:3000", undefined], // Contains null and undefined
157+
app_type: "spa",
158+
is_first_party: false,
159+
},
160+
],
161+
};
162+
163+
checkAllowedLogoutUrl(options, (reports) => {
164+
// Should only process valid URLs and skip null/undefined
165+
expect(reports).to.deep.equal([
166+
{
167+
name: "Test App with Null URLs (client_with_null)",
168+
report: [
169+
{
170+
name: "Test App with Null URLs (client_with_null)",
171+
client_id: "client_with_null",
172+
field: "insecure_allowed_logout_urls",
173+
value: "http://localhost:3000",
174+
status: CONSTANTS.FAIL,
175+
app_type: "spa",
176+
is_first_party: false,
177+
},
178+
{
179+
name: "Test App with Null URLs (client_with_null)",
180+
client_id: "client_with_null",
181+
field: "secure_allowed_logout_urls",
182+
status: CONSTANTS.SUCCESS,
183+
value: "https://contoso.com",
184+
app_type: "spa",
185+
is_first_party: false,
186+
},
187+
],
188+
},
189+
]);
190+
});
191+
});
149192
});

0 commit comments

Comments
 (0)