Skip to content

Conversation

@braindeaf
Copy link
Contributor

It appears I missed a vital part of passing cookies from middleware, Rack::Utils unescapes cookies and they need to be re-escaped.

cookies: [{ domain: 'www.example.org', name: 'key', value: 'value' }]
cookies: [
{ domain: 'www.example.org', name: 'key', value: 'value' },
{ domain: 'www.example.org', name: 'escaped', value: '%26%3D%3D'}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like a reasonable test, however i'd suggest it would also be good to have a test that actually calls to Grover/Puppeteer with some encoded cookies, have the page render the contents then check the result contains the expected encoded values. Hopefully that way there will be less risk of future regressions. This would probably live in the processor_spec

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I shall make it so.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added that spec, but all it really does it prove that you can pass a cookies, escaped or not to Puppeteer, the real failure on this was not realising that the cookie parser had escaped it. My bad.

Copy link
Contributor

@abrom abrom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change looks good @braindeaf 👍

Note per my comments I've fixed up the cookie renderer app to decode the cookie properly which now breaks your spec. Good news though is that the spec (once fixed) will make sense!

# Changelog

## Unreleased
- None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add an entry here for your change. Likely

### Fixed
- [#70](https://github.com/Studiosity/grover/pull/70) Ensure cookies are escaped when passing cookies via middleware ([@braindeaf][])

braindeaf and others added 2 commits June 30, 2020 23:26
Co-authored-by: Andrew Bromwich <a.bromwich@gmail.com>
Copy link
Contributor

@abrom abrom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change looks great, thanks @braindeaf 👍

@abrom abrom merged commit 19738ad into Studiosity:main Jun 30, 2020
@abrom
Copy link
Contributor

abrom commented Jul 1, 2020

FYI this has been released in v0.12.3

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

Successfully merging this pull request may close these issues.

2 participants