Browse Source

Merge pull request #2713 from kfear1337/CodeQL-Report

Yifei Zhang 1 year ago
parent
commit
6d8416f838
2 changed files with 7 additions and 3 deletions
  1. 1 1
      app/components/sidebar.tsx
  2. 6 2
      app/utils/merge.ts

+ 1 - 1
app/components/sidebar.tsx

@@ -174,7 +174,7 @@ export function SideBar(props: { className?: string }) {
             </Link>
           </div>
           <div className={styles["sidebar-action"]}>
-            <a href={REPO_URL} target="_blank">
+            <a href={REPO_URL} target="_blank" rel="noopener noreferrer">
               <IconButton icon={<GithubIcon />} shadow />
             </a>
           </div>

+ 6 - 2
app/utils/merge.ts

@@ -1,9 +1,13 @@
 export function merge(target: any, source: any) {
   Object.keys(source).forEach(function (key) {
-    if (source[key] && typeof source[key] === "object") {
+    if (
+      source.hasOwnProperty(key) && // Check if the property is not inherited
+      source[key] &&
+      typeof source[key] === "object" || key === "__proto__" || key === "constructor"
+    ) {
       merge((target[key] = target[key] || {}), source[key]);
       return;
     }
     target[key] = source[key];
   });
-}
+}