Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
4768afbd
Commit
4768afbd
authored
Aug 02, 2016
by
Keith Pope
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add simple identifier to public SSH keys
parent
e299504b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
4 deletions
+7
-4
CHANGELOG
CHANGELOG
+1
-0
app/models/key.rb
app/models/key.rb
+3
-2
spec/models/key_spec.rb
spec/models/key_spec.rb
+3
-2
No files found.
CHANGELOG
View file @
4768afbd
...
...
@@ -18,6 +18,7 @@ v 8.11.0 (unreleased)
- Fix renaming repository when name contains invalid chararacters under project settings
- Optimize checking if a user has read access to a list of issues !5370
- Nokogiri's various parsing methods are now instrumented
- Add simple identifier to public SSH keys (muteor)
- Add a way to send an email and create an issue based on private personal token. Find the email address from issues page. !3363
- Add build event color in HipChat messages (David Eisner)
- Make fork counter always clickable. !5463 (winniehell)
...
...
app/models/key.rb
View file @
4768afbd
...
...
@@ -26,8 +26,9 @@ class Key < ActiveRecord::Base
end
def
publishable_key
# Removes anything beyond the keytype and key itself
self
.
key
.
split
[
0
..
1
].
join
(
' '
)
# Strip out the keys comment so we don't leak email addresses
# Replace with simple ident of user_name (hostname)
self
.
key
.
split
[
0
..
1
].
push
(
"
#{
self
.
user_name
}
(
#{
Gitlab
.
config
.
gitlab
.
host
}
)"
).
join
(
' '
)
end
# projects that has this key
...
...
spec/models/key_spec.rb
View file @
4768afbd
...
...
@@ -16,12 +16,13 @@ describe Key, models: true do
end
describe
"Methods"
do
let
(
:user
)
{
create
(
:user
)
}
it
{
is_expected
.
to
respond_to
:projects
}
it
{
is_expected
.
to
respond_to
:publishable_key
}
describe
"#publishable_keys"
do
it
'
strips all personal information
'
do
expect
(
build
(
:key
).
publishable_key
).
not_to
match
(
/dummy@gitlab
/
)
it
'
replaces SSH key comment with simple identifier of username + hostname
'
do
expect
(
build
(
:key
,
user:
user
).
publishable_key
).
to
match
(
/
#{
Regexp
.
escape
(
user
.
name
)
}
\(localhost\)
/
)
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment