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
Jérome Perrin
gitlab-ce
Commits
562d78a6
Commit
562d78a6
authored
Jul 12, 2015
by
Nikita Verkhovin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add error message for SSH key linebreaks
parent
dc6aa1d3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
1 deletion
+9
-1
CHANGELOG
CHANGELOG
+1
-0
app/models/key.rb
app/models/key.rb
+1
-0
spec/models/key_spec.rb
spec/models/key_spec.rb
+7
-1
No files found.
CHANGELOG
View file @
562d78a6
...
...
@@ -43,6 +43,7 @@ v 7.13.0 (unreleased)
- Redesign project page. Show README as default instead of activity. Move project activity to separate page
- Make left menu more hierarchical and less contextual by adding back item at top
- A fork can’t have a visibility level that is greater than the original project.
- Add error message for SSH key linebreaks
v 7.12.2
- Correctly show anonymous authorized applications under Profile > Applications.
...
...
app/models/key.rb
View file @
562d78a6
...
...
@@ -24,6 +24,7 @@ class Key < ActiveRecord::Base
validates
:title
,
presence:
true
,
length:
{
within:
0
..
255
}
validates
:key
,
presence:
true
,
length:
{
within:
0
..
5000
},
format:
{
with:
/\A(ssh|ecdsa)-.*\Z/
},
uniqueness:
true
validates
:key
,
format:
{
without:
/\n|\r/
,
message:
'should be a single line'
}
validates
:fingerprint
,
uniqueness:
true
,
presence:
{
message:
'cannot be generated'
}
delegate
:name
,
:email
,
to: :user
,
prefix:
true
...
...
spec/models/key_spec.rb
View file @
562d78a6
...
...
@@ -63,7 +63,7 @@ describe Key do
key
=
build
(
:key
)
# Not always the middle, but close enough
key
.
key
=
key
.
key
[
0
..
100
]
+
' '
+
key
.
key
[
10
0
..-
1
]
key
.
key
=
key
.
key
[
0
..
100
]
+
' '
+
key
.
key
[
10
1
..-
1
]
expect
(
key
).
not_to
be_valid
end
...
...
@@ -71,6 +71,12 @@ describe Key do
it
'rejects the unfingerprintable key (not a key)'
do
expect
(
build
(
:key
,
key:
'ssh-rsa an-invalid-key=='
)).
not_to
be_valid
end
it
'rejects the multiple line key'
do
key
=
build
(
:key
)
key
.
key
.
gsub!
(
' '
,
"
\n
"
)
expect
(
key
).
not_to
be_valid
end
end
context
'callbacks'
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