Commit Graph

93 Commits

Author SHA1 Message Date
GitLab Bot 02cf17adf0 Add latest changes from gitlab-org/gitlab@master 2023-11-23 09:10:00 +00:00
GitLab Bot 0b54f87a31 Add latest changes from gitlab-org/gitlab@master 2023-05-11 12:12:30 +00:00
GitLab Bot df9890e9a7 Add latest changes from gitlab-org/gitlab@master 2023-01-24 15:07:34 +00:00
GitLab Bot 3a25b40d55 Add latest changes from gitlab-org/gitlab@master 2022-11-28 15:09:27 +00:00
GitLab Bot 6078f74ce9 Add latest changes from gitlab-org/gitlab@master 2022-07-20 09:10:09 +00:00
GitLab Bot 0a8d7059a2 Add latest changes from gitlab-org/gitlab@master 2022-06-23 00:09:13 +00:00
GitLab Bot 7a124e225e Add latest changes from gitlab-org/gitlab@master 2022-06-14 12:08:53 +00:00
GitLab Bot 11df4bf91b Add latest changes from gitlab-org/gitlab@master 2022-05-11 18:07:55 +00:00
GitLab Bot 6a85a7c312 Add latest changes from gitlab-org/gitlab@master 2022-04-20 15:10:23 +00:00
GitLab Bot c4e79e91d7 Add latest changes from gitlab-org/gitlab@master 2022-04-11 00:08:30 +00:00
GitLab Bot 1a1473f447 Add latest changes from gitlab-org/gitlab@master 2022-02-04 06:15:28 +00:00
GitLab Bot ac99e71aa5 Add latest changes from gitlab-org/gitlab@master 2022-01-14 21:14:11 +00:00
GitLab Bot 70a50740a2 Add latest changes from gitlab-org/gitlab@master 2021-11-03 15:13:48 +00:00
GitLab Bot de8e5077c3 Add latest changes from gitlab-org/gitlab@master 2021-06-07 12:10:00 +00:00
GitLab Bot fc5e0c4d0d Add latest changes from gitlab-org/gitlab@master 2021-05-21 03:10:24 +00:00
GitLab Bot b89bcf56ec Add latest changes from gitlab-org/gitlab@master 2021-04-08 00:09:11 +00:00
GitLab Bot 9c918ae5c6 Add latest changes from gitlab-org/gitlab@master 2021-03-31 21:09:15 +00:00
GitLab Bot 3e1c760141 Add latest changes from gitlab-org/gitlab@master 2020-11-05 18:08:48 +00:00
GitLab Bot c59765a50a Add latest changes from gitlab-org/gitlab@master 2020-06-24 18:09:03 +00:00
GitLab Bot cd52759ee3 Add latest changes from gitlab-org/gitlab@master 2020-03-12 12:09:17 +00:00
GitLab Bot 22e9af3c8b Add latest changes from gitlab-org/gitlab@master 2020-01-27 12:08:35 +00:00
GitLab Bot 1caa60060b Add latest changes from gitlab-org/gitlab@master 2019-12-19 00:08:01 +00:00
GitLab Bot 5bd24a54ef Add latest changes from gitlab-org/gitlab@master 2019-12-17 09:07:48 +00:00
GitLab Bot 175b4fa261 Add latest changes from gitlab-org/gitlab@master 2019-12-11 18:08:10 +00:00
Thong Kuah a2cfc150ce Add # frozen_string_literal to spec/models
Adds `# frozen_string_literal: true` to spec/models ruby files
2019-04-01 14:37:54 +13:00
Rubén Dávila 7044a3a54a Validate SSH keys through the sshkey gem 2018-02-16 11:32:08 -05:00
Rubén Dávila 75fd832454 Revert "Merge branch 'rd-43185-revert-sanitize-extra-blank-spaces-used-when-uploading-a-ssh-key' into 'master'"
This reverts commit e607fd7966.
2018-02-15 09:50:19 -05:00
Rubén Dávila 740499bab5 Revert "Merge branch 'rd-40552-gitlab-should-check-if-keys-are-valid-before-saving' into 'master'"
This reverts commit a58f8c32c6, reversing
changes made to cd5d75c362.
2018-02-12 12:39:47 -05:00
Douwe Maan a58f8c32c6 Merge branch 'rd-40552-gitlab-should-check-if-keys-are-valid-before-saving' into 'master'
Sanitize extra blank spaces used when uploading a SSH key

Closes #40552

See merge request gitlab-org/gitlab-ce!16821
2018-02-02 19:18:12 +00:00
Mario de la Ossa eaada9d706 use Gitlab::UserSettings directly as a singleton instead of including/extending it 2018-02-02 18:39:55 +00:00
Rubén Dávila 972f564dcd Sanitize extra blank spaces used when uploading a SSH key 2018-02-01 17:00:16 -05:00
Yorick Peterse 3e561736b2
Cache the number of user SSH keys
By caching the number of personal SSH keys we reduce the number of
queries necessary on pages such as ProjectsController#show (which can
end up querying this data multiple times).

