Open
Description
- Gitea version (or commit ref): 1.11.4
- Git version: 2.26.1.windows.1
- Operating system: Win7x64
- Database (use
[x]
):- PostgreSQL
- MySQL
- MSSQL
- SQLite
- Can you reproduce the bug at https://try.gitea.io:
- Yes (provide example URL)
- No (no LFS support)
- Not relevant
- Log gist:
Description
Steps to reproduce:
- Create a new gitea instance or use an existing one
- Add an admin user to gitea with name
lfs_admin
and passwordLFS_admin1
and extract the attached scripts.zip to a convenient directory. - Modify the value of variable
GITEAHOST
in line 3 ofs01_admin.sh
(in attached zip) to match your gitea host name and save. - Run
./s01_admin.sh
in a git bash.
This creates two users (a_user
,b_user
) and givesa_user
a repoa_lfs_test
, to whichb_user
is added as collaborator withwrite
permission - Modify the value of variable
GITEAHOST
in line 4 ofs02_a_user.sh
(in attached zip) to match your gitea host and save. - Run
./s02_a_user.sh
in a git bash.
This initializes thea_lfs_test
repo in sub-foldera_repo
and puts all *.png files as lockable under LFS control. A fileimg.png
is created and initialized with the content ofwiki.png
. This file and.gitattributes
are staged, commited and pushed. Afterwards, theimg.png
file is locked bya_user
. - Modify the value of variable
GITEAHOST
in line 4 ofs03_b_user.sh
(in attached zip) to match your gitea host and save. - Run
./s03_b_user.sh
in a git bash (perhaps on a different machine, the result is the same).
This clones thea_lfs_test
repo into subfolderb_repo
and initializes LFS. Because.gitattributes
is checked out, LFS and locks are enabled for.png
files.img.png
is force overwritten by the contents ofdice.png
, staged, committed and pushed. - Observe the following output after running
./s03_b_user.sh
in the previous step:
$ ./s03_b_user.sh
Cloning into 'b_repo'...
[...]
'../dice.png' -> './img.png'
[...]
[master d78418b] img->dice
1 file changed, 2 insertions(+), 2 deletions(-)
Locking support detected on remote "origin". Consider enabling it with:
$ git config lfs.http://b_user:B_user1,@localhost:88/a_user/a_lfs_test.git/info/lfs.locksverify true
Unable to push locked files:(1/1), 48 KB | 0 B/s
* img.png - A_User (refs: master)
WARNING: The above files would have halted this push.
Uploading LFS objects: 100% (1/1), 48 KB | 0 B/s, done.
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 4 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 355 bytes | 355.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
remote: . Processing 1 references
remote: Processed 1 references in total
To http://localhost:88/a_user/a_lfs_test.git
2e229ad..d78418b master -> master
img.png A_User ID:2
- Although a message
Unable to push locked files:(1/1)
is returned, only a warningWARNING: The above files would have halted this push.
results and the push succeeds2e229ad..d78418b master -> master
even though the lock ofa_user
persists (git lfs locks
->img.png A_User ID:2
) - The result is also visible by opening
img.png
in the gitea UI: It shows the lock ofa_user
, but the content ofdice.png
pushed byb_user
.
Expected result:
The push by b_user
should be rejected (at least through a gitea configuration option), because a_user
still holds a lock on img.png
Actual Result:
The push succeeds and the locked file img.png
is modified by b_user
Requested change:
Please add a gitea configuration setting (either global or even better per repo) to reject such pushes on the server side, since otherwise locks are meaningless if the default client configuration is used. This leaves locks totally up to correct client configuration, which is error prone and negates the "protection" that locks should offer.
Thanks for gitea and for considering this request.