amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

Implement stricter sandboxing for amp-ad

Open jasti opened this issue 8 years ago • 14 comments

M66+ now has feature detection of the 'allow-top-navigation-by-user-activation' sandbox feature too.

jasti avatar Mar 26 '18 13:03 jasti

@jasti was the idea to add this constraint to all 3P ad frames? Or do we let pub/ad network opt-in?

@keithwrightbos is it something used by doubleclick in non-AMP world? I'm bit worried if this could cause false alarm if the creative implementation somehow delayed the navigation after a click.

lannka avatar Aug 03 '18 20:08 lannka

@lannka my idea was to make it the default across all 3P ad frames.

jasti avatar Aug 03 '18 22:08 jasti

in #13146 @coreybyrnes was also suggesting to set allow-scripts allow-popups to limit the top window navigation.

@keithwrightbos I want to learn what doubleclick does, and what's the risks of enabling it now.

lannka avatar Aug 03 '18 22:08 lannka

I want to learn what doubleclick does, and what's the risks of enabling it now.

@lusilva knows how doubleclick works, and has been doing sandboxing for a while. I can start a thread about it.

lubin2010 avatar Sep 07 '18 19:09 lubin2010

Do we expect this to get done in Q3?

cramforce avatar Sep 11 '18 16:09 cramforce

I decided to implement this in #18003 on my morning commute :)

But I will need help launching it by the core team.

cramforce avatar Sep 12 '18 14:09 cramforce

Super fast! Thanks @cramforce. Looking forward to the launch.

lubin2010 avatar Sep 12 '18 14:09 lubin2010

@keithwrightbos I saw that fast-fetch-3p-frame already has a sandbox implementation. What is the state on that experiment? Do we even ever use the case I changed and could run an experiment there?

My implementation feature detects the new sandbox APIs. You may want to consider porting that code over since the current code would prevent all navigation in e.g. iOS<11 or, I believe, Microsoft Edge, and possibly also Firefox (not sure about that one).

cramforce avatar Sep 13 '18 13:09 cramforce

In the current implementation, we have other feature detection methodologies to determine where sandboxing is available and apply it as such. I will create a PR that removes the FF 3p frame sandboxing code, uses yours, and augment getIframe to take a disable sandboxing parameter so that we can keep parity for now and start an experiment where we allow sandboxing for all AdSense/Doubleclick FF traffic. Thanks

keithwrightbos avatar Sep 13 '18 14:09 keithwrightbos

Thanks!

I did some research and at least for the navigation-on-load there should be an intervention in Chrome since 69 that prevents it by default. Safari, however, is still vulnerable to the attack.

cramforce avatar Sep 13 '18 14:09 cramforce

@keithwrightbos any updates from your experiment? If things look good, we will go forward for all 3P ad networks.

lannka avatar Oct 30 '18 17:10 lannka

Google Ad Manager experiment looks neutral. We should go ahead and turn it on.

lannka avatar Nov 09 '18 21:11 lannka

@ampproject/a4a

to protect user experience, we plan to leverage the stricter sandboxing features available on Chrome 66+ for amp-ad. According to Google Ad Manager's experiment, no noticeable revenue impact was seen.

We plan to turn on the feature on the week after Thanksgiving (12/4). Please let us know if you have any concerns.

/cc @jasti do you want to add anything?

lannka avatar Nov 09 '18 21:11 lannka

All good from my end.

jasti avatar Nov 16 '18 23:11 jasti