-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test authentication. #123
Test authentication. #123
Conversation
In a sense these tests are the two most important missing tests, because they're what give confidence that snare is only executing commands when the request is properly authenticated.
// Takes the example from [full_request], alters the client-side secret, and checks that this | ||
// causes snare not execute any commands (so, by proxy, we assume that authentication failed). | ||
|
||
let td = Builder::new().tempdir_in(env!("CARGO_TARGET_TMPDIR"))?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's lift the common setup into a function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The next PR will do just that :)
}} | ||
}}"# | ||
), | ||
move |_| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm struggling to find the bit where you check that it failed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We (indirectly, which is the best we can do) check that the action wasn't executed (i.e. the named temporary file wasn't created) in https://github.com/softdevteam/snare/pull/123/files#diff-e41c063cd26a1181211ca22e91577e32d5067e01cf8f6341954e708842bf5f07R296.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see.
In a sense these tests are the two most important missing tests, because they're what give confidence that snare is only executing commands when the request is properly authenticated.