mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-13 07:46:10 +00:00
lint-security fixes
This commit is contained in:
parent
16193033b0
commit
34435e8272
@ -70,6 +70,7 @@ export const Autocomplete = ({
|
|||||||
break
|
break
|
||||||
case 'Enter':
|
case 'Enter':
|
||||||
if (filteredSuggestions.length > 0) {
|
if (filteredSuggestions.length > 0) {
|
||||||
|
// eslint-disable-next-line security/detect-object-injection
|
||||||
onSelected(filteredSuggestions[heighlightedSuggestion])
|
onSelected(filteredSuggestions[heighlightedSuggestion])
|
||||||
setHeighlightedSuggestion(0)
|
setHeighlightedSuggestion(0)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -196,6 +196,7 @@ export const Layer = ({
|
|||||||
} else {
|
} else {
|
||||||
if (window.location.pathname.split('/')[1]) {
|
if (window.location.pathname.split('/')[1]) {
|
||||||
const id = window.location.pathname.split('/')[1]
|
const id = window.location.pathname.split('/')[1]
|
||||||
|
// eslint-disable-next-line security/detect-object-injection
|
||||||
const ref = leafletRefs[id]
|
const ref = leafletRefs[id]
|
||||||
if (ref?.marker && ref.item.layer?.name === name) {
|
if (ref?.marker && ref.item.layer?.name === name) {
|
||||||
ref.marker &&
|
ref.marker &&
|
||||||
@ -261,20 +262,27 @@ export const Layer = ({
|
|||||||
)
|
)
|
||||||
.map((item: Item) => {
|
.map((item: Item) => {
|
||||||
if (getValue(item, itemLongitudeField) && getValue(item, itemLatitudeField)) {
|
if (getValue(item, itemLongitudeField) && getValue(item, itemLatitudeField)) {
|
||||||
|
// eslint-disable-next-line security/detect-object-injection
|
||||||
if (getValue(item, itemTextField)) item[itemTextField] = getValue(item, itemTextField)
|
if (getValue(item, itemTextField)) item[itemTextField] = getValue(item, itemTextField)
|
||||||
|
// eslint-disable-next-line security/detect-object-injection
|
||||||
else item[itemTextField] = ''
|
else item[itemTextField] = ''
|
||||||
|
|
||||||
if (item.tags) {
|
if (item.tags) {
|
||||||
|
// eslint-disable-next-line security/detect-object-injection
|
||||||
item[itemTextField] = item[itemTextField] + '\n\n'
|
item[itemTextField] = item[itemTextField] + '\n\n'
|
||||||
item.tags.map((tag) => {
|
item.tags.map((tag) => {
|
||||||
|
// eslint-disable-next-line security/detect-object-injection
|
||||||
if (!item[itemTextField].includes(`#${encodeTag(tag)}`)) {
|
if (!item[itemTextField].includes(`#${encodeTag(tag)}`)) {
|
||||||
|
// eslint-disable-next-line security/detect-object-injection
|
||||||
return (item[itemTextField] = item[itemTextField] + `#${encodeTag(tag)} `)
|
return (item[itemTextField] = item[itemTextField] + `#${encodeTag(tag)} `)
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line security/detect-object-injection
|
||||||
return item[itemTextField]
|
return item[itemTextField]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (allTagsLoaded && allItemsLoaded) {
|
if (allTagsLoaded && allItemsLoaded) {
|
||||||
|
// eslint-disable-next-line security/detect-object-injection
|
||||||
item[itemTextField].match(hashTagRegex)?.map((tag) => {
|
item[itemTextField].match(hashTagRegex)?.map((tag) => {
|
||||||
if (
|
if (
|
||||||
!tags.find(
|
!tags.find(
|
||||||
|
|||||||
@ -328,6 +328,7 @@ export const SearchControl = () => {
|
|||||||
|
|
||||||
function isGeoCoordinate(input) {
|
function isGeoCoordinate(input) {
|
||||||
const geokoordinatenRegex =
|
const geokoordinatenRegex =
|
||||||
|
// eslint-disable-next-line security/detect-unsafe-regex
|
||||||
/^[-+]?([1-8]?\d(\.\d+)?|90(\.0+)?),\s*[-+]?(180(\.0+)?|((1[0-7]\d)|([1-9]?\d))(\.\d+)?)$/
|
/^[-+]?([1-8]?\d(\.\d+)?|90(\.0+)?),\s*[-+]?(180(\.0+)?|((1[0-7]\d)|([1-9]?\d))(\.\d+)?)$/
|
||||||
return geokoordinatenRegex.test(input)
|
return geokoordinatenRegex.test(input)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -84,6 +84,7 @@ const SocialShareButton = ({
|
|||||||
url: string
|
url: string
|
||||||
title: string
|
title: string
|
||||||
}) => {
|
}) => {
|
||||||
|
// eslint-disable-next-line security/detect-object-injection
|
||||||
const config = platformConfigs[platform]
|
const config = platformConfigs[platform]
|
||||||
|
|
||||||
if (!config) {
|
if (!config) {
|
||||||
|
|||||||
@ -25,6 +25,7 @@ export const CircleLayout = ({
|
|||||||
const angle = startAngle + (i / itemCount) * (2 * Math.PI)
|
const angle = startAngle + (i / itemCount) * (2 * Math.PI)
|
||||||
const x = radius * Math.cos(angle)
|
const x = radius * Math.cos(angle)
|
||||||
const y = radius * Math.sin(angle)
|
const y = radius * Math.sin(angle)
|
||||||
|
// eslint-disable-next-line security/detect-object-injection
|
||||||
const child = container.children[i] as HTMLElement
|
const child = container.children[i] as HTMLElement
|
||||||
child.style.transform = `translate(${x}px, ${y}px)`
|
child.style.transform = `translate(${x}px, ${y}px)`
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@ export function getValue(obj, path) {
|
|||||||
const pathArray = path.split('.') // Use a different variable for the split path
|
const pathArray = path.split('.') // Use a different variable for the split path
|
||||||
for (let i = 0, len = pathArray.length; i < len; i++) {
|
for (let i = 0, len = pathArray.length; i < len; i++) {
|
||||||
if (!obj) return undefined // Check if obj is falsy at each step
|
if (!obj) return undefined // Check if obj is falsy at each step
|
||||||
|
// eslint-disable-next-line security/detect-object-injection
|
||||||
obj = obj[pathArray[i]] // Dive one level deeper
|
obj = obj[pathArray[i]] // Dive one level deeper
|
||||||
}
|
}
|
||||||
return obj // Return the final value
|
return obj // Return the final value
|
||||||
|
|||||||
@ -25,6 +25,7 @@ const createSvg = (shape: string, markerColor: string, borderColor: string) => {
|
|||||||
markerColor +
|
markerColor +
|
||||||
'" /><g opacity=".15" transform="matrix(1.0769 0 0 -1.0769 -272.731 48.23)"><path d="M276.75 42h-14.5L255 28.668 269.5 3 284 28.668zm-.595-1l6.701-12.323L269.5 5.033l-13.356 23.644L262.845 41z" fill="#231f20" /></g></svg>',
|
'" /><g opacity=".15" transform="matrix(1.0769 0 0 -1.0769 -272.731 48.23)"><path d="M276.75 42h-14.5L255 28.668 269.5 3 284 28.668zm-.595-1l6.701-12.323L269.5 5.033l-13.356 23.644L262.845 41z" fill="#231f20" /></g></svg>',
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line security/detect-object-injection
|
||||||
return svgMap[shape]
|
return svgMap[shape]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
export const urlRegex =
|
export const urlRegex =
|
||||||
// eslint-disable-next-line no-useless-escape
|
// eslint-disable-next-line no-useless-escape, security/detect-unsafe-regex
|
||||||
/(^| )(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,10}(:[0-9]{1,10})?(\/.*)?$/gm
|
/(^| )(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,10}(:[0-9]{1,10})?(\/.*)?$/gm
|
||||||
export const mailRegex = /(?<![[(])([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6})(?![\])])/gi
|
export const mailRegex = /(?<![[(])([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6})(?![\])])/gi
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user