gitea/models
Gusted 623c93ff46
Increase Salt randomness (#18179)
- The current implementation of `RandomString` doesn't give you a most-possible unique randomness. It gives you 6*`length` instead of the possible 8*`length` bits(or as `length`x bytes) randomness. This is because `RandomString` is being limited to a max value of 63, this in order to represent the random byte as a letter/digit.
- The recommendation of pbkdf2 is to use 64+ bit salt, which the `RandomString` doesn't give with a length of 10, instead of increasing 10 to a higher number, this patch adds a new function called `RandomBytes` which does give you the guarentee of 8*`length` randomness and thus corresponding of `length`x bytes randomness.
- Use hexadecimal to store the bytes value in the database, as mentioned, it doesn't play nice in order to convert it to a string. This will always be a length of 32(with `length` being 16).
- When we detect on `Authenticate`(source: db) that a user has the old format of salt, re-hash the password such that the user will have it's password hashed with increased salt.

Thanks to @zeripath for working out the rouge edges from my first commit 😄.

Co-authored-by: lafriks <lauris@nix.lv>
Co-authored-by: zeripath <art27@cantab.net>
2022-01-04 15:13:52 +00:00
..
admin
appstate
asymkey Refactor auth package (#17962) 2022-01-02 21:12:35 +08:00
auth Refactor auth package (#17962) 2022-01-02 21:12:35 +08:00
avatars Make AvatarRenderedSizeFactor configurable and set it to 3 (#17951) 2021-12-16 10:18:38 +08:00
db Refactor auth package (#17962) 2022-01-02 21:12:35 +08:00
fixtures tests: add coverage for models migration helpers (#18162) 2022-01-03 23:35:01 +08:00
issues Simplify parameter types (#18006) 2021-12-20 04:41:31 +00:00
migrations Increase Salt randomness (#18179) 2022-01-04 15:13:52 +00:00
perm Move accessmode into models/perm (#17828) 2021-11-28 12:58:28 +01:00
repo Refactor auth package (#17962) 2022-01-02 21:12:35 +08:00
unit
unittest tests: s/GITEA_UNIT_TESTS_VERBOSE/GITEA_UNIT_TESTS_LOG_SQL/ (#18142) 2022-01-01 04:31:24 +01:00
user Increase Salt randomness (#18179) 2022-01-04 15:13:52 +00:00
webhook
access.go
access_test.go
action.go Prevent hang in git cat-file if repository is not a valid repository and other fixes (#17991) 2021-12-16 19:01:14 +00:00
action_list.go
action_test.go Some repository refactors (#17950) 2021-12-12 23:48:20 +08:00
branches.go
branches_test.go
commit.go
commit_status.go Add missing `X-Total-Count` and fix some related bugs (#17968) 2021-12-15 13:39:34 +08:00
commit_status_test.go
consistency.go
consistency_test.go
engine_test.go
error.go Some repository refactors (#17950) 2021-12-12 23:48:20 +08:00
fixture_generation.go
fixture_test.go
helper.go
helper_directory.go
helper_environment.go
issue.go Use conditions but not repo ids as query condition (#16839) 2021-12-29 21:02:12 +08:00
issue_assignees.go
issue_assignees_test.go
issue_comment.go Add API to get issue/pull comments and events (timeline) (#17403) 2022-01-01 22:12:25 +08:00
issue_comment_list.go
issue_comment_test.go
issue_dependency.go
issue_dependency_test.go
issue_label.go
issue_label_test.go
issue_list.go Use conditions but not repo ids as query condition (#16839) 2021-12-29 21:02:12 +08:00
issue_list_test.go
issue_lock.go
issue_milestone.go Simplify parameter types (#18006) 2021-12-20 04:41:31 +00:00
issue_milestone_test.go
issue_reaction.go Add missing `X-Total-Count` and fix some related bugs (#17968) 2021-12-15 13:39:34 +08:00
issue_reaction_test.go
issue_stopwatch.go
issue_stopwatch_test.go
issue_test.go Use conditions but not repo ids as query condition (#16839) 2021-12-29 21:02:12 +08:00
issue_tracked_time.go
issue_tracked_time_test.go
issue_user.go
issue_user_test.go
issue_watch.go Add missing `X-Total-Count` and fix some related bugs (#17968) 2021-12-15 13:39:34 +08:00
issue_watch_test.go
issue_xref.go
issue_xref_test.go
lfs.go Allow admin to associate missing LFS objects for repositories (#18143) 2022-01-01 17:05:31 +08:00
lfs_lock.go
main_test.go
migrate.go tests: add coverage for models migration helpers (#18162) 2022-01-03 23:35:01 +08:00
migrate_test.go tests: add coverage for models migration helpers (#18162) 2022-01-03 23:35:01 +08:00
notification.go Some repository refactors (#17950) 2021-12-12 23:48:20 +08:00
notification_test.go
org.go Some repository refactors (#17950) 2021-12-12 23:48:20 +08:00
org_team.go Prevent hang in git cat-file if repository is not a valid repository and other fixes (#17991) 2021-12-16 19:01:14 +00:00
org_team_test.go
org_test.go
project.go
project_board.go
project_issue.go
project_test.go
protected_tag.go
protected_tag_test.go
pull.go
pull_list.go Don't delete branch if other PRs with this branch are open (#18164) 2022-01-03 20:45:58 +01:00
pull_test.go Don't delete branch if other PRs with this branch are open (#18164) 2022-01-03 20:45:58 +01:00
release.go Some repository refactors (#17950) 2021-12-12 23:48:20 +08:00
repo.go Fix performance regression when user has many organization (#18125) 2021-12-30 13:03:40 +08:00
repo_activity.go
repo_collaboration.go Some repository refactors (#17950) 2021-12-12 23:48:20 +08:00
repo_collaboration_test.go
repo_generate.go Some repository refactors (#17950) 2021-12-12 23:48:20 +08:00
repo_generate_test.go
repo_list.go Use conditions but not repo ids as query condition (#16839) 2021-12-29 21:02:12 +08:00
repo_list_test.go
repo_permission.go Use conditions but not repo ids as query condition (#16839) 2021-12-29 21:02:12 +08:00
repo_permission_test.go
repo_test.go Some repository refactors (#17950) 2021-12-12 23:48:20 +08:00
repo_transfer.go Some repository refactors (#17950) 2021-12-12 23:48:20 +08:00
repo_transfer_test.go
review.go
review_test.go
statistic.go Refactor auth package (#17962) 2022-01-02 21:12:35 +08:00
task.go
token.go Refactor auth package (#17962) 2022-01-02 21:12:35 +08:00
token_test.go
upload.go
user.go Use conditions but not repo ids as query condition (#16839) 2021-12-29 21:02:12 +08:00
user_heatmap.go
user_heatmap_test.go
user_test.go Use conditions but not repo ids as query condition (#16839) 2021-12-29 21:02:12 +08:00
userlist.go
userlist_test.go