Something went wrong. Try again.
forked from charmbracelet/soft-serve
Something went wrong. Try again.
4.4 kB 139 lines
at master
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140# vi: set ft=conf
# Over SSH, a caller who cannot read a repository must get the same answer# for a private repository and for one that does not exist.
[windows] dos2unix notauthorizederr.txt invalidrepoerr.txt
# start soft serveexec soft serve &# wait for SSH server to startensureserverrunning SSH_PORT
# a private repo with contentsoft repo create secret -pgit clone ssh://localhost:$SSH_PORT/secret secretmkfile ./secret/README.md '# secret'git -C secret add -Agit -C secret commit -m 'first'git -C secret push origin HEAD
# anonymous key: user1 is not registered yet, so usoft/ugit are anonymous! usoft git-upload-pack secretcmp stderr notauthorizederr.txt! usoft git-upload-pack ghostcmp stderr notauthorizederr.txt! usoft git-upload-archive secretcmp stderr notauthorizederr.txt! usoft git-upload-archive ghostcmp stderr notauthorizederr.txt! usoft git-receive-pack secretcmp stderr notauthorizederr.txt! usoft git-receive-pack ghostcmp stderr notauthorizederr.txt! usoft git-lfs-authenticate secret downloadcmp stderr notauthorizederr.txt! usoft git-lfs-authenticate ghost downloadcmp stderr notauthorizederr.txt! usoft git-lfs-authenticate secret uploadcmp stderr notauthorizederr.txt! usoft git-lfs-authenticate ghost uploadcmp stderr notauthorizederr.txt! ugit clone ssh://localhost:$SSH_PORT/secret secret_anonstderr 'you are not authorized to do this'! ugit clone ssh://localhost:$SSH_PORT/ghost ghost_anonstderr 'you are not authorized to do this'
# the TUI opens the selector for both instead of refusing one of themuui '" q"' secretcp stdout tui-secret.txtgrep 'Repositories' tui-secret.txt! grep 'unauthorized' tui-secret.txt! stderr 'unauthorized'uui '" q"' ghostcp stdout tui-ghost.txtgrep 'Repositories' tui-ghost.txt! grep 'unauthorized' tui-ghost.txt! stderr 'unauthorized'
# registered user without accesssoft user create user1 --key "$USER1_AUTHORIZED_KEY"! usoft git-upload-pack secretcmp stderr invalidrepoerr.txt! usoft git-upload-pack ghostcmp stderr invalidrepoerr.txt! usoft git-upload-archive secretcmp stderr invalidrepoerr.txt! usoft git-upload-archive ghostcmp stderr invalidrepoerr.txt! usoft git-lfs-authenticate secret downloadcmp stderr invalidrepoerr.txt! usoft git-lfs-authenticate ghost downloadcmp stderr invalidrepoerr.txt! usoft git-lfs-authenticate secret uploadcmp stderr invalidrepoerr.txt! usoft git-lfs-authenticate ghost uploadcmp stderr invalidrepoerr.txt! ugit clone ssh://localhost:$SSH_PORT/secret secret_userstderr 'invalid repo'
# a push to a private repo the user cannot read is refused the same way,# while a push to a new name still creates it! usoft git-receive-pack secretcmp stderr invalidrepoerr.txtugit -C secret push ssh://localhost:$SSH_PORT/newname HEADusoft repo liststdout 'newname'! stdout 'ghost'
# a collaborator explicitly granted no access is treated like a strangersoft repo collab add secret user1 no-access! usoft git-upload-pack secretcmp stderr invalidrepoerr.txt! usoft git-upload-pack ghostcmp stderr invalidrepoerr.txt! usoft git-lfs-authenticate secret downloadcmp stderr invalidrepoerr.txt! usoft git-receive-pack secretcmp stderr invalidrepoerr.txtsoft repo collab remove secret user1
# a directory with no database row answers like any unreadable repositorymkdir $DATA_PATH/repos/orphan.git! usoft git-upload-pack orphancmp stderr invalidrepoerr.txt! usoft git-receive-pack orphancmp stderr invalidrepoerr.txt! usoft git-lfs-authenticate orphan downloadcmp stderr invalidrepoerr.txtsoft repo list! stdout 'orphan'
# the TUI still opens the selector for the registered useruui '" q"' secretcp stdout tui-secret2.txtgrep 'Repositories' tui-secret2.txt! grep 'unauthorized' tui-secret2.txtuui '" q"' ghostcp stdout tui-ghost2.txtgrep 'Repositories' tui-ghost2.txt! grep 'unauthorized' tui-ghost2.txt
# a reader is still told when they cannot writesoft repo collab add secret user1 read-onlyusoft git-lfs-authenticate secret downloadstdout '.*Bearer.*'! usoft git-lfs-authenticate secret uploadcmp stderr notauthorizederr.txt! usoft git-receive-pack secretcmp stderr notauthorizederr.txt
# stop the server; the last command must succeed so stderr is cleansoft repo list[windows] stopserver[windows] ! stderr .
-- notauthorizederr.txt --Error: you are not authorized to do this-- invalidrepoerr.txt --Error: invalid repo