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

(Chrome) certain headers like Set-Cookie cannot be modified #46

Open
mrbeak opened this issue Jul 3, 2022 · 7 comments
Open

(Chrome) certain headers like Set-Cookie cannot be modified #46

mrbeak opened this issue Jul 3, 2022 · 7 comments

Comments

@mrbeak
Copy link

mrbeak commented Jul 3, 2022

Hello,

Environment

I'm Using Windows 10 and Chrome 103.x. I installed this extension from https://chrome.google.com/webstore/detail/man-in-the-middle/mfgcopdhimkemcnlhkohjbdjgahmagil

Problem

My Setup is like this here: https://imgur.com/a/XRauRIy

However only the outgoing request gets the addidional header, not the response.
Screenshot: https://imgur.com/a/DsUW1ng

Am I doing terribly wrong? is this due to a Change in Google Chrome that broke the extension? It looks like a bug to me :(

Help is appreciated

@mrbeak
Copy link
Author

mrbeak commented Jul 3, 2022

As a hint: I realized exactely the same problem with a simimal extension (pd4d10/tampery#17).

This makes me think Chrome does not allow modification of response Headers anymore, or at least not the way it was before.

@dangkyokhoang
Copy link
Owner

Devtools only shows the original response headers.

Modify response headers

@mrbeak
Copy link
Author

mrbeak commented Jul 4, 2022

Thanks a lot for your quick answer.

I could reproduce this and get the headers shown using your method with fetch in the console.

However when I try to add the following response header

Set-Cookie: foo=bar

it is neither shown in the console nor is the cookie being set

@dangkyokhoang
Copy link
Owner

The extension doesn't specify 'extraHeaders' in opt_extraInfoSpec so header rules might not be able to modify some headers. See https://developer.chrome.com/docs/extensions/reference/webRequest/ for information.

@mrbeak
Copy link
Author

mrbeak commented Jul 4, 2022

okay. Any reason why this is not added to the extraInfoSpec? Looks like just a simple flag to add and one gains a lot of extra power.

@dangkyokhoang
Copy link
Owner

The extension has not been in active development for a long time, especially the Chrome version. There will be updates, but not anytime soon.

@mrbeak mrbeak changed the title (Chrome) only requestheaders can be modified, no responseheaders (Chrome) certain headers like Set-Cookie cannot be modified Jul 7, 2022
@mrbeak
Copy link
Author

mrbeak commented Jul 7, 2022

Unfortunately I have no idea about browser extension development but I know about Javascript so I created this Pull Request: https://github.dev/mrbeak/man-in-the-middle/tree/extraHeaders

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

2 participants