Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/components/BootstrapBlazor.HikVision/wwwroot/hikvision.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ export async function init(id) {
await addScript('./_content/BootstrapBlazor.HikVision/jsVideoPlugin-1.0.0.min.js');
await addScript('./_content/BootstrapBlazor.HikVision/webVideoCtrl.js');

if (window.$ === void 0) {
await addScript('./_content/BootstrapBlazor.HikVision/jquery-1.7.1.min.js');
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 issue (security): Loading jQuery 1.7.1 introduces potential security and compatibility concerns; consider a more recent version if possible.

jQuery 1.7.1 has known security issues and poor support in modern browsers. If you can change this dependency, please use a supported jQuery version (1.x LTS or newer) that remains compatible with the HikVision plugin to avoid relying on a vulnerable library.

Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jQuery 1.7.1 is from 2011 and has multiple known security vulnerabilities (CVE-2012-6708, CVE-2015-9251, CVE-2019-11358, CVE-2020-11022, CVE-2020-11023). Consider upgrading to jQuery 3.7.1 or later, which includes security fixes and is still compatible with legacy code. If the HikVision plugin requires this specific old version, document this requirement and the security implications.

Suggested change
await addScript('./_content/BootstrapBlazor.HikVision/jquery-1.7.1.min.js');
// Updated to jQuery 3.7.1 for security reasons (CVE-2012-6708, CVE-2015-9251, CVE-2019-11358, CVE-2020-11022, CVE-2020-11023)
// If the HikVision plugin fails with this version, revert to 1.7.1 and document the risk.
await addScript('./_content/BootstrapBlazor.HikVision/jquery-3.7.1.min.js');

Copilot uses AI. Check for mistakes.
}
Comment on lines 5 to +10
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The jQuery check and loading happens after loading webVideoCtrl.js, but webVideoCtrl.js depends on jQuery. The file contains extensive jQuery usage (e.g., $, $("#"+id), $.each, etc.). This creates a race condition where webVideoCtrl.js will execute before jQuery is available, causing runtime errors.

jQuery should be loaded first, before any scripts that depend on it. Move the jQuery check and loading to lines 5-7, before the jsVideoPlugin and webVideoCtrl scripts.

Suggested change
await addScript('./_content/BootstrapBlazor.HikVision/jsVideoPlugin-1.0.0.min.js');
await addScript('./_content/BootstrapBlazor.HikVision/webVideoCtrl.js');
if (window.$ === void 0) {
await addScript('./_content/BootstrapBlazor.HikVision/jquery-1.7.1.min.js');
}
if (window.$ === void 0) {
await addScript('./_content/BootstrapBlazor.HikVision/jquery-1.7.1.min.js');
}
await addScript('./_content/BootstrapBlazor.HikVision/jsVideoPlugin-1.0.0.min.js');
await addScript('./_content/BootstrapBlazor.HikVision/webVideoCtrl.js');

Copilot uses AI. Check for mistakes.

const el = document.getElementById(id);
if (el === null) {
return;
Expand Down
Loading