The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
fix: incomplete URL substring sanitization in linkedin-browser-extension. (#16586)
Abdullah.553efe0cee42
diff --git a/packages/twenty-apps/community/linkedin-browser-extension/browser-extension/src/entrypoints/popup/app.tsx b/packages/twenty-apps/community/linkedin-browser-extension/browser-extension/src/entrypoints/popup/app.tsxindex c1f0566adec..a4e59a1b6ea 100644--- a/packages/twenty-apps/community/linkedin-browser-extension/browser-extension/src/entrypoints/popup/app.tsx+++ b/packages/twenty-apps/community/linkedin-browser-extension/browser-extension/src/entrypoints/popup/app.tsx@@ -12,19 +12,28 @@ function App() {useEffect(() => {browser.tabs.query({ active: true, currentWindow: true }, function(tabs) {const currentTab = tabs[0];- if(currentTab.url?.includes('https://www.linkedin.com/in')) {- sendMessage('getPersonviaRelay').then(data => {- setValue({...data, type: 'person' })- })- }- if(currentTab.url?.includes('https://www.linkedin.com/company')) {- sendMessage('getCompanyviaRelay').then(data => {- setValue({...data, type: 'company'})- })+ if (!currentTab.url) {+ return;}- });+ let url = new URL(currentTab.url);++ const isLinkedinHost =+ url.protocol === 'https:' && url.hostname === 'www.linkedin.com';++ if (isLinkedinHost && url.pathname.startsWith('/in/')) {+ sendMessage('getPersonviaRelay').then((data) => {+ setValue({ ...data, type: 'person' });+ });+ }++ if (isLinkedinHost && url.pathname.startsWith('/company/')) {+ sendMessage('getCompanyviaRelay').then((data) => {+ setValue({ ...data, type: 'company' });+ });+ }+ });}, []);const isPersonValue = (val: Value): val is PersonValue => {@@ -38,25 +47,29 @@ function App() {return (<StyledMain><h1>{JSON.stringify(value)}</h1>- {- isPersonValue(value) &&- <button onClick={async () => {- await sendMessage('createPerson', {- firstName: value.firstName,- lastName: value.lastName,- });-- }}>save person to twenty</button>- }- {- isCompanyValue(value) &&- <button onClick={async () => {- await sendMessage('createCompany', {- name: value.companyName- });-- }}>save company to twenty</button>- }+ {isPersonValue(value) && (+ <button+ onClick={async () => {+ await sendMessage('createPerson', {+ firstName: value.firstName,+ lastName: value.lastName,+ });+ }}+ >+ save person to twenty+ </button>+ )}+ {isCompanyValue(value) && (+ <button+ onClick={async () => {+ await sendMessage('createCompany', {+ name: value.companyName,+ });+ }}+ >+ save company to twenty+ </button>+ )}</StyledMain>);}