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

sort sql injection vulnerability, add gem brakeman #1214

Closed
wants to merge 182 commits into from

Conversation

StlMaris123
Copy link

@StlMaris123 StlMaris123 commented Jan 21, 2020

Fixes #1189 (<=== Add issue number here)

  • This PR fixes sql injection vulnerability
  • Also adds Brakeman to help find more vulnerabilities
  • This was the reference used
    Make sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks!
  • PR is descriptively titled 📑 and links the original issue above 🔗
  • tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR -- or run tests locally with rake test
  • code is in uniquely-named feature branch and has no merge conflicts 📁
  • screenshots/GIFs are attached 📎 in case of UI updation
  • ask @publiclab/mapknitter-reviewers for help, in a comment below

We're happy to help you get this ready -- don't be afraid to ask for help, and don't be discouraged if your tests fail at first!

If tests do fail, click on the red X to learn why by reading the logs.

Please be sure you've reviewed our contribution guidelines at https://publiclab.org/contributing-to-public-lab-software

Thanks!

alaxalves and others added 20 commits July 30, 2019 09:46
* Add new system tests and fix minor asset loading

* modify test

* Add chromedriver to travis

* Add sudo

* Add dependencies to dockerfile

* Properly installing chrome and chromedriver
* WIP action cable setup

* basic action cable setup complete

* minor change

* minor changes

* few changes

* initial working functionality complete

* Refactoring code

* Adding Foreman gem

* Scheduling Puma and Passenger servers

* WIP action cable setup

* basic action cable setup complete

* minor change

* minor changes

* few changes

* initial working functionality complete

* Refactoring code

* Adding Foreman gem

* Scheduling Puma and Passenger servers

* few minor fix

* added a few tests

* Refactoring connection module

* Using strong params in requests

* added documentation

* added more docs

* added tests

* Using puma as dependency and correct image controller

* added a few tests

* a few changes

* remove unnecessary render

* few test fixes
* few bug fixes

* separate editing channels for different maps

* test fixes

* rubocop fixes
@welcome
Copy link

welcome bot commented Jan 21, 2020

Thanks for opening this pull request! Dangerbot will test out your code and reply in a bit with some pointers and requests.
There may be some errors, but don't worry! We're here to help! 👍🎉😄

@codeclimate
Copy link

codeclimate bot commented Jan 21, 2020

Code Climate has analyzed commit 8c1d634 and detected 0 issues on this pull request.

View more on Code Climate.

@codecov
Copy link

codecov bot commented Jan 21, 2020

Codecov Report

Merging #1214 into main will decrease coverage by 31.22%.
The diff coverage is 0%.

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #1214       +/-   ##
===========================================
- Coverage   73.28%   42.05%   -31.23%     
===========================================
  Files          40       40               
  Lines        1400     1574      +174     
===========================================
- Hits         1026      662      -364     
- Misses        374      912      +538
Impacted Files Coverage Δ
app/controllers/users_controller.rb 0% <0%> (-94.12%) ⬇️
app/mailers/comment_mailer.rb 0% <0%> (-100%) ⬇️
app/mailers/application_mailer.rb 0% <0%> (-100%) ⬇️
app/controllers/comments_controller.rb 0% <0%> (-100%) ⬇️
app/controllers/feeds_controller.rb 0% <0%> (-100%) ⬇️
app/controllers/utility_controller.rb 0% <0%> (-100%) ⬇️
app/controllers/export_controller.rb 0% <0%> (-90.91%) ⬇️
app/controllers/tags_controller.rb 0% <0%> (-89.66%) ⬇️
app/controllers/images_controller.rb 0% <0%> (-76.55%) ⬇️
... and 9 more

@@ -13,7 +13,7 @@ def index
@users = User.joins(:maps)
.select('users.*, count(users.id) as maps_count')
.group('maps.user_id')
.order(sort_column + ' ' + sort_direction)
.order(sort_column => sort_direction)
Copy link
Member

Choose a reason for hiding this comment

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

Ah, could we do sort_column: sort_direction here?

Then, let's rebase and this looks great! Thank you @StlMaris123 !!!

Gemfile Outdated
@@ -74,6 +74,7 @@ group :development, :test do
gem 'faker', '~> 2.6.0'
gem 'pry-rails', '~> 0.3.9'
gem 'action-cable-testing'
gem 'brakeman'
Copy link
Member

Choose a reason for hiding this comment

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

Looks great @StlMaris123
But I think brakeman is used only to detect vulnerabilities right?
So it should be better to add this to the development group if it isn't being used in production.

@StlMaris123
Copy link
Author

Rebase taking too long to complete, closing this pr and opening another one

@StlMaris123 StlMaris123 closed this Feb 3, 2020
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.

SQL Injection in "sort" parameter on /users/ page
7 participants