Граф коммитов

55 Коммитов

Автор SHA1 Сообщение Дата
Vlad Filippov 3b33f416ea feat(devices): devices API with refreshTokens
Co-authored-by: Vlad Filippov <vlad.filippov@gmail.com>
Co-authored-by: Ryan Kelly <rfkelly@mozilla.com>

Fixes #2547
2019-03-19 11:00:04 -04:00
Shane Tomlinson 0b3e970de1
refactor(logging): Update to Mozlog format.
Remove all of the `op:` stuff in the logging.

fixes #2940
2019-03-08 17:40:04 +00:00
Phil Booth b0a6d00397
fix(errors): include request data on unexpected errors 2019-02-11 17:44:17 +00:00
Ryan Kelly 7f1376696d
feat(oauth): Expose /account/scoped-key-data endpoint, by making backend calls to oauth-server. 2018-12-17 14:41:21 +11:00
vladikoff d98b10ca30 refactor(headers): remove HPKP headers
Fixes #2744
2018-11-19 10:23:12 -05:00
Phil Booth 2168ea7afe
fix(metrics): ensure email events use stashed flow data where applicable
A number of places that were sending emails assumed they had access to
flowId and flowBeginTime on the request payload. However, we're in the
process of changing some of those endpoints so that they don't receive
metrics context data in the payload.

To fix this, all endpoints are changed here to read metrics context data
via a lazy getter that falls back to loading from memcached if there's
no flow data in the payload. This happened to be a nice refactor anyway,
fitting in with our broader adoption of lazy getters. It makes the code
more resilient to change and reduces the frequency that we hit the cache
with.
2018-10-23 17:42:06 +01:00
Phil Booth 804907a32b
fix(metrics): stash metrics context during the account reset flow
We are planning to deprecate metrics context payloads on endpoints where
it is not strictly required. This means only endpoints that start a flow
or endpoints that occur outside of any flow will accept metrics context
payloads in the future.

The motivation for making this change is to reduce the likelihood of
metrics weirdness arising from conflicting metrics context data being
set mid-flow.

