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

[Bug]: 2nd login attempt with a prelogin hook shows local filesystem for virtual folders instead of original config. #1890

Open
2 tasks done
firatkucuk opened this issue Feb 10, 2025 · 0 comments · May be fixed by #1891
Open
2 tasks done
Labels
bug Something isn't working

Comments

@firatkucuk
Copy link

firatkucuk commented Feb 10, 2025

⚠️ This issue respects the following points: ⚠️

  • This is a bug, not a question or a configuration issue.
  • This issue is not already reported on Github (I've searched it).

Bug description

Our pre login webhook returns a user definition every single time. sftpgo maps this user with an existing user in its database. That part works fine apart from VirtualFolder fs config. In the second login it falls back to LocalFileSystem.

After debugging, I found a mapping is missing on validation here

Current state:

virtualFolders = append(virtualFolders, vfs.VirtualFolder{
	BaseVirtualFolder: vfs.BaseVirtualFolder{
		Name:     v.Name,
	},```

Fix:

```go
virtualFolders = append(virtualFolders, vfs.VirtualFolder{
	BaseVirtualFolder: vfs.BaseVirtualFolder{
		Name:     v.Name,
		FsConfig: v.FsConfig,
	},

Alternative solution user id should be persisted on webhook side and after every login the same userid should be sent.

Steps to reproduce

  1. Adjust a prelogin hook with virtul folder definitions apart from local.
  2. Connect
  3. Disconnect
  4. Connect again
  5. Virtual folder won't work because of missing FsConfig

Expected behavior

Virtual folders mapping should work.

SFTPGo version

2.6.5

Data provider

S3

Installation method

Community Docker image

Configuration

standard configuration

Relevant log output

What are you using SFTPGo for?

Medium business

Additional info

No response

@firatkucuk firatkucuk added the bug Something isn't working label Feb 10, 2025
@firatkucuk firatkucuk linked a pull request Feb 10, 2025 that will close this issue
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant