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

Memory session provider does not return private repositories in dashboard search #18070

Closed
jprjr opened this issue Dec 22, 2021 · 13 comments · Fixed by #18114
Closed

Memory session provider does not return private repositories in dashboard search #18070

jprjr opened this issue Dec 22, 2021 · 13 comments · Fixed by #18114
Labels
issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail type/bug
Milestone

Comments

@jprjr
Copy link

jprjr commented Dec 22, 2021

Gitea Version

1.15.8

Git Version

git version 2.30.1 (Apple Git-130)

Operating System

macOS 11.6

How are you running Gitea?

Running gitea with a pre-built download from the releases page (https://github.com/go-gitea/gitea/releases/tag/v1.15.8).

Running locally, ran the installer and selected a SQLite database and "local mode"

After installation, changed the session provider from "file" to "memory"

Database

SQLite

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

https://gist.github.com/jprjr/36ffebe2652bfc68ac4e24c67e2841e1

Description

When using the "memory" provider, the dashboard page's repository list (and search results) does not include private repositories created by the logged-in user.

Viewing the profile page does show them, it only seems to affect the search box on the dashboard page.

Screenshots

Here is a screenshot with the session provider on the default, "file":

image

And here is a screenshot with the session provider changed to "memory" - notice the private repo is not listed.

image

@Ma27
Copy link

Ma27 commented Dec 23, 2021

I can confirm that this is an issue and I only observed it since 1.15.8.

@techknowlogick
Copy link
Member

There was a user in discord who was also able to confirm this(mcraftdan). I suspect it is likely related to the security fix that went in for session regeneration, although I'd expect it to affect all session types rather than just in memory.

@zeripath
Copy link
Contributor

This is weird. The only thing it could possibly relate to is the regenerate session id stuff but I don't completely understand how.

@zeripath
Copy link
Contributor

I can't reproduce this on my testing server. Have you changed cookie settings? Is your ROOT_URL correct?

If you look in your browser console and watch as you login are the cookies being set correctly?

@rampd2
Copy link

rampd2 commented Dec 24, 2021

Yes, I've set GITEA__session__COOKIE_SECURE=true and GITEA__session__DOMAIN=sub.domain.tld (obviously replaced by correct subdomain, domain and top level domain). Also the GITEA__server__ROOT_URL is set to the same address just with https:// prefixed.

The last thing I can't test because I can currently only look into my configs (no server connection). :/

@zeripath
Copy link
Contributor

I don't think you need to set the DOMAIN it should just get the right thing automatically.

You definitely haven't set SAME_SITE?

What browser are you using?

@deanpcmad
Copy link

Also having the same issue. Version 1.15.7 works fine.

@jprjr
Copy link
Author

jprjr commented Dec 27, 2021

Did some testing, hopefully these steps can be used to reproduce the issue:

  • checked out source, ran TAGS="bindata sqlite sqlite_unlock_notify" make build
  • ran ./gitea, opened my web browser to http://localhost:3000
  • on the installation screen, changed the following settings:
    • database type: SQLite 3
  • clicked the install button
  • registered a new account
  • created two new repositories:
    • one with everything set to default
    • the other with "make private repository" checked
  • view the dashboard, observe both repos are listed
  • killed gitea process (ctrl+c)
  • edited custom/conf/app.ini, changed the session provider from file to memory
  • launch gitea again, login, check if both repositories are listed.

Here's what I observed with different versions. I checked out the code for each version to their own folder, meaning I re-ran the installer for each version. I tested these all with Firefox and Google Chrome, using my regular profile as well as private browsing / incognito. Tried with and without disabling cache, all the same. Also, using Linux in these tests.

  • version 1.15.7: both repositories listed.
  • version 1.15.8: only the public repository is listed.
  • release/1.15 branch (commit 353d88a): only the public repository is listed.
  • main branch (commit d2fac63): both repositories listed.

zeripath added a commit to zeripath/gitea that referenced this issue Dec 28, 2021
Since the regenerate session ID PR some users of the memory session provider have been
reporting difficulties with getting API results.

I am uncertain as to why this is happening - but I think that the sessioner being
created twice may be a potential cause for this. Therefore this PR attempts to move
this out to a common sessioner as it is in 1.16.

Fix go-gitea#18070

Signed-off-by: Andrew Thornton <[email protected]>
@zeripath
Copy link
Contributor

OK I've put up a PR that I think might possibly solve the problem but I still cannot reproduce this bug. However, I am only trying on linux so it's possible that the problem is some mac issue.

The Heisenbug nature does make think that this could indeed be due to some sort of race but it may be due to difference in the way that mac handles passing cookies.

If #18114 does not solve the problem - it would be helpful to review an app.ini that reproduces the problem. If you need to censor ensure that you censor things to the same thing - e.g. DOMAIN=<censored_domain, ROOT_URL=https://<censored_domain>/<censored_suburl> and the like.

@zeripath zeripath linked a pull request Dec 28, 2021 that will close this issue
@zeripath zeripath added this to the 1.15.9 milestone Dec 28, 2021
@zeripath zeripath added type/bug issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail labels Dec 28, 2021
zeripath added a commit that referenced this issue Dec 28, 2021
* Use common sessioner for API and web routes

Since the regenerate session ID PR some users of the memory session provider have been
reporting difficulties with getting API results.

I am uncertain as to why this is happening - but I think that the sessioner being
created twice may be a potential cause for this. Therefore this PR attempts to move
this out to a common sessioner as it is in 1.16.

Fix #18070

Signed-off-by: Andrew Thornton <[email protected]>

* Update routers/init.go
@6543 6543 modified the milestones: 1.15.9, 1.15.10 Dec 30, 2021
@6543
Copy link
Member

6543 commented Dec 30, 2021

@deanpcmad @jprjr can you please confirm the pull fixed it or if it still exist

@lunny
Copy link
Member

lunny commented Dec 31, 2021

@6543 They have confirmed in the PR #18114 (comment) . So let's close this one.

@lunny lunny closed this as completed Dec 31, 2021
@lunny lunny modified the milestones: 1.15.10, 1.15.9 Dec 31, 2021
@Ma27
Copy link

Ma27 commented Jan 2, 2022

I can also confirm that this issue is now resolved with 1.15.9, thanks!

@deanpcmad
Copy link

Can confirm it's fixed. Thanks :)

@go-gitea go-gitea locked and limited conversation to collaborators Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants