-
Notifications
You must be signed in to change notification settings - Fork 4
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
Release 5.0.7 #510
Release 5.0.7 #510
Conversation
DIGG-397: Increse facet limit to max
DIGG-422 dataset page test
Digg 424 concept page test
Digg 426 specification page test
Digg 431 Webb Tools and support test
DIGG-471: Updating promos, teasers and result list to be more screen …
DIGG-467: loadOnlyPublicEntries
DIGG-473: Update node version to 22
DIGG-473: Update code formatting
DIGG-473: Update yarn version
DIGG-473: Update yarn.lock
DIGG-473: try setting correct yarn version globally
DIGG-463: Improving search implementation and caching organisation names
DIGG-473: Add skip flag for yarn version
Release 5.0.7 new
); | ||
const specfications = conformsToEntries.filter((s: any) => s); | ||
const extractHREF = (s: any) => { | ||
if (s.getResourceURI().startsWith("https://dataportal.se")) |
Check failure
Code scanning / CodeQL
Incomplete URL substring sanitization High
https://dataportal.se
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 3 months ago
To fix the problem, we need to ensure that the URL is properly sanitized by checking its host against a whitelist of allowed hosts. This involves parsing the URL to extract its host and then verifying if it matches any of the allowed hosts.
- Parse the URL to extract the host.
- Check if the host is in the list of allowed hosts.
- If the host is allowed, proceed with the existing logic; otherwise, handle the error appropriately.
We will need to import the url
module to parse the URL and define a list of allowed hosts.
-
Copy modified line R2 -
Copy modified lines R304-R306 -
Copy modified line R308
@@ -1,2 +1,3 @@ | ||
import useTranslation from "next-translate/useTranslation"; | ||
import { URL } from "url"; | ||
import { useRouter } from "next/router"; | ||
@@ -302,4 +303,7 @@ | ||
const extractHREF = (s: any) => { | ||
if (s.getResourceURI().startsWith("https://dataportal.se")) | ||
const parsedURL = new URL(s.getResourceURI()); | ||
const allowedHosts = ["dataportal.se"]; | ||
if (allowedHosts.includes(parsedURL.host)) { | ||
return s.getResourceURI(); | ||
} | ||
return `https://dataportal.se/externalspecification/${s.getResourceURI()}`; |
Pull Request Description
Please include a summary of the change and which issue is fixed or added.
Please also include relevant motivation and context.
List any dependencies that are required for this change.
Fixes #(issue)
Checklist