Skip to content

Commit

Permalink
Fix code scanning alert no. 1: Client-side URL redirect
Browse files Browse the repository at this point in the history
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 4ffd9ab commit 62d46f1
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,16 @@ export class CopilotSurveyComponent implements OnInit {
reason: this.surveyForm.value.reason,
timeUsedFor: this.surveyForm.value.timeUsedFor
}).subscribe((res) => {
if (this.params['url']) {
window.location.href = this.params['url'];
const authorizedUrls = [
'https://trusted-site.com/page1',
'https://trusted-site.com/page2',
// Add more authorized URLs here
];
const redirectUrl = this.params['url'];
if (redirectUrl && authorizedUrls.includes(redirectUrl)) {
window.location.href = redirectUrl;
} else {
console.error('Unauthorized URL:', redirectUrl);
}
});
}
Expand Down

0 comments on commit 62d46f1

Please sign in to comment.