Commit Graph

239 Commits

Author SHA1 Message Date
Neil Williams
a42ff99c52 vote: Stop dual-writing to postgres.
This is the final step in the saga of the pg vote rel destruction. We've
been dual-writing to PG and C* while gaining confidence in the pure-C*
model being able to survive full load.  This kills the pgvote databases
and moves forward in a pure-cassandra world for votes which should save
us considerable operational headaches.  After rolling this out, we can
not switch back without considerable effort.

When he reached the New World, Cortez burned his relational databases.
As a result his queue processors were well motivated.
2015-01-29 12:15:31 -08:00
Chad Birch
6b51528648 Subreddit.random_reddits(): fix logic error
The logic of this code contained a couple subtle errors that could cause
strange behavior. In reddit's current state of having two "automatic
subreddits" (which are always included in the front page set, and not
counted towards the limit), the fact that the automatic_ids list could
have an item removed while being iterated over meant that unsubscribing
from the first automatic subreddit (/r/blog) made it so that it was
effectively impossible to unsubscribe from the second one
(/r/announcements). If you unsubscribed, it would still be present in
your front page regardless, and if you stayed subscribed it would
actually be present twice.
2015-01-12 16:45:05 -07:00
Neil Williams
f95cb2b143 Rework login ratelimit system.
The goal of a login ratelimit system is to prevent brute force attacks
on passwords.

The current login ratelimit system is based on VDelay which uses
exponential backoff based on IP address after failed login attempts.
This is not ideal because of corporate proxies and LSN causing the
number of false positives to be very high resulting in users getting
the dreaded "you've been doing that too much".

This new system uses a factored out version of the core ratelimiting
system which uses fixed ratelimits per period (allowing some burstiness)
and is per-account. To help mitigate the effects of a denial of service
attack on a specific user, different ratelimit buckets are used
depending on whether or not the user has used the IP the login request
is coming from before.

As an escape hatch, successfully resetting an account's password adds
the current IP to that account's recent IPs allowing it into the safer
ratelimit bucket.

The ratelimit never applies if you are currently logged in as the user,
allowing account deletion to happen regardless of ongoing brute force /
denial of service attacks.
2015-01-05 14:06:46 -08:00
Neil Williams
c01ac9eb9c Revert "Ratelimits: add strict enforcement mode."
This reverts commit 6b73de5dd5758d7a6df07ad85668af21afb510f8.
2014-12-30 15:43:03 -08:00
Robert Ditthardt
5fc5823230 Relation: Stop dual writing keys. 2014-12-18 17:40:39 -08:00
Robert Ditthardt
a3c3b45836 Relation: Start dual-writing new key names.
This is the first part of cleansing rel key names of spaces.
2014-12-18 17:38:43 -08:00
Neil Williams
d24a8ebf1d media: Take advantage of HTTP & HTTPS media being on the same domain.
Since we have an HTTPS-capable CDN in front of our S3 static domains
now, it's far faster for clients to use the CDN on HTTPS as well rather
than going straight to (high-latency) S3.

This patch makes it so that we continue to store URLs with explicit HTTP
schemes but instead of conditionally converting to HTTPS, we render
protocol-relative URLs. This should be safe for systems using the
filesystem media provider as we've installed an SSL cert there all
along.
2014-12-01 12:03:44 -08:00
Neil Williams
155342f591 stylesheets: Remove dynamic stylesheet serving.
Since the introduction of the media providers and the default
installation of the filesystem media provider, it's no longer necessary
for local / non-AWS installs to use dynamically served stylesheets.

This patch removes that option to reduce complexity in the stylesheet
flows.
2014-12-01 12:03:44 -08:00
Jack Lawson
d5fedb0a4e Move stats collection sample rate to config
This way, we can update the rate in one place.
2014-11-24 10:18:44 -08:00
Jack Lawson
3aff785a95 Set GA sample rate through config
reddit uses Google Analytics[0] as a tool to track events on the reddit.com
website, which allows for gathering page load and user event data while
keeping users anonymized. However, with the high volume[1] of traffic
that reddit recieves, the data collection limit[2]-- even with a premium
account-- is often surpassed by a large volume.

