Skip to content

Commit

Permalink
Adjust sdk url where api url is relative
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle-ssg committed Dec 3, 2024
1 parent 73a02a6 commit bc8c3ef
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions frontend/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ const Constants = {
property: '',
value: '',
} as SegmentCondition,
defaultTagColor: '#3d4db6',
environmentPermissions: (perm: string) =>
`To manage this feature you need the <i>${perm}</i> permission for this environment.<br/>Please contact a member of this environment who has administrator privileges.`,
events: {
Expand Down Expand Up @@ -441,10 +442,16 @@ const Constants = {
'TRAITS_ID': 150,
},
},
getFlagsmithSDKUrl: () =>
Utils.isSaas() || Project.api.startsWith('https://api.flagsmith.com')

getFlagsmithSDKUrl: () => {
const apiUrl = Project.api.startsWith('/')
? `${document.location.origin}${Project.api}`
: Project.api

return Utils.isSaas() || apiUrl.startsWith('https://api.flagsmith.com')

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

'
https://api.flagsmith.com
' may be followed by an arbitrary host name.
? Project.flagsmithClientEdgeAPI
: Project.api,
: apiUrl
},
getUpgradeUrl: (feature?: string) => {
return Utils.isSaas()
? '/organisation-settings?tab=billing'
Expand All @@ -458,7 +465,6 @@ const Constants = {
},
isCustomFlagsmithUrl: () =>
Constants.getFlagsmithSDKUrl() !== 'https://edge.api.flagsmith.com/api/v1/',
defaultTagColor: '#3d4db6',
modals: {
'PAYMENT': 'Payment Modal',
},
Expand Down

0 comments on commit bc8c3ef

Please sign in to comment.