The account reset flow includes three different token types. By stashing
metrics context as each new token is created, we can stop sending it to
the subsequent endpoints in some future content server change without
interrupting metrics.
2018-09-28 15:24:16 +01:00
Edouard Oger 72809f8f1c fix(sessionTokens): actually prune expired session tokens
https://github.com/mozilla/fxa-auth-server/pull/2562
r=philbooth
2018-08-03 08:09:03 +01:00
John Morrison 7f60f8c39d fix(tests): add a check from sentry setup 2018-08-01 01:00:33 -07:00
John Morrison 7d69830a66 fix(sentry): server.events.on takes channels, not channel 2018-07-31 18:14:14 -07:00
Vlad Filippov 2d52887104
fix(hapi): use the new server event error handler (#2543) r=@rfk
Fixes #2542

Per hapijs/hapi#3658
2018-07-25 21:44:16 -04:00
Ryan Kelly a1e64dd093
chore(browserid): Remove unnecessary browserid routes. (#2539); r=philbooth,stomlinson
The BrowserID verifier insists that we advertize "provisioning" and
"authentication" routes in /.well-known/browserid but nothing in the
current architecture requires these routes to actually exist.  Let's
remove the unused HTML content to reduce future potential attack
surface.
2018-07-24 02:15:43 -07:00
Vlad Filippov 63738c85b5
feat(server): Update to hapi 17 (#2486) r=@vbudhram,@philbooth
Fixes #2438

Co-authored-by: deeptibaghel deeptibaghel@gmail.com
2018-07-11 09:19:05 -04:00
Phil Booth b18173883e
fix(server): validate ip addresses before setting them on request object
https://github.com/mozilla/fxa-auth-server/pull/2359
r=vbudhram
2018-03-23 13:26:17 +00:00
Phil Booth a9a61f0cc5
feat(redis): prune expired session tokens from redis
https://github.com/mozilla/fxa-auth-server/pull/2257
r=vbudhram
2018-01-18 19:23:29 +00:00
Phil Booth 938ef5cbdf feat(metrics): include fxa_services_used in amplitude user properties
https://github.com/mozilla/fxa-auth-server/pull/2125
r=vbudhram
2017-09-19 22:49:20 +01:00
Phil Booth 3518b0c0d7 feat(server): lazily get all request.app properties
https://github.com/mozilla/fxa-auth-server/pull/2123
r=shane-tomlinson
2017-09-18 18:01:28 +01:00
Vlad Filippov ceab903e26 feat(logs): add Sentry integration (#2116) r=vbudhram
Fixes #2115
2017-09-14 14:37:29 -04:00
Phil Booth f084830bcf feat(server): lazily get devices array on the request object (#2107) r=vladikoff,vbudhram
Fixes #2106.

Prevents us from accidentally calling db.devices more than once per request. I saw one definite case of this in /recovery_email/verify_code and it's possible there were others. I'll also be making use of this property heavily for the amplitude events, so it will get further usage imminently.

Making the change necessitated pulling calls to db.devices out of lib/push, which triggered some refactoring that almost got away from me. I'll add inline commentary to call out why things have changed the way they have, but most push methods now take an extra devices argument and a few other methods became redundant so I deleted them. I don't think I've broken anything.
2017-09-12 15:17:08 -04:00
Phil Booth 2238b37b6f fix(server): make geo data lazily available on the request
https://github.com/mozilla/fxa-auth-server/pull/2095
r=vbudhram
2017-09-07 22:23:33 +01:00
Phil Booth cc69b36d1c feat(server): add parsed user agent info to the request object (#2061), r=@vbudhram 2017-08-17 14:53:39 -04:00
Phil Booth 4941dd5b9f feat(tokens): expire session tokens that have no device record
Session tokens that have no device record and are older than 4 weeks old
(by default) will now be rejected as expired by all auth server endpoints.
Additionally, the `/account/sessions` endpoint will filter out expired session
tokens on the same basis.

https://github.com/mozilla/fxa-auth-server/pull/1996

r=vbudhram
2017-07-20 13:38:56 +01:00
Sean McArthur 0cfd39ca05 refactor(lib): use strings instead of buffers for as much as possible
This settles our dance of `Buffer` vs `String` down to simply this:

> You have a `String`. You should (almost) never have a `Buffer`.

Buffers are useful for talking about a specific set of bytes, without an
encoding. In our app, the places where this is useful are:

- crypto
- mysql

We don't actually speak MySQL in this repo anywhere, so that leaves us
with only crypto. Instead of requiring the mental overhead of "Do I have
a buffer or a string?" throughout all our code base, we can just push
that completely into the crypto code.

This *should* reduce bugs where we aren't sure if we have a `Buffer` or
a `String`. If you're not in crypto, you should just have a `String`.
2017-06-28 16:05:30 -07:00
Phil Booth 2610d2f5f4 feat(server): include signinCode in the installFirefox SMS
https://github.com/mozilla/fxa-auth-server/pull/1904

r=shane-tomlinson,vbudhram
2017-05-22 16:03:13 +01:00
Vlad Filippov 10d5b56ede chore(deps): update shrinkwrap and latest eslint (#1868) 2017-04-28 15:07:53 -04:00
Sean McArthur adc6d3e066 fix(promise): log unhandled rejections instead of throwing (#1818) r=vladikoff
* fix(promise): log unhandled rejections instead of throwing
* fix(server): set useDomains to true
2017-04-13 14:29:58 -04:00
Vijay Budhram 5a7e4a7f3f fix(locale): Fix merge conflicts (#1794) 2017-04-05 14:12:30 -07:00
Sean McArthur 8d5c1ed29a test(remote): refactor to run remote tests in a single process
This refactors our remote test driver to stop spawning multiple
child processes to run our servers, and instead to run the servers
in the same process.

- By using the same process, we can pass configuration as a plain old
  JavaScript object, and not have to be adjusting the `process.env`.
  While writing this patch, `process.env` pollution was already found
  to make some tests dependent on others running first. Now, we can
  isolate the tests by starting a server with a private config object,
  and the other tests are non the wiser.
- By not starting up and tear down child processes for each suite of
  remote tests, the full set runs much faster. In my case, running the
  remote tests went from ~4 minutes to ~1 minute.
2017-03-23 11:30:24 -07:00
Phil Booth 2a5d3d0b77 fix(metrics): log locale instead of accept languages on flow events
https://github.com/mozilla/fxa-auth-server/pull/1702

r=vbudhram,vladikoff
2017-03-08 16:40:21 +00:00
Phil Booth 838b602e33 chore(deps): update bluebird (#1688) r=vladikoff 2017-03-01 13:06:46 -05:00
Sean McArthur 0acab56c8e fix(server): disallow any query or payload params without validation (#1668) r=vladikoff 2017-02-22 09:58:20 -05:00
Divya Biyani 8ca537cbcc feat(space-unary-ops) : changes according to space unary ops eslint rule (#1639) r=vladikoff 2017-02-08 10:39:56 -05:00
Vlad Filippov 3719437759 feat(logs): log endpoint errors for better debugging (#1627) r=vbudhram,philbooth
New "server.EndpointError" error logging...
2017-01-26 12:42:44 -05:00
Phil Booth a8f8c4a2f1 refactor(logging): remove request argument from log methods 2017-01-06 13:28:08 +00:00
Ryan Kelly b38bace5ae fix(error): Include more specific error messages in invalidToken(). 2016-11-18 17:08:23 +11:00
Phil Booth 44e044b4bf feat(logging): emit a flow.complete event
#1515

r=seanmonstar
2016-10-21 11:57:43 +01:00
Phil Booth 957a8837f6 refactor(logging): move activity/flow event decision out of log object
#1512

r=seanmonstar,rfk,vbudhram
2016-10-18 20:58:46 +01:00
Phil Booth 16cf030e91 refactor(logging): decorate request object with metricsContext methods
#1503

r=seanmonstar
2016-10-16 10:02:36 +01:00
Vijay Budhram 9b77446c86 feat(hpkp): Add hpkp support (#1499), r=@philbooth
* feat(hpkp): Add hpkp support

This adds support for sending HPKP headers in all requests. Feature is disabled by default and should be put in report only to avoid any footguns.
2016-10-14 11:34:11 -04:00
Vlad Filippov fe803daea3 fix(deps): downgrade to hapi 14 (#1485) r=seanmonstar 2016-10-04 17:18:41 -04:00
Vlad Filippov b3adbcf66d chore(deps): update to latest version of hapi (#1330) r=rfk,seanmonstar,vbudhram
* fix(validation): adjust validation, bump version of joi

* fix(tests): restore tests

* chore(deps): rewrap
2016-09-13 20:52:06 -04:00
Vijay 10ee3224f2 feat(signin): Add support for keyFetchToken verification (#1320), r=@rfk
This allows sign-in confirmation to work correctly on Fennec
and iOS devices.
2016-07-12 10:08:17 -04:00
Vijay f68eea1eb7 feat(signin): Signin confirmation feature (#1275) r=rfk
*  feat(signin): Signin confirmation feature

*  feat(signin): Fix some merge and failing test cases

* feat(signin): Show device info on signin email

* feat(signin): Send new device email if sign-in confirmation disabled

* feat(signin): Added fallback in recovery_email/status endpoint

* feat(signin): Simplify /resend_code and add legacy fallback

* feat(signin): PR Fixes and signin confirm only for desktop clients

* feat(signin): Removed metricsContext from resend_code

* feat(signin): PR Fixes

* feat(signin): Latest PR Fixes

* feat(signin): Fixed typos

* feat(signin): Add check for invalid verification code

* Final nits on signin confirmation PR (#1288) r=vbudhram

* fix(signin): Final nits on signin confirmation PR

* fix(signin): Add test for legacy account verification functionality

* feat(signin): Fix cert sign with verified session=true test
2016-06-10 12:33:05 -04:00
Hector Zhao f792d352a9 feat(config): accept CORS requests from multiple origins 2016-05-31 10:01:42 +08:00
Ryan Kelly fd85359895 fix(clientAddress): Cope better with X-Forwarded-For having fewer items than expected. 2016-05-06 07:35:04 +10:00
Danny Coates 517fbff776 fix(clientAddress): allow location of the client ip address in forward headers to be specified in config 2016-04-11 22:20:36 -04:00
vladikoff 7a1bc8263d revert(metrics): disable logging hask skew to datadog
Fixes #1215
2016-03-17 13:11:41 -04:00
Ryan Kelly 0c153fb061 feat(logging): Log hawk timestamp skew to statsd for easier analysis. 2016-02-22 17:18:43 +11:00
Danny Coates a866e8f8e9 feat(devices): added fxa-deviceId to the signed certificate 2016-02-18 21:39:32 -08:00
Ryan Kelly 078ddc06e8 fix(hawk): Update to latest hapi-auth-hawk 2016-02-11 08:01:25 +11:00