Wikpedia states[3] "... sampling is concerned with the selection of a
subset of individuals from within a statistical population to estimate
characteristics of the whole population." We can, using this principle,
send a small portion of user events to Google Analytics collection
endpoints rather than sending the entire data set and achieve a
reasonable approximation of global user behavior without exceeding
reasonable data usage limits as defined by Google Analaytics.

In order to achieve this, the Google Analytics javascript library
provides a method to set a sampling rate[4], a percentage from 1-100.
By calling:

```
_gaq.push(['_setSampleRate', '80']);
```

One can set the sample rate to 80% of users. In reddit's case, I suggest
a default sampling rate of 50%. Here, I have added the `_setSampleRate`
properties to the `_gaq` object created within `utils.html`. It gets its
value from the config, which allows for easy value changes and avoids
using a 'magic value' set multiple places in the code.

[0] - https://www.reddit.com/help/privacypolicy#p_22
[1] - https://www.reddit.com/r/AskReddit/about/traffic
[2] - https://support.google.com/analytics/answer/1070983?hl=en
[3] - http://en.wikipedia.org/wiki/Sampling_(statistics)
[4] -
https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiBasicConfiguration#_gat.GA_Tracker_._setSampleRate
2014-11-24 10:18:19 -08:00
Neil Williams
890fc1f215 Ratelimits: add strict enforcement mode.
For some app pools that are selected based on the incoming request
source, such as whoalane, we may want to apply the ratelimit to ALL
kinds of requests to ensure that resources are being used fairly.  This
adds a strict enforcement mode which can be enabled in the config. Oauth
will continue to be enforced per-client ID but all other requests will
get the sitewide ratelimit.
2014-11-19 10:48:12 -08:00
Brian Simpson
884deaecfd Add pixel and click redirect server. 2014-10-28 01:22:37 -04:00
Neil Williams
b3d35f20d9 example.ini: Add some missing options and tweak documentation. 2014-10-07 13:24:16 -07:00
Neil Williams
84d6d0e9c2 example.ini: Move min karma stuff to thresholds section.
For consistency.
2014-10-07 13:24:16 -07:00
Brian Simpson
2a5fbc1482 Start generating new style impression and click hashes. 2014-10-07 16:21:47 -04:00
umbrae
5305984dff Remove search_auto_restrict_sr example flag 2014-10-03 13:12:50 -07:00
umbrae
ee5ea8ca3c Inbox_counts: corrections on deletes, spams, edits
Conflicts:

	r2/r2/controllers/listingcontroller.py
2014-10-03 11:46:48 -07:00
Jack Lawson
7cadb91b35 Revert "Revert "Send 1% of RUM tracking calls to hivemind""
This reverts commit d5131233e3ea6ba3d55189ccc196f14deabdc2f5.
2014-09-24 14:51:02 -07:00
umbrae
03a2784178 Add retina-ready thumbnails 2014-09-17 15:57:10 -07:00
Chad Birch
3b83d236c5 Gilding: track "proxy gildings" in secret column 2014-09-18 14:11:46 -06:00
Jack Lawson
7ebc48f5ea Log browser performance data to statsd. 2014-09-16 18:55:20 -04:00
Jordan Milne
ebdf16bade Add a feature flag to disable HSTS grants by default
HSTS is great, but a pain when you have HTTP-only services running
on your dev machine
2014-09-05 14:10:58 -07:00
Jordan Milne
25a890d8ed Replace disable_require_employee_https with a feature flag 2014-09-05 14:10:52 -07:00
Jordan Milne
6a51465e5e Put the 'security' tab behind a feature flag 2014-09-05 14:09:35 -07:00
Jordan Milne
9e20cc125a Allow forcing HTTPS upon employees 2014-09-05 14:08:35 -07:00
Jordan Milne
b70556a3ab Add support for forced HTTPS with HSTS grants
Right now we only give HSTS grants when the user is on g.domain
so we can easily revoke the grant. We also track changes to the
forced HTTPS pref accross sessions and modify the user's session
cookies as needed.
2014-09-05 14:08:25 -07:00
Brian Simpson
74c1166e86 Don't use a special cpm for country level targeting. 2014-08-15 10:56:48 -04:00
Chad Birch
8d3cbcbc0f Add flooring when displaying user karma totals
A floor of 1 total link karma already existed, this adds a floor to
comment karma as well. It also starts applying them everywhere,
including in the subreddit-specific karma breakdown.

