Commit Graph

262 Commits

Author SHA1 Message Date
adam
f8510a3cf8 Interest Collections: do not notify sales for 'after dark' collection 2015-04-09 14:25:56 -07:00
Neil Williams
eff0a20da3 example.ini: Remove gzipper middleware from pipeline.
It is causing issues with local static files in development mode and
we'll probably be replacing it in the near future.
2015-04-02 11:54:30 -07:00
Chad Birch
0fbea80d45 Integrate AutoModerator into the site 2015-03-31 14:56:19 -06:00
umbrae
e0f361127f Strip embed tokens - a manual revert of c0fcb63 2015-03-26 20:46:34 -07:00
zeantsoi
a987aa2320 Update example subreddits to valid values 2015-03-19 15:38:59 -07:00
Neil Williams
653c6e5113 Upgrade authentication providers to modern system.
This is more consistent with other providers and makes it possible for
providers to live outside r2.
2015-03-19 11:52:06 -07:00
Neil Williams
2b4c3d1fd3 Move CDN client IP verification to a provider.
This makes the base controller a bit cleaner and should be more
flexible.
2015-03-19 11:51:39 -07:00
umbrae
e5647d641c Embeds: use our session-appending redirector to track link clicks 2015-02-27 22:18:41 -08:00
xiongchiamiov
2620100c37 Q&A sort type: add special collapsing rules
In the Q&A sort type, we now collapse everything except:

* top-level posts
* OP posts
* the comments preceding OP posts

to help readers find OP interactions.
2015-03-17 11:52:34 -07:00
Neil Williams
12db500229 vote: Use LastModified to cull some prequeued_votes lookups.
prequeued_votes is meant to hide the fact that votes are processed
asynchronously when a user refreshes a page right after voting (i.e. the
vote arrow will remain colored even if it wasn't processed fully yet on
the backend.)

Now that LastModified for votes is written in-request rather than in the
queue, we can take advantage of this to reduce the number of items we
have to look up prequeued_votes for.

A new configurable, vote_queue_grace_period, specifies what amount of
queue lag we're willing to paper over.  If the user hasn't voted in that
grace period, we just assume that the vote has been processed, skip
prequeued_votes lookups for it and go straight to Cassandra.
Additionally, if we are going to do lookups, we'll skip lookups for
items that were created since the last time the user voted like we were
already doing at the DenormalizedRelation layer.

This will likely shift some reads to Cassandra so we should keep an eye
on that.
2015-03-16 11:27:57 -07:00
jo-asakura
f3147ee639 Add GA tracking for Gold pages 2015-03-12 13:59:48 -07:00
xiongchiamiov
a110a9d870 Orangered emails: one-click unsubscribe
Even if it's opt-in, we want people to be able to easily unsubscribe from
notification emails.

Using an HMAC instead of a generated token means we don't have to store
anything extra, but just perform a calculation on email send and in the
unsubscribe responder.
2015-03-03 15:50:09 -08:00
xiongchiamiov
73a7d237bd Orangered emails: send from alternate address
Despite our best efforts, we're probably still going to appear a bit spammy
with our notification emails.  To help prevent this from affecting everything
else, we can send these from an alternate domain.
2015-03-03 15:50:07 -08:00
MelissaCole
73bc503a89 Add new gold emails to example.ini 2015-03-03 12:19:11 -08:00
Brian Simpson
711c4c2580 Remove min_promote_future, max_promote_future. 2015-02-26 12:58:59 -05:00
MelissaCole
785a082544 Add hide_subscribers_srs to example.ini 2015-02-26 14:31:16 -08:00
Chad Birch
165ca78803 Create subreddit: add support for min age/karma
This allows setting (via live config) minimum age and karma requirements
to be able to create a subreddit. The age requirement and at least one
of the karma requirements must be met. A hook was added as well for
potential private-code use.
2015-02-25 18:44:43 -07:00
Chad Birch
9c8be783e1 Account.needs_captcha: add hook, use live_config
This allows the minimum amount of karma needed to be exempt from the
captcha to be modified via live config. In addition, it adds the
ability to set a comment karma minimum, where previously it was required
to get link karma in order to be exempt from the captcha.

A hook has also been added to the function for private-code purposes.
2015-02-25 18:44:37 -07:00
Keith Mitchell
ab93da58da Update web interface for modifying multis
* Set description using the base model endpoint
* Add feature-flagged interface for setting:
  - key_color
  - icon
  - visibility == 'hidden'
2015-02-24 09:49:38 -08:00
David Wick
dd82ca82bc Comment embeds: track embed views without PII
Use the anonymous event tracker on embed views to prevent sending
any personally identifiable information.
2015-02-23 18:09:57 -08:00
David Wick
a400524cb5 Comment embeds: Add event pixel tracking 2015-02-23 18:09:57 -08:00
xiongchiamiov
e29e727791 Comment embeds: add per-comment token
While in the process of rolling out comment embeds, we'd like to have restrict
our beta a bit - because by their nature, once embeds are out, we lose control
over them, making it extremely difficult to make changes.  So we're restricting
the embed generation modal to a certain subset of users (for now), but a savvy
user could simply modify an existing public embed to plug in another comment
id, which would defeat the point of restricting it.  Enter hmac.

We know generate a unique token for each comment, and only by using the
appropriate token will your embed work.  This will be transparent to users, as
its just another piece of the html that they copy and paste onto their website.

Performance-wise, we're generating tokens for every comment that can be
embedded.  However, for now that's a limited set, and the operation is pretty
fast (roughly 5ms for 1000 tokens on my dev VM); if that becomes a problem, we
can easily take this code out after we no longer need the restriction.
2015-02-23 18:09:55 -08:00
Jordan Milne
6cbbabb9a9 Keep a separate list of subdomains that can't be in c.domain_prefix
I forgot how insanely brittle this bit of code is since I last tried
messing with it last year. At some point we might want to look into
deprecating everything but oauth., the lang subdomains, and www. To
hell with `www.ssl.circlejerk.json.reddit.com`.
2015-02-18 14:50:41 -08:00
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