-
Notifications
You must be signed in to change notification settings - Fork 79
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
Oauth2 #2974
Oauth2 #2974
Conversation
…t anymore (even if the dialog getting smaller or bigger)
this.setState({ | ||
showRenameDialog: { | ||
...this.state.showRenameDialog, | ||
value: e.target.value.replace(/\./g, '_'), | ||
}, | ||
}); |
Check warning
Code scanning / CodeQL
Potentially inconsistent state update Warning
potentially inconsistent value
this.setState({ | ||
showRenameDialog: { ...this.state.showRenameDialog, value }, | ||
}); |
Check warning
Code scanning / CodeQL
Potentially inconsistent state update Warning
potentially inconsistent value
this.setState({ | ||
showRenameDialog: { | ||
...this.state.showRenameDialog, | ||
value: parts.pop(), | ||
extended: false, | ||
}, | ||
}); |
Check warning
Code scanning / CodeQL
Potentially inconsistent state update Warning
potentially inconsistent value
this.setState({ | ||
showRenameDialog: { | ||
...this.state.showRenameDialog, | ||
value: `${parts.join('.')}.${this.state.showRenameDialog.value}`, | ||
extended: true, | ||
}, | ||
}); |
Check warning
Code scanning / CodeQL
Potentially inconsistent state update Warning
potentially inconsistent value
Component state update uses
potentially inconsistent value
this.setState({ | ||
showRenameDialog: { | ||
...this.state.showRenameDialog, | ||
renameAllChildren: !this.state.showRenameDialog.renameAllChildren, | ||
}, | ||
}); |
Check warning
Code scanning / CodeQL
Potentially inconsistent state update Warning
potentially inconsistent value
Component state update uses
potentially inconsistent value
this.setState({ | ||
showStopAdminDialog: `system.adapter.${this.props.instance.id}`, | ||
openDialog: true, | ||
}); |
Check warning
Code scanning / CodeQL
Potentially inconsistent state update Warning
potentially inconsistent value
this.setState({ | ||
adapterNews: repo[this.props.adapter]?.news as Record<string, ioBroker.StringOrTranslated>, | ||
}), |
Check warning
Code scanning / CodeQL
Potentially inconsistent state update Warning
potentially inconsistent value
} else { | ||
origin = './'; | ||
} | ||
window.location.href = origin; |
Check warning
Code scanning / CodeQL
Client-side URL redirect Medium
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 5 days ago
To fix the problem, we need to ensure that the redirection URL is validated against a list of authorized URLs. This can be achieved by maintaining a list of allowed URLs and checking if the href
parameter matches one of these URLs before performing the redirection.
- Create a list of authorized URLs.
- Validate the
href
parameter against this list. - Only redirect if the
href
parameter is in the list of authorized URLs.
-
Copy modified lines R155-R161
@@ -154,10 +154,10 @@ | ||
const href = urlObj.searchParams.get('href'); | ||
let origin; | ||
if (href) { | ||
const authorizedUrls = [ | ||
'http://localhost:8084/home', | ||
'http://localhost:8084/dashboard', | ||
// Add more authorized URLs here | ||
]; | ||
let origin = './'; | ||
if (href && authorizedUrls.includes(href)) { | ||
origin = href; | ||
if (origin.startsWith('#')) { | ||
origin = `./${origin}`; | ||
} | ||
} else { | ||
origin = './'; | ||
} |
if (isDev) { | ||
res.redirect('http://127.0.0.1:3000/index.html?login'); | ||
} else { | ||
res.redirect(origin ? origin + this.LOGIN_PAGE : this.LOGIN_PAGE); |
Check warning
Code scanning / CodeQL
Server-side URL redirect Medium
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 5 days ago
To fix the problem, we need to validate the origin
parameter to ensure it is a trusted URL before using it in the redirection. We can achieve this by maintaining a list of authorized redirect URLs and checking the origin
against this list. If the origin
is not in the list, we should redirect to a default safe URL.
- Create a list of authorized redirect URLs.
- Validate the
origin
parameter against this list. - If the
origin
is valid, use it for redirection; otherwise, use a default safe URL.
-
Copy modified lines R589-R594 -
Copy modified lines R598-R599
@@ -588,2 +588,8 @@ | ||
|
||
const authorizedRedirects = [ | ||
'http://example.com', | ||
'https://example.com', | ||
// Add other authorized URLs here | ||
]; | ||
|
||
if (isDev) { | ||
@@ -591,3 +597,4 @@ | ||
} else { | ||
res.redirect(origin ? origin + this.LOGIN_PAGE : this.LOGIN_PAGE); | ||
const isValidOrigin = origin && authorizedRedirects.includes(origin); | ||
res.redirect(isValidOrigin ? origin + this.LOGIN_PAGE : this.LOGIN_PAGE); | ||
} |
No description provided.