Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
diaspora
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Milan
diaspora
Commits
4e9e7167
Commit
4e9e7167
authored
14 years ago
by
ilya
Browse files
Options
Downloads
Patches
Plain Diff
another attack vector spec
parent
8c92c313
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
spec/models/user/attack_vectors_spec.rb
+22
-0
22 additions, 0 deletions
spec/models/user/attack_vectors_spec.rb
with
22 additions
and
0 deletions
spec/models/user/attack_vectors_spec.rb
+
22
−
0
View file @
4e9e7167
...
...
@@ -8,6 +8,8 @@ describe User do
let
(
:user
)
{
Factory
(
:user
)
}
let
(
:aspect
)
{
user
.
aspect
(
:name
=>
'heroes'
)
}
let
(
:bad_user
)
{
Factory
(
:user
)}
let
(
:user2
)
{
Factory
(
:user
)
}
let
(
:aspect2
)
{
user2
.
aspect
(
:name
=>
'losers'
)
}
...
...
@@ -20,6 +22,26 @@ describe User do
friend_users
(
user
,
aspect
,
user3
,
aspect3
)
end
context
'non-friend valid user'
do
it
'raises if receives post by non-friend'
do
pending
"need to that posts come from friends.... requests need special treatment(because the person may not be in the db)"
post_from_non_friend
=
bad_user
.
build_post
(
:status_message
,
:message
=>
'hi'
)
xml
=
bad_user
.
salmon
(
post_from_non_friend
).
xml_for
(
user
.
person
)
post_from_non_friend
.
delete
bad_user
.
delete
post_count
=
Post
.
count
proc
{
user
.
receive_salmon
(
xml
)
}.
should
raise_error
/Not friends with that person/
user
.
raw_visible_posts
.
include?
(
post_from_non_friend
).
should
be
false
Post
.
count
.
should
==
post_count
end
end
context
'malicious friend attack vector'
do
it
'overwrites messages with a different user'
do
original_message
=
user2
.
post
:status_message
,
:message
=>
'store this!'
,
:to
=>
aspect2
.
id
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment