diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 0fbb0d8a..de3a4017 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -2,6 +2,9 @@ name: Lint
on:
pull_request:
+permissions:
+ contents: read
+
jobs:
file-ref-check:
name: file-ref-check
diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml
index d89b19d2..e4f86a68 100644
--- a/.github/workflows/style.yml
+++ b/.github/workflows/style.yml
@@ -2,6 +2,9 @@ name: Vale
on:
pull_request:
+permissions:
+ contents: read
+
jobs:
vale:
name: runner / vale
diff --git a/common/src/components/flanksource/Navigation.jsx b/common/src/components/flanksource/Navigation.jsx
index f1c58f47..4edce1ea 100644
--- a/common/src/components/flanksource/Navigation.jsx
+++ b/common/src/components/flanksource/Navigation.jsx
@@ -3,6 +3,15 @@ import React, { useState, useRef } from 'react';
import { FaChevronDown, FaChevronUp, FaBars, FaTimes, FaBullseye, FaSearch, FaDatabase, FaExclamationTriangle, FaRocket, FaTools, FaLifeRing, FaSync, FaLightbulb, FaEye, FaRobot } from 'react-icons/fa';
import { SiPostgresql } from 'react-icons/si';
+const isGitHubUrl = (href) => {
+ try {
+ const url = new URL(href);
+ return url.protocol === 'https:' && url.hostname === 'github.com';
+ } catch {
+ return false;
+ }
+};
+
const Navigation = ({
logo = ,
loginButton = { href: "https://app.flanksource.com/", text: "Login" },
@@ -241,8 +250,8 @@ const Navigation = ({
key={index}
href={product.href}
className="flex items-start p-1 rounded-lg hover:bg-gray-50 transition-colors"
- target={product.href.includes('github.com') ? '_blank' : '_self'}
- rel={product.href.includes('github.com') ? 'noopener noreferrer' : ''}
+ target={isGitHubUrl(product.href) ? '_blank' : '_self'}
+ rel={isGitHubUrl(product.href) ? 'noopener noreferrer' : ''}
>