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
4ccd767a
Commit
4ccd767a
authored
Jun 19, 2015
by
Zeger-Jan van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only publish ssh key-type and key
parent
58c76605
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
7 deletions
+33
-7
CHANGELOG
CHANGELOG
+8
-5
app/models/key.rb
app/models/key.rb
+5
-0
app/models/user.rb
app/models/user.rb
+1
-1
spec/controllers/profile_keys_controller_spec.rb
spec/controllers/profile_keys_controller_spec.rb
+11
-0
spec/factories.rb
spec/factories.rb
+1
-1
spec/models/key_spec.rb
spec/models/key_spec.rb
+7
-0
No files found.
CHANGELOG
View file @
4ccd767a
...
@@ -29,6 +29,7 @@ v 7.14.0 (unreleased)
...
@@ -29,6 +29,7 @@ v 7.14.0 (unreleased)
- Disabled autocapitalize and autocorrect on login field (Daryl Chan)
- Disabled autocapitalize and autocorrect on login field (Daryl Chan)
- Mention group and project name in creation, update and deletion notices (Achilleas Pipinellis)
- Mention group and project name in creation, update and deletion notices (Achilleas Pipinellis)
- Remove redis-store TTL monkey patch
- Remove redis-store TTL monkey patch
- Remove comments and email addresses when publicly exposing ssh keys (Zeger-Jan van de Weg)
v 7.13.2
v 7.13.2
- Fix randomly failed spec
- Fix randomly failed spec
...
@@ -54,6 +55,8 @@ v 7.13.1
...
@@ -54,6 +55,8 @@ v 7.13.1
v 7.13.0
v 7.13.0
- Remove repository graph log to fix slow cache updates after push event (Stan Hu)
- Remove repository graph log to fix slow cache updates after push event (Stan Hu)
- Return comments in created order in merge request API (Stan Hu)
- Return comments in created order in merge request API (Stan Hu)
v 7.13.0 (unreleased)
- Only enable HSTS header for HTTPS and port 443 (Stan Hu)
- Only enable HSTS header for HTTPS and port 443 (Stan Hu)
- Fix user autocomplete for unauthenticated users accessing public projects (Stan Hu)
- Fix user autocomplete for unauthenticated users accessing public projects (Stan Hu)
- Fix redirection to home page URL for unauthorized users (Daniel Gerhardt)
- Fix redirection to home page URL for unauthorized users (Daniel Gerhardt)
...
...
app/models/key.rb
View file @
4ccd767a
...
@@ -39,6 +39,11 @@ class Key < ActiveRecord::Base
...
@@ -39,6 +39,11 @@ class Key < ActiveRecord::Base
self
.
key
=
key
.
strip
unless
key
.
blank?
self
.
key
=
key
.
strip
unless
key
.
blank?
end
end
def
publishable_key
#Removes anything beyond the keytype and key itself
self
.
key
.
split
[
0
..
1
].
join
(
' '
)
end
# projects that has this key
# projects that has this key
def
projects
def
projects
user
.
authorized_projects
user
.
authorized_projects
...
...
app/models/user.rb
View file @
4ccd767a
...
@@ -619,7 +619,7 @@ class User < ActiveRecord::Base
...
@@ -619,7 +619,7 @@ class User < ActiveRecord::Base
end
end
def
all_ssh_keys
def
all_ssh_keys
keys
.
map
(
&
:key
)
keys
.
map
(
&
:
publishable_
key
)
end
end
def
temp_oauth_email?
def
temp_oauth_email?
...
...
spec/controllers/profile_keys_controller_spec.rb
View file @
4ccd767a
...
@@ -48,6 +48,17 @@ describe Profiles::KeysController do
...
@@ -48,6 +48,17 @@ describe Profiles::KeysController do
expect
(
response
.
body
).
not_to
eq
(
""
)
expect
(
response
.
body
).
not_to
eq
(
""
)
expect
(
response
.
body
).
to
eq
(
user
.
all_ssh_keys
.
join
(
"
\n
"
))
expect
(
response
.
body
).
to
eq
(
user
.
all_ssh_keys
.
join
(
"
\n
"
))
# Unique part of key 1
expect
(
response
.
body
).
to
match
(
/PWx6WM4lhHNedGfBpPJNPpZ/
)
# Key 2
expect
(
response
.
body
).
to
match
(
/AQDmTillFzNTrrGgwaCKaSj/
)
end
it
"should not render the comment of the key"
do
get
:get_keys
,
username:
user
.
username
expect
(
response
.
body
).
not_to
match
(
/dummy@gitlab.com/
)
end
end
it
"should respond with text/plain content type"
do
it
"should respond with text/plain content type"
do
...
...
spec/factories.rb
View file @
4ccd767a
...
@@ -100,7 +100,7 @@ FactoryGirl.define do
...
@@ -100,7 +100,7 @@ FactoryGirl.define do
factory
:key
do
factory
:key
do
title
title
key
do
key
do
"ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0="
"ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0=
dummy@gitlab.com
"
end
end
factory
:deploy_key
,
class:
'DeployKey'
do
factory
:deploy_key
,
class:
'DeployKey'
do
...
...
spec/models/key_spec.rb
View file @
4ccd767a
...
@@ -32,6 +32,13 @@ describe Key do
...
@@ -32,6 +32,13 @@ describe Key do
describe
"Methods"
do
describe
"Methods"
do
it
{
is_expected
.
to
respond_to
:projects
}
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/
)
end
end
end
end
context
"validation of uniqueness"
do
context
"validation of uniqueness"
do
...
...
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