-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
feature/migrate-to-bcrypt #237
base: master
Are you sure you want to change the base?
Conversation
LGTM. |
artifacts/db-reset.js
Outdated
dropDatabase() | ||
seedDatabase() |
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 think this might cause regression of the Cypress test flakiness that got fixed in #214. seedDatabase
isn't waiting for the async work queued by dropDatabase
to finish. If seedDatabase
manages to connect to the database faster than dropDatabase
, then the seed data would end up deleted or incomplete.
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.
Agreed, good catch! The previous setup was ignoring the rejection of collections that didn't and still resolving them.
I'll call dropDatabase()
within seedDatabse()
or wrap them asynchronously.
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.
@rcowsill It didn't go as smoothly as I wanted so I decided to revert the commit. It's probably best to keep the db-reset changes out of this PR.
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 previous setup was ignoring the rejection of collections that didn't and still resolving them.
Yes that was to avoid errors when running db-reset.js twice. The script doesn't seed the collections "contributions" or "errors", so they'd fail to delete on a second run. That isn't an issue if it's changed to drop the database, but I'm wondering if the script will fail when run on an empty MongoDB instance.
@rcowsill It didn't go as smoothly as I wanted so I decided to revert the commit. It's probably best to keep the db-reset changes out of this PR.
Yeah, that's a good idea 👍
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.
That isn't an issue if it's changed to drop the database, but I'm wondering if the script will fail when run on an empty MongoDB instance.
Right, that's what I noticed. It was always failing to run for the first time with the CI tests, though it ran fine manually in all cases (as the errors of dropping unknown collections weren't rejecting).
Anyways, we can always create another issue and work on it. 😄
This reverts commit 6e3458b.
@jantaylor Are there no changes to be applied to docker-compose? You could also add a check list item that purpleteam doesn't find any more or fewer bugs? NodeGoat is one of the main SUTs we use to hone purpleteam |
@binarymist Not to the docker-compose. Now that you mentioned that, I think there's a change required for the Dockerfile as alpine images of node usually don't have the required software installed for I'll try building it and see if it works otherwise, it'd need to have python installed or move to node:12.
I'm not sure I'm understanding the request. Did you want me to add a known issues list? |
Purpleteam was born out of this very file which is of course now redundant. We've been using NodeGoat since as a SUT. I was thinking you could just add a task to the existing task list in this PR to just run purpleteam over NodeGoat once this change is ready? For me, this just means updating my NodeGoat fork and redeploying it using purpleteam-iac-sut which was also created to deploy NodeGoat on AWS for free using Terraform, then running purpleteam over it. When I see your ready with this PR I can do the honors. |
@jantaylor happy to land the changes but want to run a check by you incase you had anything else you wanted to follow-up on. |
@lirantal It looks like most of the changes are with the |
Seems that it does: https://github.com/OWASP/NodeGoat/pull/237/files#diff-c08aab9e521b9749dbc6a23ffb3163a41871c1d89162017d8c9bb702dfc29d2eR56 If you think it's ready as-is, I'll go ahead and land it. |
@lirantal it looks like the conflicts need to be resoled. Want me to resolve them so we can get this PR merged? |
@jantaylor yes, thank you 🙏🏽 |
Context
Tasks
bcrypt-nodejs
inpackage.json
bcrypt
inpackage.json
app/data/user-dao.js
tobcrypt
readme.md
readme.md
test:ci
fails the first test due to thebefore()
which runscy.dbReset()
. If I comment it out, it passes, and then the next test suite fails it'sbefore()
which does thecy.dbReset()
.readme.md
with the extra relevant info (if needed)Additional changes:
repository
inpackage.json
app/routes/session.js
to async/await for bcrypt or plain text checkI ran
npm run precommit
and it returned a long list of formatting fixes and changed 36 files. I did not commit those changes as it would disrupt this PR and feature.