Issue Summary
When using Google Chrome to add projects to a mirror that is hosted on a different domain, the project add fails with the error:
"Failed to add projects. Some projects could not be added. Please refresh the page and try again."
Steps to Reproduce
- Set up a Bitbucket Data Center instance hosted on mybitbucket.com
- Set up a smart mirror hosted on mybitbucketmirror.com, and register it with the above upstream Bitbucket instance
- Navigate to the mirror's configuration under Admin > Mirrors > Click mirror name
- Search for and then attempt to add a project to be synchronized to the mirror
Expected Results
The project is added without issue.
Actual Results
The following error is thrown:
"Failed to add projects. Some projects could not be added. Please refresh the page and try again."
Reviewing the call to https://mybitbucketmirror.com/rest/mirroring/latest/upstreamServers/<upstreamServerID>/settings/projects in the developer console shows the following payload returned alongside a 401 Unauthorized HTTP status code:
{ "errors": [ { "context": null, "message": "You are not permitted to access this resource", "exceptionName": "com.atlassian.bitbucket.AuthorisationException" } ] }
Lastly, in the JavaScript console the following warning can be found:
A cookie associated with a cross-site resource at https://mybitbucketmirrror.com/ was set without the `SameSite` attribute. It has been blocked, as Chrome now only delivers cookies with cross-site requests if they are set with `SameSite=None` and `Secure`. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5088147346030592 and https://www.chromestatus.com/feature/5633521622188032.
Workaround
Navigate to "chrome://flags/#same-site-by-default-cookies" (or chrome://flags/#schemeful-same-site) within Google Chrome and then set the behavior there to 'Disabled'. Then proceed to restart Google Chrome ("chrome://restart") and attempt to add a project to the mirror.
Other information on this error alongside suggested workaround steps can be found in this knowledge article.
- is related to
-
BBSDEV-22016 You do not have permission to view this issue
- mentioned in
-
Page Failed to load
-
Page Failed to load
-
Page Failed to load
-
Page Failed to load
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
Form Name |
---|
This issue was caused by browsers rejecting the BITBUCKETSESSIONID cookie, as in older versions of Bitbucket Data Center the SameSite attribute was not being added. Some browsers, Chrome 80+ for example, would see that the attribute was missing, and add a default value, which could sometimes lead to the browser then rejecting the cookie if the url of the mirror was different.
I have confirmed that as of Bitbucket Data Center 6.10.11, the SameSite attribute is being added to the cookie correctly. I have also confirmed that the issue does not occur over secure connections, which is the only way mirrors can be configured. The issue may be caused by a corrupted BITBUCKETSESSIONID cookie, so I would suggest clearing the cookies and upgrading to the latest bugfix version.