Commit graph

304 commits

Author SHA1 Message Date
rhymes
5e9be0c32d
Disable ActionController auto params wrapping (#11692)
* Disable ActionController auto params wrapping

Rails by default accepts wrapped and unwrapped parameters in JSON requests (with or without a root object), regardless of the fact that the contract with the client requests wrapped parameters or not. This results in unforeseeable bugs when the client sends unwrapped parameters in lieu of wrapped ones.

As undeterministic bugs are a PITA and this is the classic grey area in Rails apps and as the customer facing API is fully documented and the internal can be manually adjusted, we disable this and be done with this odd feature.

https://github.com/forem/forem/issues/11645
https://github.com/forem/forem/pull/11638

* Remove accidentally committed file
2020-12-02 15:17:43 +01:00
Michael Kohl
824e9a13cb
Add service generator (#11265)
* Add service generator

* Finalize service generator

* Add documentation

* Explicitly require rails/generators

* Update Zeitwerk initializer

* Remove explicit require

* Update docs/backend/service-objects.md

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
2020-11-10 09:09:35 +07:00
Molly Struve
6f34241c35
Refactor:Enable Datadog When DD_API_KEY is Present (#11278) 2020-11-05 10:50:32 -06:00
Molly Struve
a741dceace
Refactor:Implement Carrierwave Monkeypatch in all Envs (#11233)
* Refactor:Implement Carrierwave Monkeypatch for all Envs

* add a spec for monkey patch
2020-11-03 10:51:53 -06:00
Molly Struve
9cf92d1a9e
Refactor:Remove Unused BufferedArticles Controller (#11193) 2020-10-30 15:24:02 -05:00
Mac Siri
fb67f13573
Refactor CarrierWave configuration (#11006) 2020-10-21 16:47:52 -04:00
Peter Frank
92f6460ce7
[deploy] Remove "mac" from reserved words (#11003)
Special request for a Forem Admin who wants their first name
2020-10-21 15:35:54 -04:00
Ben Halpern
b0be814300
[deploy] Fix email sender and url issues (#10883)
* Fix email sender and url issues

* Add proper tests

* Add tests

* Change DeviseMailer approach

* ZFix devise test
2020-10-19 16:55:40 -04:00
Mac Siri
30fa3b79a3
Default to Imgproxy on Forem-cloud (#10819) 2020-10-14 12:54:59 -04:00
Mac Siri
01414a5120
Refactor carrierwave config (#10756)
* Refactor carrierwave config

* Remove development specific config

* Remove fog att

* Rearrange attempt #2
2020-10-13 14:15:27 -04:00
Mac Siri
e7c1b3e993
Move Imgproxy endpoint config to Images::Optimizer (#10742) 2020-10-09 10:50:30 -04:00
Mac Siri
5893998369
[Deploy] Update Carrierwave's asset_host for Forem cloud (#10488) 2020-10-07 14:17:54 -04:00
Mac Siri
95eaedc4a2
Add additional startup checks for imgproxy (#10681) 2020-10-06 16:18:52 -04:00
Hugo Peixoto
24e9f81f5a
Fix newlines being chomped in RSS import (#10476)
The CustomText converter was monkey patched to fix a bug related to
preserve_tags. Somewhere in that process, remove_inner_newlines was
changed to strip newlines completely, instead of replacing them with a
single space. This restores that functionality.

In development mode, files are not eager loaded. That means that the
converters were not being required, so it was not possible to reproduce
that issue in development mode (since it was falling back to the
original converter, which does not have the bug). This commit also adds
an initializer that requires every converter.
2020-09-29 10:38:36 -04:00
Mac Siri
8d9db4cce1
Update Imgproxy to use predetermined endpoint (#10412) 2020-09-28 18:30:29 -04:00
Fernando Valverde
5d110c6fe0
Fixes Omniauth redirect_uri when SiteConfig.app_domain is updated (#10432)
* Makes Omniauth rely on Proc instead of initializer value for redirect uri

* Adds SiteConfig.app_domain test for OAuth providers callback_url generation

* Fixes protocol mismatch in test

* Fixes URL encoding problem with query params in test
2020-09-24 11:57:51 -06:00
Molly Struve
1a88905465
Refactor:Remove BackupData Table from Postgres (#10422) 2020-09-24 10:09:20 +07:00
Fernando Valverde
779fad25b9
[deploy] Sets Omniauth full_host config to match the environment (#10419)
* Sets Omniauth full_host config to match the environment

* Fixes tests by passing missing params in omniauth env to mocks

* Default param as nil in omniauth mock helpers
2020-09-22 15:47:50 -06:00
Molly Struve
cc694146e6
Optimization:Move Initialization CacheBust to Background Worker (#10311)
* Optimization:Move Initilization CacheBust to Background Worker

* lower cache bust to 5 min and then bust shell version last

* moving back to 10 min after looking at recent deploy data
2020-09-18 11:30:47 -04:00
rhymes
19c8d219bc
[deploy] Hide column backup_data.json_data from Blazer via Hypershield (#10364) 2020-09-17 09:28:09 -05:00
Ben Halpern
3e09a7768f
[deploy] Remove need for ENV vars during asset precompile (#10349)
* Remove need for ENV vars during asset precompile

* Add open-search test
2020-09-16 13:57:05 -04:00
rhymes
b90bbdd87a
[deploy] Fix URL.domain in development by correctly loading authentication providers (#10296) 2020-09-13 16:49:18 -05:00
Ben Halpern
3a469a99e2
[deploy] Enable admin-configured app_domain (#10206)
* Move app_domain from env var to siteconfig *within app area*

* Fix SiteConfig

* Don't change URL.domain yet

* Not use in fastly cache purge yet

* Session store magoo

* Revert domain issue

* Add SetCookie middleware

* Temporarily remove cookie middleware and release tasks

* Re-enable SetCookieDomain

* Add some more comments, get it ready for testing

* Remove host from url options and temporarily show errors

* Allow forwarded host to be cookie

* Fix typo

* Change invalidAuthenticityToken

* Properly set app domain

* Proper Fastly cache

* Remove config.app_domain

* Remove config.app_domain

* Explicitely set remember_user_token

* More play with cookies

* Fiddle with remember_user_token

* Add remember_user_token changes

* Monkeypatch devise

* Sessions controller

* Include rememberable

* Include rememberable

* Proper cookie monkeypatch

* Proper cookie monkeypatch

* Proper cookie monkeypatch

* Remove extra cookie code

* User sign in tweak

* Close the loop

* Experiment with carrierwave public_url

* Finalize carrierwave monkeypatch

* Remove async controller specs

* Change some tests

* Update domain test

* Remove temporary production.rb change

* modify cookie logic

* Remove unneeded changes

* Remove unneeded changes

* Explicitely pass host

* Fix linting

* Fix social image test

* Add some cookie tests

* Modify article url

* Fix canonical urls

* Fix typo

* Remove sessions controller

* Remove devise monkeypatch

* Add monkeypatch

* Remove elsif

* Update spec/helpers/application_helper_spec.rb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Adjust remember_cookie_sync

* Remember user token experimentation

* Fiddle with devise

* Properly configure devise

* Fix typo

* Fix formatting issue

* Add comment about middleware

* Fix typo

Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>

* Remove commented-out code

Co-authored-by: Michael Kohl <citizen428@dev.to>
Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>
2020-09-11 09:38:34 -04:00
Ben Halpern
244195fc92
Move mailchimp API key to app logic (#10270) 2020-09-10 13:25:55 -04:00
Molly Struve
d6449cab26
[deploy] Bug Fix:Comment out content security policy (#10192) 2020-09-03 13:30:10 -05:00
rhymes
f49ca8909a
[deploy] Revert "Enable CSP in report only mode and use Honeybadger to track violations (#10155)" (#10191)
This reverts commit 1df3e96652.
2020-09-03 12:43:11 -05:00
rhymes
1df3e96652
[deploy] Enable CSP in report only mode and use Honeybadger to track violations (#10155) 2020-09-03 18:45:31 +02:00
Josh Puetz
f82ea80fcf
Attempt to fix facebook login (#10152) [deploy]
* Attempt to fix facebook login

* Use token parse in the setup lambda
2020-09-02 10:02:32 -05:00
Ben Halpern
0efcc7f47f
[deploy] Add initial content security policy into codebase (to avoid reliance on edge configuration) (#10144)
* Initial secure header functionality

* Add unsafe-inline to csp

* Secure cookies

* Add connect-src

* Only run secure header config in prod (for now)

* Change prod check to within default

* Change from secure_headers to rails config

* Wrap behind production check
2020-09-01 20:32:13 -04:00
Mac Siri
6771217e6c
Add cache-control to CarrierWave when using S3 (#10115) 2020-08-31 18:54:10 -04:00
Josh Puetz
d47d02f090
[deploy] Log in with Facebook (#9922)
* First draft of facebook auth

* Add Facebook welcome broadcast to seeds, data script

* Tests!

* Documentation

* Update docs with pictures

* User siteconfig/app config

* Adjust dropdown menu width to avoid wrap for Facebook button

* Add Facebook auth keys to SiteConfig properly

* Remove unnecessary VCR cassette

* Add omniauth facebook gem to vendor cache

* Use uid instead of email for nickname randomization

* Test fix, test for missing email in Facebook

* Update docs/backend/auth-facebook.md

Co-authored-by: Molly Struve <mollylbs@gmail.com>

* Typo fix!

* Don't default facebook auth settings to ApplicationConfig

Co-authored-by: Molly Struve <mollylbs@gmail.com>
2020-08-26 12:04:20 -04:00
Ben Halpern
bd6a996bce
[deploy] Remove AWS SDK and private endpoints completely (#9978)
* Initial work to remove aws_sdk

* More work

* Add tests

* Typos and cleanup

* Fixed typo and misc

* Fix test typos

* Update spec

* Remove functioncaller code

* Add comment to bump tests :)

* Fix spaminess calc
2020-08-26 10:30:31 -04:00
Mac Siri
b5be5990e4
[deploy] Expand Images::Optimizer to support imgproxy (#9909)
* Create _comment.html.erb spec

* Add imgproxy.rb

* Setup imgproxy MVP

* Expand Images::Optimizer to support imgproxy

* Enable imgproxy in dashboards/show WIP

* Create view spec

* Fix typo

* Also check for Imgproxy.config.endpoint

* Use ApplicationConfig instead of ENV

* Update Images::Optimizer#call
2020-08-25 16:00:40 -04:00
Ben Halpern
45fb6504dc
[deploy] Replace HEROKU_SLUG_COMMIT with custom footprint (naive) (#9904)
* Replace HEROKU_SLUG_COMMIT with custom footprint (naive)

* Fully set RELEASE_FOOTPRINT with the expectation of setting it before launch

* Change tests

* Fix cache
2020-08-25 13:47:14 -04:00
Molly Struve
ad2184ebf6
[deploy] Refactor:Change Unset Var Warnings to Debug Level (#9985) 2020-08-25 09:45:42 +02:00
Ben Halpern
682278ed75
[deploy] Change to same_site: lax for session store (#9967)
* Mess with ssl

* Add redirect false

* Remove redirect config

* Redirect back to false

* Mess with validrequest

* Add validrequest back in

* Secure sessions

* Add domain to session_store

* Fiddle with ssl options

* Fiddle with secure

* Same site lax

* Remove force_ssl

* Remove domain from session_store

* Add domain back

* Secure session cookie

* Set secure with var

* Revert default_url_options change

* Set session store to secure

* revert secure force

* Revert unintended change

* The cookie domain property should not be set on localhost

* Switch to no domain unless in production

Co-authored-by: rhymes <rhymes@hey.com>
2020-08-24 12:29:45 -04:00
rhymes
5f02c35ece
Fix Rubocop violations and merge Listing specs (#9963) 2020-08-24 12:04:29 +02:00
Ben Halpern
36ccfd55dd
[deploy] Add Twitter and GitHub keys to SiteConfig (#9899)
* Add Twitter and GitHub keys to SiteConfig

* Change docs

* Add notice about not taking affect right away
2020-08-20 15:58:15 -04:00
rhymes
ec4d373ea0
Move Stripe dev logger in the controller (#9887) 2020-08-20 09:38:54 -04:00
Ben Halpern
e76f6cbbba
Set Stripe dynamically instead of at boot (#9862)
* Set Stripe dynamically instead of at boot

* Add stripe SiteConfig

* Fix capitalization
2020-08-19 21:24:19 -04:00
rhymes
f5d35c6506
Rubocop: Enable and fix Style/StringConcatenation (#9844) 2020-08-18 14:50:15 +02:00
Molly Struve
d02a4cdc67
[deploy] Bug Fix:Increase look back time for Cron jobs to 120 seconds (#9797) 2020-08-17 11:11:52 -05:00
Molly Struve
05abf3839c
[deploy] Feature:Use Sidekiq to Run Scheduled Jobs (#9789) 2020-08-14 14:44:31 -05:00
Molly Struve
0a64ac067b
[deploy] Remove ENVied Gem, Use dotenv Take 2 (#9767) 2020-08-14 12:20:47 -05:00
rhymes
e727956640
Revert "[deploy] Refactor:Remove ENVied Gem, Use dotenv Instead for Test and Development (#9621)" (#9757)
This reverts commit 1be8c72206.
2020-08-12 13:28:38 -04:00
Molly Struve
1be8c72206
[deploy] Refactor:Remove ENVied Gem, Use dotenv Instead for Test and Development (#9621)
* Refactor:Remove ENVied Gem in Favor of Default application.yml

* Copy sample_application.yml for Travis

* Create .env_sample file, Warn of missing ENV variables, ignore .env file

* Use dotenv For ENV variables and create Rake Task to Populate

* Update docs to copy .env_sample file

* make application config a bit more resilient

* update more documentation and only initialize dotenv in dev and test

* Update doc code snippet types and refactor rake task and app config

* remove push defaults

* Make initializers more resilient, remove unused ENV from travis

* Exit new rake task if application.yml does not exist, include dotenv in docs
2020-08-12 11:01:38 -04:00
rhymes
cc8bfcb5c0
Enable Rubocop 0.89 cops and fix Lint/ violations (#9709)
* Enable new Lint/ cops and run rubocop -a

* Fixing last remaining things with rubocop -a

* Enable and fix Style/ExplicitBlockArgument and Style/GlobalStdStream

* Forgot parenthesis
2020-08-10 16:57:12 +02:00
Molly Struve
751e9ce596
[deploy] Optimization:Set Honeybadger send_data_at_exit to False (#9687) 2020-08-09 13:25:30 -05:00
Josh Puetz
1c566e0ec4
[deploy] Move /internal to `/admin (#9639)
* First draft - all the big changes

* Changing some more references to 'internal'

* Relocate internal request tests to admin

* Relocate internal system tests to admin

* Fix trailing space

* Test fix

* Move queries from internal to admin

* Docs updates

* Rename internal stimuls controllers to admin (plus docs)

* Rename admin layout

* Fix routing after rebase

* Fixes for latest added admin interfaces

* Serviceworker ignore paths
2020-08-07 10:36:26 -04:00
rhymes
77f04bdf7c
Hypershield: use per column table hide for specificity (#9651) 2020-08-07 11:27:43 +02:00