Skip to content
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

Merged
merged 213 commits into from
Nov 21, 2024
Merged

Release 5.0.7 #510

merged 213 commits into from
Nov 21, 2024

Conversation

MickeA
Copy link
Collaborator

@MickeA MickeA commented Nov 21, 2024

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

  • Changes are limited to a single goal (avoid scope creep)
  • I confirm that I have read any Contribution and Development guidelines (CONTRIBUTING and DEVELOPMENT) and are following their suggestions.
  • I confirm that I wrote and/or have the right to submit the contents of my Pull Request, by agreeing to the Developer Certificate of Origin, (adding a 'sign-off' to my commits).

AlessandroGasperini and others added 30 commits June 4, 2024 09:32
DIGG-397: Increse facet limit to max
Digg 426 specification page test
Digg 431  Webb Tools and support test
MikaMunterud and others added 27 commits November 7, 2024 12:56
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: try setting correct yarn version globally
DIGG-463: Improving search implementation and caching organisation names
DIGG-473: Add skip flag for yarn version
);
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
' may be followed by an arbitrary host name.

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.

  1. Parse the URL to extract the host.
  2. Check if the host is in the list of allowed hosts.
  3. 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.

Suggested changeset 1
providers/EntrystoreProvider/index.tsx

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/providers/EntrystoreProvider/index.tsx b/providers/EntrystoreProvider/index.tsx
--- a/providers/EntrystoreProvider/index.tsx
+++ b/providers/EntrystoreProvider/index.tsx
@@ -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()}`;
EOF
@@ -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()}`;
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
@MickeA MickeA merged commit d65c5ad into main Nov 21, 2024
4 of 5 checks passed
@MickeA MickeA deleted the release-5.0.7 branch November 22, 2024 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants