* Ensure valid git author names passed in signatures
Fix#5772 - Git author names are not allowed to include `\n` `<` or `>` and
must not be empty. Ensure that the name passed in a signature is valid.
* Account for pathologically named external users
LDAP and the like usernames are not checked in the same way that users who signup are.
Therefore just ensure that user names are also git safe and if totally pathological -
Set them to "user-$UID"
* Add Tests and adjust test users
Make our testcases a little more pathological so that we be sure that integration
tests have a chance to spot these cases.
Signed-off-by: Andrew Thornton <art27@cantab.net>
Updates documentation to account for the renamed ENABLE_SWAGGER_ENDPOINT from #3572 (commit a74426d631)
Signed-off-by: Peter Colberg <peter@colberg.org>
* Optimize pulls merging
By utilizing `git clone -s --no-checkout` rather than cloning the whole
repo.
* Use sparse-checkout to speedup pulls merge
* Use bytes.Buffer instead of strings.Builder for backward compatibility
* Fix empty diff-tree output for repos with only the initial commit
* Fix missing argument for the format string
* Rework diff-tree-list generation
* Remove logging code
* File list for sparse-checkout must be prefix with /
Otherwise, they would match all files with the same name under
subdirectories.
* Update onto the rebased head
* Use referecen repo to avoid fetching objects
* Pooled and buffered gzip implementation
* Add test for gzip
* Add integration test
* Ensure lfs check within transaction
The previous code made it possible for a race condition to occur whereby a LFSMetaObject could be checked into the database twice. We should check if the LFSMetaObject is within the database and insert it if not in one transaction.
* Try to avoid primary key problem in postgres
The integration tests are being affected by
https://github.com/go-testfixtures/testfixtures/issues/39 if we set the
primary key high enough, keep a count of this and remove at the end of
each test we shouldn't be affected by this.
* add util method and tests
* make sure the title of an issue cannot be empty
* wiki title cannot be empty
* pull request title cannot be empty
* update to make use of the new util methof
Unfortunately a scoping problem was missed on the previous PR which meant that the only nil error was logged on failure to connect to the db. This pr fixes this.
Unfortunately the last fix didn't completely fix the migration to v79 of the db
due to bug with schema locking during Sync2. This should fix this issue.
Fix#5759
Signed-off-by: Andrew Thornton <art27@cantab.net>
Fix#5765 by log the IP address of a connecting remote machine in case of a SSH connection error for the built-in ssh server.
Signed-off-by: Robert Sprunk <github@sprunk.me>
* api: Add an endpoint to list a particular member of team.
* models: Rename `GetUserTeams()` to `GetUserOrgTeams()` in `org_team` model.
`GetUserTeams()` sounds a bit misnomer since it actually returns
the teams that user belongs to in a given organization rather than
all the teams across all the organization that the user has joined.
* models: Add `GetUserTeams()`.
Returns all the teams that a user belongs to.
* api: Add an endpoint for GET '/user/teams'.
A GET request to this endpoint lists all the teams that a user
belongs to.