In addition, admins are now exempt from the flooring and can see the
actual karma totals for users in all locations.
2014-08-08 15:52:22 -06:00
umbrae
027504a28e Improvements to opengraph meta tags 2014-08-06 15:22:44 -07:00
Brian Simpson
54a710b89e Add cpm_selfserve_collection. 2014-08-05 13:22:14 -04:00
Brian Simpson
7415823260 Get defaults from LocalizedDefaultSubreddits instead of top_lang_srs. 2014-07-29 11:09:03 -04:00
umbrae
c172391bbd Small feature: auto-restrict subreddit searches (flagged) 2014-07-17 13:04:04 -07:00
umbrae
c47c697293 Add optional controversial indicator to comment scores
Conflicts:

	r2/r2/lib/pages/pages.py
2014-07-17 13:01:58 -07:00
Jason Harvey
68857e1a7d Remove gzipping of static files. 2014-07-16 13:42:05 -08:00
Julien Desfossez
cc93e5974e Fix: URL type for geoip_location.
Fixes this error message in the default configuration:
reddit-paster: Failed to fetch GeoIP information: URLError('unknown url
type: 127.0.0.1',)
2014-07-09 12:39:05 -07:00
Neil Williams
7c1258363c Make S3 region configurable.
Useful for reddit instances not in the US region.
2014-07-08 13:36:33 -07:00
Neil Williams
6f1183bdee example.ini: Add liveupdate invite quota to example.ini. 2014-06-10 12:58:59 -07:00
Neil Williams
b04735c586 Move admin/sponsor/employee permissions to LiveConfig. 2014-05-29 13:47:00 -07:00
Brian Simpson
20f57a17eb Add GeoIP service. 2014-05-28 12:57:10 -07:00
Max Goodman
8020d3191f Make private code import config and failures explicit. 2014-05-28 12:57:09 -07:00
Brian Simpson
dc4bb72cc0 Move default selfserve budget to ini. 2014-05-21 01:56:44 -04:00
Chad Birch
6ff383b1dc Report: don't block reports on archived items 2014-05-15 18:43:08 -06:00
Chad Birch
b7b24d2e9f Archiving: support custom age cutoff per-subreddit
This consolidates the three previous globals of REPLY_AGE_LIMIT,
VOTE_AGE_LIMIT, and REPORT_AGE_LIMIT into a single timeinterval setting
of ARCHIVE_AGE, and allows individual subreddits to use an archive_age
attr to override this default cutoff.
2014-05-14 14:53:23 -06:00
umbrae
379fc9f556 Allow certain media types to be expanded by default.
Current need: liveupdate.
2014-04-25 15:49:32 -07:00
Brian Simpson
cd540cbf19 Make CPM prices in the ini file the absolute price, not additive. 2014-04-22 17:15:16 -04:00
Brian Simpson
392a382daf Allow different prices for country and metro level geotargeting. 2014-04-22 17:15:16 -04:00
Brian Simpson
47d89dfa00 Move redditgifts_webhook to vault. 2014-04-16 16:44:43 -04:00
Brian Simpson
38caa5d18a Move coinbase_webhook to vault. 2014-04-16 16:44:43 -04:00
Brian Simpson
aec5e33cb8 Move paypal secret to vault. 2014-04-16 16:44:43 -04:00
Brian Simpson
1cb817c23c Move Authorize.net secrets to vault. 2014-04-16 16:44:43 -04:00