-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
Fixing multiple bugs in credential generation + refactoring #19653
Open
Mathiou04
wants to merge
12
commits into
rapid7:master
Choose a base branch
from
Mathiou04:fix_bugs_in_credentials_collection_enumerator_and_refacto
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+403
−261
Open
Changes from 1 commit
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
7cab903
CredentialCollection: adding various tests that currently fails to de…
Mathiou04 5d7d8cf
Fixes trivial bugs when combining additional_publics with user_as_pass
Mathiou04 397f466
Fixes the fact that no nil credential is generated for additional_pub…
Mathiou04 5fce8d2
Fix incorrect expectations of currently failing tests
Mathiou04 383dc0d
Re-implement the each_unfiltered_password_first method (used in case …
Mathiou04 e03f2e2
Inline all specs to avoid nesting context
Mathiou04 b2cc863
Reverts some test expectations
cgranleese-r7 2047671
Some final tidy up
cgranleese-r7 033dd2f
First refactoring pass in order to dry the code that iterates on pass…
Mathiou04 7612b31
Re-revert tests expectations
Mathiou04 66ce020
Merge branch 'master' into fix_bugs_in_credentials_collection_enumera…
Mathiou04 b08a5f6
Change how ldap_login generate its specific credentials for SCHANNEL …
Mathiou04 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 can easily see the potential for a refactoring here as many blocks are almost complete c/p of previous blocks.
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.
Hmm, just my opinion but after having another look at this I think refactoring these sections may actually reduce readability.
I find this code hard to read anyway due to all of the nuances required for each possible configuration of
password_spray
(not something that you have introduced, just the nature of password_spray's requirements itself).I may be misunderstanding what you had in mind though, so feel free to let me know if that's the case.
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 don't have a clear direction in mind, I just see potential because of the duplication of this big block:
It bothers me as if we have one slight modification of behaviour, we will have to modify the 3 (or 4, or 5?) of them.
A better target is not clear for me, but I had an idea that I didn't investigate yet: it would be to introduce two new classes, that would essentialy be iterator: one to iterate on usernames, and another one on passwords.
The code would then simply look something like this:
And the password spraying branch would simply look like this:
The main problem would be to handle the
user_as_pass
parameter in a clean way.(anyway, maybe we are good enough for now?)