Commit Graph

19 Commits

Author SHA1 Message Date
Jacopo c6bddeacf4 Updates code using class_methods over module ClassMethods 2018-08-29 16:56:34 +02:00
gfyoung 15b878e27e Enable more frozen string in app/models/**/*.rb
Partially addresses #47424.
2018-08-07 00:37:36 -07:00
Lin Jen-Shin 45568bed36 Updates based on feedback 2017-11-22 00:59:38 +08:00
Lin Jen-Shin 9ae92b8caa Add cop to make sure we don't use ivar in a module 2017-09-18 21:23:45 +08:00
Sean McGivern 5883ce95ef `current_application_settings` belongs on `Gitlab::CurrentSettings`
The initializers including this were doing so at the top level, so every object
loaded after them had a `current_application_settings` method. However, if
someone had rack-attack enabled (which was loaded before these initializers), it
would try to load the API, and fail, because `Gitlab::CurrentSettings` didn't
have that method.

To fix this:

1. Don't include `Gitlab::CurrentSettings` at the top level. We do not need
   `Object.new.current_application_settings` to work.
2. Make `Gitlab::CurrentSettings` explicitly `extend self`, as we already use it
   like that in several places.
3. Change the initializers to use that new form.
2017-08-31 13:38:33 +01:00
Brian Neel 9770c57fab Re-enable SqlInjection and CommandInjection 2017-08-08 10:50:54 -04:00
Yorick Peterse 8fbbf41e29
Added Cop to blacklist the use of `dependent:`
This is allowed for existing instances so we don't end up 76 offenses
right away, but for new code one should _only_ use this if they _have_
to remove non database data. Even then it's usually better to do this in
a service class as this gives you more control over how to remove the
data (e.g. in bulk).
2017-07-06 12:01:36 +02:00
Oswaldo Ferreira 86ef67eee5 Present ajax call errors when failing to update an Issue 2017-03-21 14:20:15 -03:00
Oswaldo Ferreira 2ace39f242 Spam check and reCAPTCHA improvements 2017-02-21 13:32:49 -03:00
Z.J. van de Weg 5be8f03747 Improve performance of User Agent Detail 2017-02-20 16:28:13 +01:00
Jarka Kadlecova 3d2954e457 Use reCaptcha when an issue identified as spam 2017-02-07 12:56:20 +01:00
Sean McGivern c63194ce6f Check public snippets for spam
Apply the same spam checks to public snippets (either personal snippets
that are public, or public snippets on public projects) as to issues on
public projects.
2017-02-02 10:23:51 +00:00
Patricio Cano 7e6af85490 Also check if Akismet is enabled, before showing the `Submit as spam` button. 2016-08-22 21:36:04 -05:00
Patricio Cano 5994c11910 Further refactor and syntax fixes. 2016-08-15 17:20:57 -05:00
Patricio Cano 43e756d4ea Refactored AkismetHelper into AkismetService and cleaned up `Spammable`
- Refactored SpamCheckService into SpamService
2016-08-15 13:18:15 -05:00
Patricio Cano 96399a81cb Allow `Issue` to be submitted as spam
- Added controller actions as reusable concerns
- Added controller tests
2016-08-15 13:18:15 -05:00
Patricio Cano 64ab2b3d9f Refactored spam related code even further
- Removed unnecessary column from `SpamLog`
- Moved creation of SpamLogs out of its own service and into SpamCheckService
- Simplified code in SpamCheckService.
- Moved move spam related code into Spammable concern
2016-08-15 13:18:15 -05:00
Patricio Cano 722fc84e3d Complete refactor of the `Spammable` concern and tests:
- Merged `AkismetSubmittable` into `Spammable`
- Clean up `SpamCheckService`
- Added tests for `Spammable`
- Added submit (ham or spam) options to `AkismetHelper`
2016-08-15 13:18:15 -05:00
Patricio Cano f01fce7f46 Refactor spam validation to a concern that can be easily reused and improve legibility in `SpamCheckService` 2016-07-26 19:29:16 -05:00