Skip to content
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

Merged
merged 1 commit into from
Dec 19, 2023
Merged

Test authentication. #123

merged 1 commit into from
Dec 19, 2023

Conversation

ltratt
Copy link
Member

@ltratt ltratt commented Dec 18, 2023

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.

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"))?;
Copy link
Member

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?

Copy link
Member Author

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 |_| {
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see.

@vext01 vext01 added this pull request to the merge queue Dec 19, 2023
Merged via the queue into softdevteam:master with commit b76b22b Dec 19, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants