mandatoryprogrammer / mandatoryprogrammer/CursedChrome

Errors with some services

Open
#78 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.7k
Forks
249
PR merge metrics
No merged PRs in 30d

Description

I have problems with some services - Google Photos, Google Drive (open a few directories down), Twitter and some others (I do not remember a full list).
It always says error is CORS, but I did a debug and the header seemed fine.
`Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at
https://drivefrontend-pa.clients6.google.com/v1/sharedDrives:list?key=.... (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 400`

Google answers with 400 Bad Request!!!, same error sometimes appear when cookies are broken but cookies are
synchronized and this error still appears.

While debugging I thought I found the issue in this part (letter case can be different and origin will be there twice):

```
details.requestHeaders = details.requestHeaders.filter(requestHeader => {
return !header_keys_to_delete.includes(requestHeader.name);
});

// Add appended headers
details.requestHeaders = details.requestHeaders.concat(
headers_to_append
);
```

Changed it to:
```
details.requestHeaders = details.requestHeaders.filter((requestHeader) => {
return !header_keys_to_delete.includes(requestHeader.name);
});
for (const header of headers_to_append) {
const headerIndex = details.requestHeaders.findIndex(
(h) => h.name.toLowerCase() === header.name.toLowerCase(),
);

if (headerIndex !== -1) {
details.requestHeaders[headerIndex].value = header.value;
} else {
details.requestHeaders.push(header);
}
}
```

But it changed nothing.
Hope someone has an idea what's the root cause of the issue.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Google Photos, Google Drive, and Twitter failures, then inspect the request-header filtering and appending code shown in the issue. Compare the resulting headers and responses, and consider the issue complete when the affected service requests no longer fail with the reported CORS or 400 errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.