[Bug]: Data transfer quota not working as expected
NagaseYami opened this issue · comments
⚠️ 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
I noticed that the variable used to calculate data transfer in the code is int64, but the column used to store the used data transfer quota in the database is integer. This may cause the data transfer quota function to not work as expected.
sftpgo/internal/dataprovider/quotaupdater.go
Line 162 in cb3bc3f
sftpgo/internal/dataprovider/pgsql.go
Line 98 in cb3bc3f
I set a download quota of 8192MB for a test user, but the user was able to download more than 8GB of content. I downloaded about 10GB of test files, and the value of the used_download_data_transfer
column in the database is now 2145389068, which is close to the maximum value of the integer type.
Steps to reproduce
Just make a test user and set a download data transfer quota then download some test file.
Expected behavior
I'm not good at SQL but maybe bigint is batter?
SFTPGo version
2.5.6
Data provider
postgresql
Installation method
Community Docker image
Configuration
sftpgo:
image: "drakkan/sftpgo:plugins"
container_name: sftpgo
user: 0:0
depends_on:
postgres:
condition: service_healthy
ldap:
condition: service_healthy
environment:
# database
- SFTPGO_DATA_PROVIDER__DRIVER=postgresql
- SFTPGO_DATA_PROVIDER__NAME=sftpgo
- SFTPGO_DATA_PROVIDER__HOST=<my postgres ip>
- SFTPGO_DATA_PROVIDER__PORT=<my postgres port>
- SFTPGO_DATA_PROVIDER__USERNAME=***
- SFTPGO_DATA_PROVIDER__PASSWORD=***
# common
- SFTPGO_COMMON__UPLOAD_MODE=1
- SFTPGO_COMMON__SETSTAT_MODE=1
# ladp
- SFTPGO_PLUGINS__0__TYPE=auth
- SFTPGO_PLUGINS__0__AUTH_OPTIONS__SCOPE=5
- SFTPGO_PLUGINS__0__CMD=/usr/local/bin/sftpgo-plugin-auth
- SFTPGO_PLUGINS__0__ARGS=serve
- SFTPGO_PLUGINS__0__AUTO_MTLS=1
- SFTPGO_PLUGIN_AUTH_LDAP_URL=****
- SFTPGO_PLUGIN_AUTH_LDAP_BASE_DN=***
- SFTPGO_PLUGIN_AUTH_LDAP_BIND_DN=***
- SFTPGO_PLUGIN_AUTH_LDAP_PASSWORD=***
- SFTPGO_PLUGIN_AUTH_LDAP_SEARCH_QUERY=****
- SFTPGO_PLUGIN_AUTH_REQUIRE_GROUPS=****
- SFTPGO_PLUGIN_AUTH_PRIMARY_GROUP_PREFIX=***
- SFTPGO_PLUGIN_AUTH_SECONDARY_GROUP_PREFIX=***
- SFTPGO_PLUGIN_AUTH_USERS_BASE_DIR=***
- SFTPGO_PLUGIN_AUTH_CACHE_TIME=300
# sftp
- SFTPGO_SFTPD__BINDINGS__0__PORT=<my sftp port>
# webdav
- SFTPGO_WEBDAVD__BINDINGS__0__PORT=<my webdav port>
# http
- SFTPGO_HTTPD__BINDINGS__0__PORT=<my http port>
Relevant log output
No response
What are you using SFTPGo for?
Private user, home usecase (home backup/VPS)
Additional info
No response