gitlab-username_bot_identifier 1.0 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/gitlab-username_bot_identifier.gemspec +25 -0
- data/lib/gitlab/username_bot_identifier.rb +18 -10
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ba564c178ecd9e50331631d14f87f4dac9358c69e553adf244e538cc85d9b5a
|
4
|
+
data.tar.gz: 8a8dfae7a2549d2fa51a5b5f6dc3e2d50829ac7ef444bfa1c318b44f0e543539
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: afdc1f881890a9c3d5b019fcd64b16d22a0709b4cabe79852ceff9d845133fb9e3db1586158c2543081503783e991cf016671d0619519b32db6cdaa78ee8c45b
|
7
|
+
data.tar.gz: 4f2841f5fafc9a7d6ed49075e9c7214dc34afe76250d97696d59ccf21975a90f7351ec7bdc0b20af51622053ac544720bdf7a89834ed3b44d3fde802c12da29c
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'lib/gitlab/username_bot_identifier/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'gitlab-username_bot_identifier'
|
7
|
+
spec.version = UsernameBotIdentifier::VERSION
|
8
|
+
spec.authors = ['Lee Tickett']
|
9
|
+
spec.email = ['ltickett@gitlab.com']
|
10
|
+
|
11
|
+
spec.summary = 'Parse GitLab usernames to determine whether they appear to be bots.'
|
12
|
+
spec.homepage = 'https://gitlab.com/gitlab-org/ruby/gems/gitlab-username_bot_identifier'
|
13
|
+
spec.license = 'MIT'
|
14
|
+
spec.required_ruby_version = '>= 2.6.0'
|
15
|
+
|
16
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
17
|
+
spec.metadata['source_code_uri'] = 'https://gitlab.com/gitlab-org/ruby/gems/gitlab-username-bot-identifier'
|
18
|
+
spec.metadata['changelog_uri'] = 'https://gitlab.com/gitlab-org/ruby/gems/gitlab-username-bot-identifier/-/blob/master/CHANGELOG.md'
|
19
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
20
|
+
|
21
|
+
spec.files = [
|
22
|
+
'gitlab-username_bot_identifier.gemspec',
|
23
|
+
'lib/gitlab/username_bot_identifier.rb'
|
24
|
+
]
|
25
|
+
end
|
@@ -4,22 +4,26 @@ module Gitlab
|
|
4
4
|
# Determines whether a GitLab username appears to be a bot based on known patterns
|
5
5
|
class UsernameBotIdentifier
|
6
6
|
KNOWN_GITLAB_COM_BOT_USERNAMES = %w[
|
7
|
+
codeowner-maintainer-or-manager
|
7
8
|
employment-bot
|
8
9
|
gitlab-bot
|
10
|
+
gitlab-crowdin-bot
|
9
11
|
gitlab-dependency-bot
|
10
12
|
gitlab-dependency-update-bot
|
11
13
|
gitlab-infra-mgmt-bot
|
12
14
|
gitlab-jh-bot
|
15
|
+
gitlab-llm-bot
|
13
16
|
gitlab-qa
|
14
17
|
gitlab-release-tools-bot
|
18
|
+
gitlab-security-bot
|
19
|
+
gitlabreviewerrecommenderbot
|
20
|
+
gl-infra-danger-bot
|
21
|
+
glrenovatebot
|
22
|
+
gl-support-bot
|
15
23
|
kubitus-bot
|
16
|
-
GitLabReviewerRecommenderBot
|
17
|
-
Taucher2003-Bot
|
18
24
|
mr-bot
|
19
25
|
ops-gitlab-net
|
20
|
-
|
21
|
-
codeowner-maintainer-or-manager
|
22
|
-
gitlab-crowdin-bot
|
26
|
+
taucher2003-bot
|
23
27
|
].freeze
|
24
28
|
|
25
29
|
# Automatically assigned to orphan records (e.g. when a user is deleted)
|
@@ -36,24 +40,28 @@ module Gitlab
|
|
36
40
|
@username = username
|
37
41
|
end
|
38
42
|
|
43
|
+
def username
|
44
|
+
@username.downcase
|
45
|
+
end
|
46
|
+
|
39
47
|
def known_bot?
|
40
|
-
KNOWN_GITLAB_COM_BOT_USERNAMES.include?(
|
48
|
+
KNOWN_GITLAB_COM_BOT_USERNAMES.include?(username)
|
41
49
|
end
|
42
50
|
|
43
51
|
def ghost?
|
44
|
-
|
52
|
+
username == GHOST_ACCOUNT
|
45
53
|
end
|
46
54
|
|
47
55
|
def service_account?
|
48
|
-
|
56
|
+
username.match?(SERVICE_ACCOUNT_REGEX)
|
49
57
|
end
|
50
58
|
|
51
59
|
def project_access_token?
|
52
|
-
|
60
|
+
username.match?(PROJECT_ACCESS_TOKEN_REGEX)
|
53
61
|
end
|
54
62
|
|
55
63
|
def group_access_token?
|
56
|
-
|
64
|
+
username.match?(GROUP_ACCESS_TOKEN_REGEX)
|
57
65
|
end
|
58
66
|
|
59
67
|
def project_or_group_access_token?
|
metadata
CHANGED
@@ -1,32 +1,33 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab-username_bot_identifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lee Tickett
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
13
|
+
description:
|
14
14
|
email:
|
15
15
|
- ltickett@gitlab.com
|
16
16
|
executables: []
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
+
- gitlab-username_bot_identifier.gemspec
|
20
21
|
- lib/gitlab/username_bot_identifier.rb
|
21
|
-
homepage: https://gitlab.com/gitlab-org/ruby/gems/gitlab-
|
22
|
+
homepage: https://gitlab.com/gitlab-org/ruby/gems/gitlab-username_bot_identifier
|
22
23
|
licenses:
|
23
24
|
- MIT
|
24
25
|
metadata:
|
25
|
-
homepage_uri: https://gitlab.com/gitlab-org/ruby/gems/gitlab-
|
26
|
+
homepage_uri: https://gitlab.com/gitlab-org/ruby/gems/gitlab-username_bot_identifier
|
26
27
|
source_code_uri: https://gitlab.com/gitlab-org/ruby/gems/gitlab-username-bot-identifier
|
27
28
|
changelog_uri: https://gitlab.com/gitlab-org/ruby/gems/gitlab-username-bot-identifier/-/blob/master/CHANGELOG.md
|
28
29
|
rubygems_mfa_required: 'true'
|
29
|
-
post_install_message:
|
30
|
+
post_install_message:
|
30
31
|
rdoc_options: []
|
31
32
|
require_paths:
|
32
33
|
- lib
|
@@ -41,8 +42,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
41
42
|
- !ruby/object:Gem::Version
|
42
43
|
version: '0'
|
43
44
|
requirements: []
|
44
|
-
rubygems_version: 3.
|
45
|
-
signing_key:
|
45
|
+
rubygems_version: 3.3.26
|
46
|
+
signing_key:
|
46
47
|
specification_version: 4
|
47
48
|
summary: Parse GitLab usernames to determine whether they appear to be bots.
|
48
49
|
test_files: []
|