Skip to content

Commit 8bc1c9d

Browse files
authored
Merge pull request #23 from gauthamsriman/remove-origin-check
Don't check for same origin on embedded frames
2 parents c8ff964 + 8c94732 commit 8bc1c9d

File tree

4 files changed

+27
-28
lines changed

4 files changed

+27
-28
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
Next Release
22
-------------
33

4+
* Remove frame origin check as it doesn't provide any added security value and makes
5+
integration more complicated for providing applications.
6+
47
1.5.1
58
------
69
* Added download attribute check for IE11 in unload trigger.

package-lock.json

Lines changed: 17 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/consumer/frame.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -198,15 +198,11 @@ class Frame extends EventEmitter {
198198
// 2. Identify the app the message came from.
199199
if (this.iframe.contentWindow !== event.source) return;
200200

201-
// 3. Verify that the origin of the app is trusted
202-
// For Chrome, the origin property is in the event.originalEvent object
203-
const origin = event.origin || event.originalEvent.origin;
204-
if (origin === this.origin) {
205-
logger.log('<< consumer', event.origin, event.data);
206-
207-
// 4. Send a response, if any, back to the app.
208-
this.JSONRPC.handle(event.data);
209-
}
201+
logger.log('<< consumer', event.origin, event.data);
202+
203+
// 3. Send a response, if any, back to the app.
204+
this.JSONRPC.handle(event.data);
205+
210206
}
211207

212208
/**

test/frame.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,15 @@ describe('Frame', () => {
134134
sinon.assert.notCalled(handle);
135135
});
136136

137-
it("ignores messages from different origins", () => {
137+
it("doesn't ignore messages from different origins", () => {
138138
const event = {
139139
data: {jsonrpc: '2.0'},
140140
source: frame.iframe.contentWindow,
141141
origin: 'invalid_origin'
142142
};
143143
frame.handleProviderMessage(event);
144144

145-
sinon.assert.notCalled(handle);
145+
sinon.assert.called(handle);
146146
});
147147

148148
it("calls this.JSONRPC.handle with the data of given event", () => {

0 commit comments

Comments
 (0)