Bug 53440

Summary: Allow access if security origin access is asked for is the same to the this
Product: WebKit Reporter: anton muhin <antonm>
Component: WebCore Misc.Assignee: anton muhin <antonm>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, commit-queue, sam
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
none
Patch none

Description anton muhin 2011-01-31 11:12:07 PST
Allow access if security origin access is asked for is the same to the this
Comment 1 anton muhin 2011-01-31 11:22:32 PST
Created attachment 80664 [details]
Patch
Comment 2 Adam Barth 2011-01-31 11:24:49 PST
Comment on attachment 80664 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=80664&action=review

> Source/WebCore/ChangeLog:5
> +        Allow access if security origin access is asked for is the same to the this

"is the same to the this"
=> "is the same as this" ?

> Source/WebCore/ChangeLog:8
> +        Covered by the existing tests.

How is this covered by existing tests if none of the tests changed as a result of this patch?
Comment 3 anton muhin 2011-01-31 11:29:01 PST
(In reply to comment #2)
> (From update of attachment 80664 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=80664&action=review
> 
> > Source/WebCore/ChangeLog:5
> > +        Allow access if security origin access is asked for is the same to the this
> 
> "is the same to the this"
> => "is the same as this" ?

Done.

> 
> > Source/WebCore/ChangeLog:8
> > +        Covered by the existing tests.
> 
> How is this covered by existing tests if none of the tests changed as a result of this patch?

I mean that nothing started to break with this change.  Does that make sense?  If not, may you suggest how I can reword this phrase?  And I am afraid it'd be pretty much difficult to write a test which will trigger this path right now.
Comment 4 Adam Barth 2011-01-31 11:33:39 PST
Yeah, I don't think it's possible to trigger that branch now.  We should just say that in the ChangeLog.

To give folks reading this bug more context, Anton and I have been discussing adding some defense-in-depth security checks at various points in the bindings.  Those points have SecurityOrigin objects, but not necessarily DOMWindow objects.  Currently, the "you can always access yourself" check is done by comparing DOMWindows.  Adding this branch here is redundant today, but won't be redundant in the future once we add these extra checks.
Comment 5 anton muhin 2011-01-31 12:15:17 PST
Created attachment 80669 [details]
Patch
Comment 6 anton muhin 2011-01-31 12:15:54 PST
Adam, may you have another look?

(In reply to comment #5)
> Created an attachment (id=80669) [details]
> Patch
Comment 7 Sam Weinig 2011-01-31 12:47:05 PST
(In reply to comment #4)
> Yeah, I don't think it's possible to trigger that branch now.  We should just say that in the ChangeLog.
> 
> To give folks reading this bug more context, Anton and I have been discussing adding some defense-in-depth security checks at various points in the bindings.  Those points have SecurityOrigin objects, but not necessarily DOMWindow objects.  Currently, the "you can always access yourself" check is done by comparing DOMWindows.  Adding this branch here is redundant today, but won't be redundant in the future once we add these extra checks.

Can we remove some of the DOMWindow comparing to themselves checks then?
Comment 8 Adam Barth 2011-01-31 14:02:02 PST
> Can we remove some of the DOMWindow comparing to themselves checks then?

That's a good idea.  We should be able to remove them after/in this patch.
Comment 9 anton muhin 2011-02-01 04:39:42 PST
Guys, if you're fine with this patch, may I ask you to r+ it?

(In reply to comment #8)
> > Can we remove some of the DOMWindow comparing to themselves checks then?
> 
> That's a good idea.  We should be able to remove them after/in this patch.
Comment 10 Adam Barth 2011-02-01 11:28:16 PST
Comment on attachment 80669 [details]
Patch

Sure.  I think a followup patch to remove the DOMWindow equality comparison might be worth doing too.
Comment 11 anton muhin 2011-02-01 11:34:35 PST
Comment on attachment 80669 [details]
Patch

Thanks a lot, Adam.  I'll try to do further cleanup with a separate patch.
Comment 12 WebKit Commit Bot 2011-02-01 12:27:13 PST
Comment on attachment 80669 [details]
Patch

Clearing flags on attachment: 80669

Committed r77272: <http://trac.webkit.org/changeset/77272>
Comment 13 WebKit Commit Bot 2011-02-01 12:27:20 PST
All reviewed patches have been landed.  Closing bug.