Skip to content

Commit

Permalink
sanitize version param
Browse files Browse the repository at this point in the history
  • Loading branch information
JKarlavige committed Aug 2, 2024
1 parent c93cc51 commit cf889f6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion website/src/stores/VersionContext.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useState, useEffect, createContext } from "react"
import { versions } from '../../dbt-versions'
import sanitizeHtml from "sanitize-html";

const lastReleasedVersion = versions && versions.find(ver => ver.version && ver.version != "" && !ver.isPrerelease);

Expand All @@ -19,7 +20,10 @@ export const VersionContextProvider = ({ value = "", children }) => {
const storageVersion = window.localStorage.getItem('dbtVersion')
const { search } = window.location
const urlParams = new URLSearchParams(search);
const versionParam = urlParams.get('version')
const originalVersionParam = urlParams.get('version')

// Sanitize version param
const versionParam = sanitizeHtml(originalVersionParam);

if(versionParam && versions.find(ver => ver?.version && ver.version === versionParam)) {
{/*
Expand Down

0 comments on commit cf889f6

Please sign in to comment.