-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #202 from CleverTap/task/WEB-2516/XSS_bugfix
XSS bug fix
- Loading branch information
Showing
10 changed files
with
433 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,13 +11,13 @@ on: | |
types: [opened, synchronize, reopened] | ||
jobs: | ||
build: | ||
runs-on: macos-latest | ||
runs-on: macos-12 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use node.js version 10.x | ||
- name: Use node.js version 10.24.1 | ||
uses: actions/[email protected] | ||
with: | ||
node-version: '10.x' | ||
node-version: '10.24.1' | ||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,13 +4,13 @@ on: | |
types: [published] | ||
jobs: | ||
build: | ||
runs-on: macos-latest | ||
runs-on: macos-12 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use node.js version 10.x | ||
- name: Use node.js version 10.24.1 | ||
uses: actions/[email protected] | ||
with: | ||
node-version: '10.x' | ||
node-version: '10.24.1' | ||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
|
@@ -27,10 +27,10 @@ jobs: | |
run: yarn run test:coverage | ||
- name: Build package | ||
run: yarn run build | ||
- name: Use node.js version 10.x | ||
- name: Use node.js version 10.24.1 | ||
uses: actions/[email protected] | ||
with: | ||
node-version: '10.x' | ||
node-version: '10.24.1' | ||
registry-url: 'https://registry.npmjs.org' | ||
- name: Publish package to npm | ||
run: npm publish | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,13 +11,13 @@ on: | |
types: [opened, synchronize, reopened] | ||
jobs: | ||
build: | ||
runs-on: macos-latest | ||
runs-on: macos-12 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use node.js version 10.x | ||
- name: Use node.js version 10.24.1 | ||
uses: actions/[email protected] | ||
with: | ||
node-version: '10.x' | ||
node-version: '10.24.1' | ||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,13 +4,13 @@ on: | |
types: [published] | ||
jobs: | ||
build: | ||
runs-on: macos-latest | ||
runs-on: macos-12 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use node.js version 10.x | ||
- name: Use node.js version 10.24.1 | ||
uses: actions/[email protected] | ||
with: | ||
node-version: '10.x' | ||
node-version: '10.24.1' | ||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// clevertap-handler.js | ||
|
||
const ctEventhandler = (html) => { | ||
const ctScript = ` | ||
var clevertap = { | ||
event: { | ||
push: (eventName) => { | ||
window.parent.postMessage({ | ||
action: 'Event', | ||
value: eventName | ||
},'*'); | ||
} | ||
}, | ||
profile: { | ||
push: (eventName) => { | ||
window.parent.postMessage({ | ||
action: 'Profile', | ||
value: eventName | ||
},'*'); | ||
} | ||
}, | ||
onUserLogin: { | ||
push: (eventName) => { | ||
window.parent.postMessage({ | ||
action: 'OUL', | ||
value: eventName | ||
},'*'); | ||
} | ||
}, | ||
closeBoxPopUp: () => { | ||
window.parent.postMessage({ | ||
action: 'closeBoxPopUp', | ||
value: 'closeBoxPopUp' | ||
},'*'); | ||
}, | ||
closeBannerPopUp: () => { | ||
window.parent.postMessage({ | ||
action: 'closeBannerPopUp', | ||
value: 'closeBannerPopUp' | ||
},'*'); | ||
}, | ||
closeInterstitialPopUp: () => { | ||
window.parent.postMessage({ | ||
action: 'closeInterstitialPopUp', | ||
value: 'closeInterstitialPopUp' | ||
},'*'); | ||
} | ||
} | ||
` | ||
const insertPosition = html.indexOf('<script>') | ||
html = [html.slice(0, insertPosition + '<script>'.length), ctScript, html.slice(insertPosition + '<script>'.length)].join('') | ||
return html | ||
} | ||
|
||
export default ctEventhandler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.