Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid character in header content errors, probably due to x-error #201

Closed
trieloff opened this issue Apr 7, 2021 · 8 comments
Closed
Assignees

Comments

@trieloff
Copy link
Contributor

trieloff commented Apr 7, 2021

We are seeing an increase of net new errors since April 5th, across many actions. The common thread is "Invalid character in header content", e.g.

  • from word2md: "message":"Invalid character in header content [\"<!DOCTYPE html><html xml:lang=\"en\" xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:Web=\"http://schemas.live.com/Web/\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/><title>Sharepoint Online</title><meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\"/><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"/></head><body><style>\n body,html {\n font: 18px/normal \"Segoe UI\",Arial,Helvetica,Sans-Serif;\n line-height: 23px;\n color: #333333;\n background: #F3F3F3 !important;\n }\n a {\n color: #3366BB;\n text-decoration: none;\n white-space: nowrap;\n }\n #sw_content {\n width: 760px;\n height: auto;\n margin: 0 auto;\n padding: 0;\n margin-bottom: 150px;\n background: #F3F3F3;\n }\n .panda { margin-top: 60px;}\n .panda img {\n width: 350px;\n height: 223px;\n }\n\n .title {\n font-size: 38px;\n line-height: 48px;\n color: #777777;\n text-align: center;\n margin-top: 30px;\n font-family: \"Segoe UI\",Arial,Helvetica,Sans-Serif;\n }\n .sc_errD {\n font-size: 13px;\n line-height: 16px;\n color: #777777;\n text-align: left;\n margin-top: 20px;\n white-space: nowrap\n }\n .sc_error {\n margin-top: 10px;\n padding: 0 20px;\n }\n .sc_error p{ margin: 18px 0px; }\n .bing_logo { margin-top: 25px; }\n .panda, .bing_logo, .sc_error{ text-align: center;}\n #b_header { display: none; }\n a:hover{text-decoration: underline;}\n\n @media(max-width: 736px){\n body{font-family: HelveticaNeue, Roboto, Arial, sans-serif;}\n .panda { margin-top: 60px;}\n .panda img {\n width: 225px;\n height: 143px;\n }\n .title {\n margin-top: 20px;\n font-family: HelveticaNeue, Roboto, Arial, sans-serif;;\n font-size: 23px;\n line-height: 28px;\n color: #333333;\n }\n .sc_errD, .sc_error p {\n font-size: 13px;\n line-height: 16px;\n }\n .sc_error { margin-top: 5px; }\n .sc_error p{ margin: 0px;}\n .bing_logo { margin-top: 20px; }\n #sw_content{ width: auto;}\n }\n</style><div id=\"sw_content\"><div class=\"panda\" data-tag=\"bing_panda\"><img src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAK4AAACuCAYAAACvDDbuAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAD8ZJREFUeNrsnd9uFEcWxs+AjWBD2DHsxmRBME4gCpY2GRtEVlokZnKVmwQj5X49b+B5ApsngDyBh3skz+aKXCx2JC4ARdhJtFEgJAyBxNib4IEAdmyCt05Tbdrt6arqv+6Z/n7SyAbP3+5vTp3z1alqIgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoAPIhX2C8fHxgvgxLG4nxa0hbucrlcoUDi1IrXCFaIf4h7jlXX+qCfFWcHhBXGwJIVqOshMtRMsMi7+fxeEFqYq4QpTjMj3QwYG3hsMMNlW4Qq95GWVLPh42IMQ7g0MNNiVVkEXYpE/RMpPisUUcapB4xJXCm/TIZ03giFsWkbeJQw489DVKLxypeiQRVxZh0yFEyxRligGAW19jUl9DfjSyxeBJxyN6jyVZ1AHA2mI93JaR1sZ4RO5SFGFnDZ0DP7BN9qUYDs7h1GVWsCpt1QJHXPnEkzGI1uasTD9A9kTL6cBthbbOByrOZJLMeUYh5s/QlMUabLJsCLYgU86SqoAXehjwHXEdzkHcoqXdu3fnP/zww8nV1dU8Tmtn83Rxaaxn9+5p0tuo5/08rzN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adattbDJ2Jbqo40zcnnHdqFRpwkFmfvW5etXe1/rLYtikoWZo9bXz6h2qoOQ6RzXle8Ok2LlwcqzFZr6fMp2GtZyWSmoUUehV0v6Or3y/buv1XumXVbnIuKGdBpI0ZDj2ki6sZYkVyoNKVQ7Ag+l4OPUsibazEZcR+TSXtn96LGjOc2QrryWWcwRN/arlEO46RUvX+W8qIjOadxDeFXm6QPttjoXqUJ0cLF2jhRWWVrfd1ZFy3RlXbVymK3KSJaXQ/BJ+bOQ0rddyZKDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAm/F+AAQA1GwLUNH600gAAAABJRU5ErkJggg==\"/></div><div class=\"title\">Something went wrong</div><div class=\"sc_error\"><p>This is a temporary issue, so try again in a few minutes.</p></div>\n<div class=\"sc_errD\" data-tag=\"refcode\"><p>Technical details:</><p>Ref A: 75D8FEABF1DD42C790B69603BB369A71 Ref B: BL2EDGE1417 Ref C: 2021-04-07T01:28:16Z</p></div><div class=\"bing_logo\"></div></div><!--AppServer--></body></html></body></html>\"]"
  • from dispatch: "message":"Invalid character in header content [\"[1] Error invoking pages_4.23.6/html@(adobe/theblog/master/ko/authors/어도비코리아.md): 502 \"]"
  • from content-proxy: "message":"Invalid character in header content [\"Invalid character in header content [\"Unable to fetch adobe/theblog/master/ko/authors/어도비코리아 (500) from word2md: unexpected response: no headers. is: { statusCode: 500 }\"]\"]"

I suggest we crop and sanitize the x-error header values before setting them.

@trieloff
Copy link
Contributor Author

trieloff commented Apr 7, 2021

Most likely thrown in

https://github.com/adobe/helix-fetch/blob/8545155125e604534ffa38ea1c779ffeeb94046f/src/fetch/headers.js#L49-L52

@trieloff trieloff self-assigned this Apr 7, 2021
@trieloff
Copy link
Contributor Author

trieloff commented Apr 7, 2021

It looks like the offending code is not in the adapter, but in the actual action code. I'd like to provide a small helper function that the actions can use and could think of two places to put it:

  1. into the context object provided by helix-deploy
  2. in helix-shared

(1) would have the advantage of being dependency free.
(2) would have the advantage of being the more common way of doing things

@tripodsan
Copy link
Contributor

tripodsan commented Apr 7, 2021

good idea: ``` context.sanitizeHeader(e) ```

@tripodsan
Copy link
Contributor

It looks like the offending code is not in the adapter, but in the actual action code. I'd like to provide a small helper function that the actions can use and could think of two places to put it:

  1. into the context object provided by helix-deploy
  2. in helix-shared

what about:

  1. in helix-fetch ?

@tripodsan
Copy link
Contributor

probably in https://github.com/adobe/helix-shared/blob/main/src/utils.js would be a good location.

@tripodsan
Copy link
Contributor

(1) would have the advantage of being dependency free.

ask @koraa about hidden dependency injection :-)

