amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

A4A: Crypto operation unsuported

Open jridgewell opened this issue 9 years ago • 25 comments

Getting some 250 errors an hour matching:

The requested operation is unsupported

These are being generated by Chrome's crypto library when some algorithm is unsupported. These should be handled, or at least marked as expected errors.

jridgewell avatar Dec 14 '16 21:12 jridgewell

There's also never a stack trace, which made it a little hard to debug until I realized a "Error: cross-origin render mode header null" always happened afterwards.

jridgewell avatar Dec 14 '16 21:12 jridgewell

I will modify extensions/amp-a4a/0.1/crypto-verifier.js#verifySignature so that crossCrypto.verify has a catch allowing for easily exposing the error message to logging. This should help identify where/when this is occurring.

@jridgewell I assume you were unable to reproduce the error? If you were, can you provide specifics? Thanks

keithwrightbos avatar Dec 15 '16 15:12 keithwrightbos

Looking at the code, I believe we already handle this error (as indicated by the null header message indicating we are using xdomain rendering). I believe it could occur either during key import in which case the following logging occurs (all from within amp-a4a.js):

user().error(TAG, this.element.getAttribute('type'), 'error importing keys for service: ${jwkSet.serviceName}', err, this.element);

Or during verify:

user().error(TAG, this.element.getAttribute('type'), keyInfo.serviceName, err, this.element);

I was unable to locate instances of these in error logs (looked for "The requested operation is unsupported"). So it would appear that we are explicitly handling with the correct result although it would be good to know what causes this to occur.

keithwrightbos avatar Dec 15 '16 15:12 keithwrightbos

@jridgewell Could I get some newbie-level instructions on how to reproduce this? i.e. does this occur during unit tests, or when viewing article.amp.max.html, or...? Thanks!

jonkeller avatar Jan 12 '17 20:01 jonkeller

I remember getting the particular error was nearly impossible (I downloaded an old Chrome that didn't support pkcs). Essentially, anytime you call subtle.METHOD that returns a promise, you need to put a Promise#catch handler somewhere promise tree.

jridgewell avatar Jan 12 '17 20:01 jridgewell

Ping. These errors are annoying.

jridgewell avatar Feb 15 '17 23:02 jridgewell

I'm still seeing The requested operation is unsupported error in dev error log. I think it's possibly because of this,which should not be dev error. Also, dev().assert is striped from production code so I think it's better to use user().assert here and here

muxin avatar Mar 01 '17 22:03 muxin

Sorry, got pulled onto other things, but picking this back up this afternoon.

jonkeller avatar Mar 03 '17 16:03 jonkeller

Ping. This is still coming up.

jridgewell avatar Apr 24 '17 23:04 jridgewell

I did some initial investigation. Our StackDriver logs indicate that the errors are coming from Chrome 37. Caniuse.com and MDN indicate that this was the first version of Chrome to support Web Crypto, but I downloaded an old binary and checked, and it doesn't seem to. I have no idea what's going on there, but I wouldn't be surprised if it was related to the problem. At any rate, with my current Chrome binary (37.0.1986.0; the errors were coming from 37.0.0.0 but I couldn't find a binary for that version) I can't reproduce the error because the Web Crypto feature detection fails and so it won't try to use Fast Fetch. Anyone have any bright ideas about where to go from here?

taymonbeal avatar Apr 25 '17 17:04 taymonbeal

We just need to put catch blocks in the promise tree. When it hits, it fails A4A and goes through the normal 3p path.

jridgewell avatar Apr 25 '17 17:04 jridgewell

@keithwrightbos can this be prioritized? We'd want to get to solving any P1s within a week.

jasti avatar May 03 '17 22:05 jasti

I think PR #9040 is going to fix this.

taymonbeal avatar May 04 '17 00:05 taymonbeal

Looks like #9040 did indeed fix this. Can we close?

jonkeller avatar Jul 17 '17 15:07 jonkeller

#9040 has been abandoned, but if one of the PRs that it's been replaced with fixed the problem then we can close.

taymonbeal avatar Jul 17 '17 16:07 taymonbeal

I checked stackdriver and see 1 occurrence of the error in the past 2 days. Given that it used to be hundreds per hour, I'm willing to chalk it up to being fixed but one person had a stale version in cache or something. Justin?

On Mon, Jul 17, 2017 at 12:32 PM, Taymon A. Beal [email protected] wrote:

#9040 https://github.com/ampproject/amphtml/pull/9040 has been abandoned, but if one of the PRs that it's been replaced with fixed the problem then we can close.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/ampproject/amphtml/issues/6676#issuecomment-315803587, or mute the thread https://github.com/notifications/unsubscribe-auth/ACV2BxZStIhotPOMsCRwtW_QVNz5wvtdks5sO4yugaJpZM4LNa_v .

jonkeller avatar Jul 17 '17 17:07 jonkeller

There are 62k logged reports for latest prod (it's our top error).

jridgewell avatar Jul 17 '17 18:07 jridgewell

This is a high priority issue but it hasn't been updated in awhile. @keithwrightbos Do you have any updates?

ampprojectbot avatar Oct 20 '17 01:10 ampprojectbot

Seems to have been fixed.

jridgewell avatar Oct 20 '17 18:10 jridgewell

In our first success for POST error reports, this was unmasked. The GET requests chopped the stack from the report because of too many experiments hogging up the URL.

jridgewell avatar Nov 10 '17 21:11 jridgewell