The cache is refreshed/flushed whenever an SSH key is added, removed, or
when a user is removed.
2017-11-16 14:59:38 +01:00
Nick Thomas eaa1ce4fbe
Ensure key fingerprints are generated correctly when modified 2017-10-03 18:45:01 +01:00
Yorick Peterse b3566a0104
Stop using Sidekiq for updating Key#last_used_at
This makes things simpler as no scheduling is involved. Further we
remove the need for running a SELECT + UPDATE just to get the key and
update it, whereas we only need an UPDATE when setting last_used_at
directly in a request.

The added service class takes care of updating Key#last_used_at without
using Sidekiq. Further it makes sure we only try to obtain a Redis lease
if we're confident that we actually need to do so, instead of always
obtaining it. We also make sure to _only_ update last_used_at instead of
also updating updated_at.

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/36663
2017-09-20 14:24:14 +02:00
haseeb cc2daa74d8 created services for keys 2017-09-15 15:35:24 +00:00
Nick Thomas 6847060266 Rework the permissions model for SSH key restrictions
`allowed_key_types` is removed and the `minimum_<type>_bits` fields are
renamed to `<tech>_key_restriction`. A special sentinel value (`-1`) signifies
that the key type is disabled.

This also feeds through to the UI - checkboxes per key type are out, inline
selection of "forbidden" and "allowed" (i.e., no restrictions) are in.

As with the previous model, unknown key types are disallowed, even if the
underlying ssh daemon happens to support them. The defaults have also been
changed from the lowest known bit size to "no restriction". So if someone
does happen to have a 768-bit RSA key, it will continue to work on upgrade, at
least until the administrator restricts them.
2017-08-30 20:50:44 +01:00
Nick Thomas b0f982fbdf Add settings for minimum key strength and allowed key type
This is an amalgamation of:

* Cory Hinshaw: Initial implementation !5552
* Rémy Coutable: Updates !9350
* Nick Thomas: Resolve conflicts and add ED25519 support !13712
2017-08-30 20:50:44 +01:00
Nick Thomas da5262f4e6 Backport changes in https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/2551 to CE 2017-08-07 19:17:11 +01:00
Rémy Coutable 29f1fa8250 Merge branch 'use-rspec-support-helper' into 'master'
Don't include EmailHelpers manually, pick with rspec

See merge request !13257
2017-08-03 16:42:02 +00:00
haseeb ae99f05b05 fix #35133 strip new lines from ssh keys 2017-08-03 16:39:10 +00:00
Lin Jen-Shin bb5f79d43e Don't include EmailHelpers manually, pick with rspec
`:mailer` is needed to pick it easily, while
`type: :mailer` is needed for picking it automatically for
tests located in spec/mailers/*_spec.rb

It's a bit complicated in spec/services/notification_service_spec.rb
but we'll leave it alone for now.
2017-08-03 21:55:48 +08:00
Rémy Coutable ddccd24c13 Remove superfluous lib: true, type: redis, service: true, models: true, services: true, no_db: true, api: true
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-07-27 14:31:53 +02:00
Grzegorz Bizon 0430b76441 Enable Style/DotPosition Rubocop 👮 2017-06-21 13:48:12 +00:00
Rémy Coutable 857d039145
Lint our factories creation in addition to their build
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-06-02 19:06:50 +02:00
Adam Niedzielski 8c41d5f5e1 Record used SSH keys only once per day
Use Gitlab::ExclusiveLease to make sure that we enqueue Sidekiq job
at most once per day for given key.
2017-01-20 11:42:46 +01:00
Vincent Wong b6df93a51f Record and show last used date of SSH Keys
Addresses: Issue #13810

1. Adds a last_used_at attribute to the Key table/model
2. Update a key's last_used_at whenever it gets used
3. Display how long ago an ssh key was last used
2017-01-09 04:15:39 +11:00
Filipa Lacerda eb839b9af5 Merge CSS 2016-12-12 17:52:06 +00:00
Lin Jen-Shin 5430122c56 Now we need to include EmailHelpers for each test 2016-12-06 21:34:49 +08:00
Rémy Coutable 4e249d5bae
Use :maximum instead of :within for length validators with a 0..N range
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-12-06 10:23:17 +01:00
Lin Jen-Shin 60fe975452 Merge remote-tracking branch 'upstream/master' into feature/1376-allow-write-access-deploy-keys
* upstream/master: (497 commits)
  Use single quote for strings
  Ue svg from SVGs object
  Dont trigger CI builds [ci skip]
  Revert "Test only migrations"
  Add custom copy for each empty stage
  Fetch only one revision
  Highlight nav item on hover
  Test only migrations
  Fix migration paths tests
  Scroll CA stage panel on mobile
  Fix CSS declaration
  administer to administrator
  Move SVGs to JS objects for easy reuse
  Improve deploy command message
  No enough data to Not enough data
  Keep the cookie name as before
  Fix variable usage
  Evalute time_ago method instead of printing it
  Removed button styling from restricted visibility levels and added checkboxes with icons
  Do not show overview message if there’s already CA data
  ...
2016-11-22 13:59:07 +08:00