@stefan-guggisberg
Copy link
Contributor

what about:
3. in helix-fetch ?

-1, helix-fetch behaviour is spec compliant and in line with browser fetch and node-fetch.

@trieloff
Copy link
Contributor Author

trieloff commented Apr 7, 2021

value.replace(/[^\t\u0020-\u007E\u0080-\u00FF]/g, '').substr(0,1024)

I will add it as a private function in the wrapper and to helix-shared.

trieloff added a commit that referenced this issue Apr 7, 2021
trieloff added a commit to adobe/helix-shared that referenced this issue Apr 7, 2021
github-actions bot pushed a commit that referenced this issue Apr 7, 2021
## [3.18.1](v3.18.0...v3.18.1) (2021-04-07)

### Bug Fixes

* **template:** clean up x-error header value prior to sending response ([2e03414](2e03414)), closes [#201](#201)
adobe-bot pushed a commit to adobe/helix-shared that referenced this issue Apr 7, 2021
# [7.22.0](v7.21.14...v7.22.0) (2021-04-07)

### Features

* **utils:** add headercleanup helper function ([4d28f25](4d28f25)), closes [adobe/helix-deploy#201](adobe/helix-deploy#201)
trieloff added a commit to adobe/helix-dispatch that referenced this issue Apr 7, 2021
trieloff added a commit to adobe/helix-content-proxy that referenced this issue Apr 7, 2021
tripodsan pushed a commit to adobe/helix-content-proxy that referenced this issue Apr 8, 2021
trieloff pushed a commit to adobe/helix-dispatch that referenced this issue Apr 8, 2021
## [4.8.1](v4.8.0...v4.8.1) (2021-04-08)

### Bug Fixes

* clean up x-error values ([d2e3c04](d2e3c04)), closes [adobe/helix-deploy#201](adobe/helix-deploy#201)
trieloff pushed a commit to adobe/helix-content-proxy that referenced this issue Apr 8, 2021
## [2.12.4](v2.12.3...v2.12.4) (2021-04-08)

### Bug Fixes

* **utils:** ensure x-error header value is clean ([#363](#363)) ([30b6cd9](30b6cd9)), closes [adobe/helix-deploy#201](adobe/helix-deploy#201)
@trieloff trieloff closed this as completed Apr 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants