Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring production up to date with master #286

Merged
merged 212 commits into from
Sep 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
212 commits
Select commit Hold shift + click to select a range
7021072
Support for expiration of access as per https://github.com/mozilla-ia…
gdestuynder May 17, 2018
6e8230f
Change access expiration logic to occur after AccessRules have succeeded
gdestuynder May 22, 2018
25253dc
uncache function as this causes webtask being stuck (cache too big?)
gdestuynder May 24, 2018
fff3e95
Merge pull request #194 from gdestuynder/master
May 24, 2018
27d65b5
clarify examples and settings
gdestuynder May 29, 2018
5546028
Merge pull request #196 from gdestuynder/master
May 30, 2018
2a8753d
force Fxa to be higher security than github. it may or may not be true,
gdestuynder Jun 4, 2018
399fc18
Merge pull request #198 from gdestuynder/order
Jun 6, 2018
bb76355
Change example URL to fxa stage
gdestuynder Jun 7, 2018
ff73054
use id_token to check for AAL instead of user profile endpoint for
gdestuynder Jun 7, 2018
001a963
Merge pull request #199 from gdestuynder/fxa
Jun 7, 2018
b0cc017
fix to be on par with dev
gdestuynder Jun 7, 2018
f28705c
workaround for 2fa caching + non-logged out fxa sessions
gdestuynder Jun 8, 2018
118fb82
Merge pull request #201 from gdestuynder/master
Jun 8, 2018
81fb8fc
check the fxa 2fa param (comes from user info endpoint or id_token) i…
gdestuynder Jun 8, 2018
54b129b
Merge pull request #202 from gdestuynder/master
Jun 8, 2018
4b854ef
merge back dev manual fixes
gdestuynder Jun 11, 2018
e999fd6
Merge pull request #203 from gdestuynder/master
Jun 13, 2018
4ae6617
Fix nodejs8 support for fetch user script
gdestuynder Jun 26, 2018
ce7cfc4
We no longer use this file as source for the login window
gdestuynder Jun 29, 2018
5a4fb13
Merge pull request #205 from gdestuynder/master
Jul 3, 2018
c76ee24
Add manual maintenance page
gdestuynder Jul 12, 2018
dd24f3b
Add top level "manual"
gdestuynder Jul 12, 2018
d0081c6
Merge pull request #206 from gdestuynder/master
Jul 12, 2018
9639747
use #mozsm-all channel
gdestuynder Jul 17, 2018
a68af4e
Merge pull request #207 from gdestuynder/master
Jul 17, 2018
0aa84fd
workaround is no longer used
gdestuynder Jul 18, 2018
06dff93
Add support for fetching and verifying a JWT containing the access rules
gdestuynder Jul 26, 2018
32be2cd
Update comment on when MFA is required
gene1wood Aug 3, 2018
e8462b9
Add common voice dev to ratcheting bypass
gene1wood Aug 7, 2018
3508347
Add comments to clarify ratcheting logic flow
gene1wood Aug 7, 2018
75e3de4
Merge pull request #213 from gene1wood/common-voice-dev-ratcheting-by…
gene1wood Aug 7, 2018
134421a
Add documentation on Firefox Accounts Custom Social Connection
gene1wood Aug 10, 2018
e946465
Merge pull request #216 from gene1wood/add-fxa-docs
Aug 13, 2018
36208cc
use JWS instead of JWT
gdestuynder Aug 15, 2018
475cb86
Merge pull request #209 from mozilla-iam/gene1wood-patch-1
Aug 15, 2018
ba8516e
Merge pull request #208 from gdestuynder/signing
Sep 18, 2018
0746821
Add requirements to run CI, and fix AccessRules syntax..
gdestuynder Sep 19, 2018
a8025ba
add info about where to find available modules
gdestuynder Sep 19, 2018
f04c017
support for unverified access file since its not yet in place
gdestuynder Sep 20, 2018
0ea5d78
Merge pull request #219 from gdestuynder/master
Sep 20, 2018
294dd17
Add buildspec for codebuild deploys
gdestuynder Sep 20, 2018
56d3f99
Drive builds with a makefile for local compat
gdestuynder Sep 20, 2018
9320ba3
prefil parameter-store mappings
gdestuynder Sep 20, 2018
d130cb4
Merge pull request #220 from gdestuynder/master
Sep 26, 2018
47c6194
force ldap logins to use ldap (this is a new enforcement)
gdestuynder Sep 21, 2018
f2d2268
Remove MFA enforcement for non-LDAP users
gdestuynder Sep 21, 2018
608d5ef
Change logic to use the well-known endpoint everywhere
gdestuynder Sep 21, 2018
0782f1c
typo
gdestuynder Sep 21, 2018
8158296
sets Parameter Store key names for CodeBuild job
danielhartnell Oct 3, 2018
2ef43cb
uses correct mapping for SSM parameters and changes variable invocation
danielhartnell Oct 3, 2018
188f38f
Merge pull request #221 from danielhartnell/configure-codebuild-env
Oct 3, 2018
0c6584d
Support setting user AAI in auth0
gdestuynder Oct 3, 2018
02b571b
Inform RP about User's AAI in a custom claim
gdestuynder Oct 3, 2018
25682b0
Fix missing callback
gdestuynder Oct 3, 2018
d979654
- remove TAI since its not longer used (we only use AAI)
gdestuynder Oct 3, 2018
300c03b
fix missing callback
gdestuynder Oct 3, 2018
9f1b002
Move AAI logic where it belongs so that defaults are used
gdestuynder Oct 3, 2018
e52f7f5
Allow for HIGH_ASSURANCE_IDP in the default / fallback mapping
gdestuynder Oct 4, 2018
c84a020
add checks so that rules can run independently more easily, for testing
gdestuynder Oct 5, 2018
6889f1d
Merge pull request #222 from gdestuynder/poc-no-ratcheting
Oct 5, 2018
400e4c7
Cleanup vars and declare groups from metadata > groups .> empty list
gdestuynder Oct 9, 2018
4c16e5e
Make the console error msg a bit more clear
gdestuynder Oct 9, 2018
9efe152
Ensure the authorized user/group logic cannot bypass non-access file
gdestuynder Oct 9, 2018
533401d
Merge pull request #224 from gdestuynder/poc-no-ratcheting
Oct 9, 2018
9c25640
s/aai/AAI/ in the access file
gdestuynder Oct 10, 2018
8aa3cb9
Merge pull request #225 from gdestuynder/poc-no-ratcheting
gdestuynder-mozilla-owner Oct 11, 2018
ee04dc1
if the multifactor context is set, it means the user will be required to
gdestuynder Oct 11, 2018
c937125
Merge pull request #226 from gdestuynder/poc-no-ratcheting
Oct 12, 2018
74298b8
update rules to match production
andrewkrug Nov 5, 2018
4c09938
fix ordering
andrewkrug Nov 5, 2018
be62095
Merge pull request #229 from andrewkrug/add_missing_rules
Nov 5, 2018
66854ce
Some doc on the rules
gdestuynder Nov 9, 2018
943f55b
s/aai_level/aal/ to match our spec
gdestuynder Nov 9, 2018
6706dbd
Merge pull request #230 from gdestuynder/master
Nov 9, 2018
5e23e53
fix for mozillians.org hris_is_staff
gdestuynder Nov 15, 2018
3d84fa7
Merge pull request #232 from gdestuynder/master
Nov 15, 2018
f2aa419
add mozillians so that the hris_is_staff rule can trigger
gdestuynder Nov 15, 2018
7d287eb
Merge pull request #233 from gdestuynder/master
Nov 15, 2018
7e26201
also integrate to user.groups
gdestuynder Nov 15, 2018
1ba042d
Merge pull request #234 from gdestuynder/master
Nov 15, 2018
9befd3e
space out ordering so that we get more room to move rules around
gdestuynder Nov 15, 2018
b75915f
Merge pull request #235 from gdestuynder/master
Nov 15, 2018
e91e53e
Add automatic user profile linking support
gdestuynder Dec 10, 2018
f716053
Add support for linking accounts while following a ratcheted logic
gdestuynder Dec 10, 2018
89af0a9
fix linking when the current account === top match from linking
gdestuynder Dec 11, 2018
5536341
Update rules/link-users-by-email-with-metadata.js
gene1wood Dec 11, 2018
7dbfbaa
Clarify the terms used for user variables
gene1wood Dec 11, 2018
7e7fbed
Remove reference to currentUser as it's not used
gdestuynder Dec 11, 2018
a1f2471
Merge pull request #1 from gene1wood/tweak-terms-236
gdestuynder Dec 11, 2018
3380686
Add support for the case where we have only 1 match in the Auth0 db
gdestuynder Dec 12, 2018
fcc6fe6
Merge pull request #236 from gdestuynder/master
Dec 12, 2018
54c78b1
initialize user.groups to [] if undefined so that all users get at least
gdestuynder Dec 12, 2018
11729d4
Merge pull request #237 from gdestuynder/master
Dec 12, 2018
512ebe4
only reconstruct ldap groups if we have an API match as otherwise this
gdestuynder Dec 12, 2018
fa4393e
fix: _HRData must be present for this reintegration to happen
gdestuynder Dec 12, 2018
04eec43
Merge pull request #240 from gdestuynder/master
Dec 12, 2018
ab6ee1f
add logic to care for the case where an already linked account is
gdestuynder Dec 13, 2018
e55aa12
Initial attempt at documenting the development cycle
gene1wood Dec 13, 2018
2e39520
account for the case where an account is not yet linked and is the
gdestuynder Dec 13, 2018
935d754
typo.. rule didnt do what comment says
gdestuynder Dec 13, 2018
6930cf4
Merge pull request #241 from gdestuynder/master
Dec 13, 2018
bd2a000
store new_groups in user.group just in case its not being reintegrated
gdestuynder Dec 13, 2018
f31afd7
Merge pull request #245 from gdestuynder/228
Dec 13, 2018
2d3d7fb
Merge pull request #244 from gene1wood/add-dev-cycle-to-docs
Dec 13, 2018
bcaa32c
Set a new claim
gdestuynder Dec 14, 2018
76857f1
only send claim for mozillians.org verification clients
gdestuynder Dec 14, 2018
9acfc61
typo in log message
gdestuynder Jan 4, 2019
4a81685
fix AAI error when connecting with a GitHub account, while your main
gdestuynder Jan 4, 2019
1bee357
Merge pull request #246 from gdestuynder/master
Jan 4, 2019
e2782c1
fix for undefined vars and typo
gdestuynder Jan 5, 2019
6d837a1
Merge pull request #247 from gdestuynder/master
Jan 5, 2019
6fdd7cc
change how user.aal is set so that it is separated from how access it
gdestuynder Jan 8, 2019
2ff9da3
adding rule to deal with Convercent's lack of user database separatio…
Jan 8, 2019
c12bf14
Update rules/SAML-Convercent-Community.js
Jan 8, 2019
5699d93
Update rules/SAML-Convercent-Community.js
Jan 8, 2019
3069cd6
Update rules/SAML-Convercent-Community.js
Jan 8, 2019
8417652
Update rules/SAML-Convercent-Community.js
Jan 8, 2019
c2a1d3a
lookup 2fa attributes in user.identities[].profileData in case the
gdestuynder Jan 10, 2019
abc32ea
Merge pull request #249 from gdestuynder/master
Jan 10, 2019
9d499db
Update SAML-Convercent-Community.js
Jan 15, 2019
348d407
Merge pull request #1 from jdow/jdow-patch-1
Jan 15, 2019
223eb84
Merge remote-tracking branch 'upstream/master'
Jan 25, 2019
227998c
adding Navex rule to add an attribute needed
Jan 25, 2019
ca64a2f
adding Staples client IDs to hrdata rule
Jan 29, 2019
ba200e9
Merge pull request #250 from jdow/master
Jan 29, 2019
46816c6
code which removes group data from users with AAL=LOW
gdestuynder Feb 7, 2019
14dad5a
fix potential issue with group being undefined but still triggering the
gdestuynder Feb 8, 2019
0aae87e
Fix bug in case 2 of account linking and clarify logic (#255)
gene1wood Feb 12, 2019
cd0171a
Merge pull request #253 from gdestuynder/master
Feb 13, 2019
e811c0d
Disable by default
Feb 13, 2019
b9a44b6
cleanup case to have CLEAR if conditions between data.length and
gdestuynder Feb 14, 2019
c231856
missing log line
gdestuynder Feb 19, 2019
5cf9d3e
clarify time delay logic and add log to show when this is triggered
gdestuynder Feb 19, 2019
4e13546
fix comparison seconds to seconds (instead of seconds to milliseconds)
gdestuynder Feb 25, 2019
d62b4e5
Add comment about the first match in db being after filtering only
gdestuynder Feb 25, 2019
442588e
Merge pull request #258 from gdestuynder/fix
Feb 25, 2019
332e5f4
Merge pull request #259 from gdestuynder/master
Feb 25, 2019
1ab9f22
mark `user.user_is_new` when the user is new and filtered out
gdestuynder Feb 25, 2019
331b94a
Merge pull request #260 from gdestuynder/master
Feb 27, 2019
25c170d
Add Mozilla Code of Conduct file
Mozilla-GitHub-Standards Mar 28, 2019
9c2239a
Automated merge
gdestuynder-mozilla-owner Apr 2, 2019
fedf07c
disable caching
gdestuynder Apr 12, 2019
1bcf6b3
whitelist test accounts
gdestuynder Apr 12, 2019
2679654
Fix https://jira.mozilla.com/browse/EIS-852 where users may not get
gdestuynder Apr 12, 2019
92c484d
Merge pull request #264 from gdestuynder/master
Apr 12, 2019
5ba0f1c
only save groups in metadata and wait for reintegration at next login
gdestuynder Apr 17, 2019
181d82b
Merge pull request #265 from gdestuynder/master
Apr 17, 2019
aab8e34
do not wipe app_metadata as auth0 now uses it to overlay when rules
gdestuynder Apr 19, 2019
d708481
Merge pull request #266 from gdestuynder/master
Apr 19, 2019
0130baf
adding Zoom to hrdata rule to get costcenter mapping
Apr 25, 2019
64f3d7c
Merge pull request #267 from jdow/master
Apr 25, 2019
ba95130
fix all the auth0 group handling
May 3, 2019
535dd3f
removing debug log and fixing groups var
May 3, 2019
9b4b081
do not overload the id_token when the client only request scope:openid -
gdestuynder May 6, 2019
fdd2ae8
Merge pull request #268 from jdow/master
gdestuynder May 6, 2019
c55874a
Merge pull request #269 from gdestuynder/master
gdestuynder May 6, 2019
fb95a7a
add rule for the AWS Federated access
gdestuynder May 6, 2019
c1c7528
support string-like group format:
gdestuynder May 6, 2019
1554e11
change logic to generate 'amr': '"groupA""groupB""groupC""' instead
gdestuynder May 6, 2019
f3d0bc2
simplify rule code, we found out that AWS will accept a list
gdestuynder May 7, 2019
56b759c
support the aws mapping format to reduce the list of groups we send to
gdestuynder May 7, 2019
ac8eb67
improve logging
gdestuynder May 7, 2019
f49bcea
Merge pull request #270 from gdestuynder/master
gdestuynder May 7, 2019
ffdab08
workaround/fix auth0 replacing idToken.amr[0]
gdestuynder May 8, 2019
c0e29ab
clearer comment
gdestuynder May 8, 2019
910ccff
Merge pull request #271 from gdestuynder/master
gdestuynder May 8, 2019
1995a3d
adding SAML rule for LGTM for client specific settings
May 21, 2019
bf03360
re-introduce the update_at fix since it's rebroken in auth0 for some
gdestuynder Jun 6, 2019
a3539a0
Merge pull request #274 from gdestuynder/master
gdestuynder Jun 6, 2019
ac8771c
Merge pull request #273 from jdow/master
Jun 6, 2019
fdef8ae
rename, auth0 does not like _ in names
gdestuynder Jun 6, 2019
6664078
add rule that can be used to block ips on demand
gdestuynder Jun 7, 2019
cd656df
Merge pull request #276 from gdestuynder/master
gdestuynder Jun 7, 2019
55e9747
missing curly bracket
gdestuynder Jun 7, 2019
6514ae4
Merge pull request #277 from gdestuynder/master
gdestuynder Jun 7, 2019
16f91ac
Using proper terraform managed consolidated billing sso provider and
Jun 6, 2019
97d3cb2
Merge pull request #275 from limed/limed/consolidated-billing-rename
Jun 7, 2019
5d7839b
Fixing a typo
Jun 7, 2019
7801466
Merge pull request #278 from limed/limed/typo
Jun 7, 2019
f863529
Define style standard as Google style
gene1wood Aug 15, 2019
4b79af5
Add documentation on known issues
gene1wood Aug 15, 2019
a0b0553
Add support for new S3 hosted group role map file
gene1wood Aug 15, 2019
43e5e24
Update Auth0 setting variable names and add documentation
gene1wood Aug 16, 2019
b992205
Change documentation to reference the js code instead of the json rul…
gene1wood Aug 16, 2019
7c98087
Clarify known issue documentation regarding save button
gene1wood Aug 16, 2019
24e4641
Merge pull request #279 from gene1wood/update-aws-federated-rule
gene1wood Aug 20, 2019
118a3b1
Minor comment fix
gene1wood Aug 26, 2019
6714e4f
Update comment about cacheing
gene1wood Aug 26, 2019
515f100
Merge pull request #280 from gene1wood/update-rule-comments
gene1wood Sep 4, 2019
8e5a642
Support wildcards in AWS-Federated-AMR role picker
april Sep 5, 2019
d7b064e
Add newlines to the end of files
april Sep 5, 2019
f139be7
Add a README file for the tests
april Sep 5, 2019
39fd877
Add more complete regular expression handling
april Sep 9, 2019
f58099a
Merge pull request #281 from april/master
gene1wood Sep 9, 2019
517ed9b
Re-introduce Everyone-is-in-the-everyone-group.js
gdestuynder Sep 12, 2019
2ff7e9b
Merge pull request #283 from gdestuynder/master
Sep 12, 2019
5be3a15
disabling rule for now
Sep 12, 2019
231248f
Merge pull request #284 from jdow/master
gene1wood Sep 12, 2019
134c38f
Merge branch 'master' into production
gene1wood Sep 12, 2019
fe348e7
Add some details to the README about CI
gene1wood Sep 13, 2019
9aff959
update access group
andrewkrug Sep 13, 2019
3ccb028
Merge pull request #288 from mozilla-iam/update_access_rule_aws_fed
Sep 13, 2019
1871660
Add link to docs for manual testing
gene1wood Sep 16, 2019
b606347
Move groupIntersection inside WHITELIST block
gene1wood Sep 16, 2019
cf96695
Merge pull request #289 from gene1wood/reorder_aws_federated_rule
gene1wood Sep 16, 2019
5decb61
Merge pull request #287 from gene1wood/add_to_docs
gene1wood Sep 16, 2019
3578864
Point to the rule backup runbook in case it's needed
Sep 16, 2019
2cbf2d7
Merge branch 'master' into production
gene1wood Sep 16, 2019
28f09e2
Removing 2 rules
gene1wood Sep 16, 2019
9d48c40
Re apply #181 which is missing from the merge of master into producti…
gene1wood Sep 17, 2019
339991f
Add missing maintenance rule
gene1wood Sep 17, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": ["eslint:recommended", "google"],
"rules": {
// Additional, per-project rules...
}
}
15 changes: 15 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Community Participation Guidelines

This repository is governed by Mozilla's code of conduct and etiquette guidelines.
For more details, please read the
[Mozilla Community Participation Guidelines](https://www.mozilla.org/about/governance/policies/participation/).

## How to Report
For more information on how to report violations of the Community Participation Guidelines, please read our '[How to Report](https://www.mozilla.org/about/governance/policies/participation/reporting/)' page.

<!--
## Project Specific Etiquette
In some cases, there will be additional project etiquette i.e.: (https://bugzilla.mozilla.org/page.cgi?id=etiquette.html).
Please update for your project.
-->
29 changes: 29 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
URI := auth-dev.mozilla.auth0.com
CLIENTID :=
CLIENTSECRET :=

all:
@echo 'Available make targets:'
@grep '^[^#[:space:]].*:' Makefile

python-venv: venv
venv:
$(shell [ -d venv ] || python3 -m venv venv)
echo "# Run this in your shell to activate:"
echo "source venv/bin/activate"

install:
pip install -r requirements.txt


deploy-local:
# Requires a credentials.json file to be present and valid
# Useful for local tests
uploader_rules.py -r rules

deploy:
@echo "Deploying to $(URI)"
gene1wood marked this conversation as resolved.
Show resolved Hide resolved
uploader_rules.py -r rules -u $(URI) -c $(CLIENTID) -s $(CLIENTSECRET)


.PHONY: venv all install deploy
95 changes: 93 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,103 @@ You can find more information about Auth0 at https://www.auth0.com

The rules are snippets of javascript code running as webtasks (https://www.webtasks.io), which modify the authentication flow of users in Auth0.

See also: https://github.com/auth0-samples/github-source-control-integration

## Branches

`master`:
The master branch is used for development of rules and are auto-deployed on https://manage-dev.mozilla.auth0.com/

`production`:
/!\ The production branch uses merges from the master branch and are used for production. These are auto-deployed on https://manage.mozilla.auth0.com/

## Deployment & CI

Rules are deployed with `auth0-ci` <https://github.com/mozilla-iam/auth0-ci> after CI has completed.
For testing, this looks like this:

```
$ python3 -m venv venv
$ source venv/bin/activate
$ pip install -r requirements.txt
$ uploader_rules.py <args>
```

## Development

How do I know which nodejs modules are available to me?

At this time Auth0 runs nodejs8. The module list that is cached inside webtasks is listed here:
https://auth0-extensions.github.io/canirequire/#rsa

### Style

The primary goal is to follow the style of the [Auth0 example rules](https://github.com/auth0/rules/tree/master/src/rules).
This appears to follow the [Google JavaScript Style Guide](https://google.github.io/styleguide/jsguide.html)
in some ways as there are trailing semi-colon characters. In other ways the
Auth0 rules do not follow the Google style as some contain [`var` declarations](https://google.github.io/styleguide/jsguide.html#features-use-const-and-let)
Try to follow the Google style in the Mozilla rules in this repo.

### Development cycle

This is the cycle today. In the future we hopefully add CI driven tests.
This cycle could be improved.

Please note that for any large change (i.e. anything but a single rule change), it is recommended to backup the current rules before deploying. You can do this by following the run-book at https://mana.mozilla.org/wiki/display/SECURITY/Create+and+reload+auth0+rules+backup

1. Write a rule in your local fork of the repo
2. Run `uploader_rules.py -r rules` to deploy the uncommitted rule to auth0-dev
3. Do manual testing in auth0-dev to determine if the rule does what you want
4. Iterate steps 1-3 until you have a rule that works
5. Remove the new rule from auth0-dev. This could be done by checking out
master (which doesn't have the rule) and again running `uploader_rules.py -r rules`
6. Push your branch to your fork and create a PR with your new rule, requesting
a review of the PR.
7. Someone reviews the PR, either suggesting changes or approving
8. Merge the PR
9. CI deploys the PR to auth0-dev
* This CI runs in AWS CodeBuild in the `mozilla-iam` (320464205386) AWS
account in the `us-west-2` region in the AWS CodeBuild project
`auth0-deploy-stage`.
* The CodeBuild project follows the [`buildspec.yml`](buildspec.yml) which
calls the [`Makefile`](Makefile) which calls the
[`uploader_rules.py`](https://github.com/mozilla-iam/auth0-ci/blob/master/uploader_rules.py)
tool which is installed from the [`auth0-ci`](https://github.com/mozilla-iam/auth0-ci)
project.
10. Manually test again in auth0-dev to validate that the rule works. This is
the stage to do more thorough testing as this is the last step before
production deployment
11. If testing validates the rule is good, create a second PR from `master` to
`production`, requesting review and referencing in the text of the PR the
first PR which contains the initial review. Ideally the changes in the first
dev PR and this prod PR will be the same and the reviewer can leverage
the dev PR's review. If that's not the case a new thorough review would be
needed.
12. During change window, merge PR.
* As of September 2019 this won't trigger CI to deploy to prod as it's not been
setup
* Instead, manually deploy to prod using [`uploader_rules.py`](https://github.com/mozilla-iam/auth0-ci/blob/master/uploader_rules.py)
from the [`auth0-ci`](https://github.com/mozilla-iam/auth0-ci) project.
13. [Test in prod](https://mana.mozilla.org/wiki/display/SECURITY/Auth0+manual+testing) to make sure everything works and rollback if it doesn't.

## Known Issues

### Auth0 Rule Web UI jshint configuration

The Auth0 web UI where you can view and modify rules, for example at
https://manage-dev.mozilla.auth0.com/dashboard/pi/auth-dev/rules
has a jshint built in which isn't aware that Auth0 rules are run under
Node version `8.11.4` and as a result shows errors for things like
`require` and `let`. To work around this add this to the top of your rule

```
/*jshint esversion: 6 */
```

### Auth0 Rule Web UI save button

The Auth0 web UI where you can view and modify rules, for example at
https://manage-dev.mozilla.auth0.com/dashboard/pi/auth-dev/rules
when you click the `Save` button, a green banner saying
`The rule script has been saved` shows up. The content however won't
always be saved and the `Save` button won't always turn from blue to
gray. If waiting on the page for the async save to complete isn't working
you can click the `Save` button a second time.
14 changes: 14 additions & 0 deletions buildspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 0.2

env:
parameter-store:
CLIENTID: "/iam/auth0-deploy/stage/AUTH0_RULE_DEPLOY_CLIENTID"
gene1wood marked this conversation as resolved.
Show resolved Hide resolved
CLIENTSECRET: "/iam/auth0-deploy/stage/AUTH0_RULE_DEPLOY_CLIENTSECRET"
URI: "/iam/auth0-deploy/stage/AUTH0_URI"
phases:
build:
commands:
- make install
post_build:
commands:
- make CLIENTID=${CLIENTID} CLIENTSECRET=${CLIENTSECRET} URI=${URI} deploy
37 changes: 36 additions & 1 deletion manual/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,41 @@
## manual
# manual

This area is for manual-deploy of specific files, when auth0 does not yet support auto-deployment.
Ideally these should be moved to directories that can auto-deploy the code/templates/etc. in the future.

This mean any change to files in this directory will need to be manually mirrored in the auth0 setup.

## social-fxa.js : Firefox Accounts Custom Social Connection

This adds support in Auth0 for Firefox Accounts (FxA) as an [Auth0 Connection](https://auth0.com/docs/applications/connections)
(aka IdP).

### How to deploy the code

1. Log into the Auth0 management UI
2. Click `Extensions` in the left hand list of sections
3. In the Extensions list, click `Custom Social Connections`
4. Delegate permissions to this Extension when prompted
5. In the new `Custom Social Connections` window click `Firefoxaccounts`
6. Copy and paste the `social-fxa.js` code into the `Fetch User Profile Script` textbox

### How to manage the service

***Attempting to manage this extension with Firefox will not work. You must use Chrome or fake a Chrome User-Agent***

![Chrome Logo](https://www.google.com/chrome/static/images/chrome-logo.svg)

1. Log into the Auth0 management UI
2. Click `Extensions` in the left hand list of sections
3. In the Extensions list, click `Custom Social Connections`
4. Delegate permissions to this Extension when prompted
5. In the new `Custom Social Connections` window click `Firefoxaccounts`
6. Click the `Apps` tab
* From here you can affect which [Auth0 Applications](https://auth0.com/docs/applications)
will have Firefox Accounts enabled or disabled as an allowed Auth0 Connection type
* The grey and green switches to the right of the list of applications can be clicked to change
whether Firefox Accounts is enabled.

## passwordless.html

## maintenance.html
28 changes: 28 additions & 0 deletions manual/maintenance.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<!--
This page is used in case the login page fails to display and also fails to display any error or warning.
This is for EMERGENCY ONLY.
It is meant to be used as such (or similar):

$ xclip maintenance.html # or open this in your text editor, select-all and copy
Go to https://manage.mozilla.auth0.com/#/login_page
Paste and save.
-->
<html lang="en">
<head>
<title>Mozilla Login - Maintenance</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<h1>Maintenance mode</h1>
<p>
We are currently experiencing an issue &amp; working hard to resolve it. Please try to login again in a few minutes.
</p>
<br/>
<p>
For emergencies, you can request help via <a href="mailto:moc@mozilla.com">moc@mozilla.com</a>, on IRC channel <a
href="irc://irc.mozilla.org/moc">#moc</a>
or Slack channel <a href="https://mozilla.slack.com/">#mozsm-all</a>
</p>
</body>
</html>
71 changes: 71 additions & 0 deletions manual/social-fxa.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// This is the Fetch User Profile Script for FxA
// Note the `acr_values` parameter, which requires AAL2 authenticator assurance level
// (https://pages.nist.gov/800-63-3/sp800-63b.html)
// Authenticator Assurance Level 2: AAL2 provides high confidence that the claimant controls an authenticator(s) bound to the subscriber’s account. Proof of possession and control of two different authentication factors is required through secure authentication protocol(s). Approved cryptographic techniques are required at AAL2 and above.
// We'd also be fine with AAL3 of course, though FxA supports up to AAL2 at this time.

// Well-known URLs:
// Prod: https://accounts.firefox.com/.well-known/openid-configuration
// Stage: https://accounts.stage.mozaws.net/.well-known/openid-configuration
// Dev: https://oauth-latest.dev.lcip.org/.well-known/openid-configuration
//
// Example:
// Authorization endpoint: https://oauth-latest.dev.lcip.org/v1/authorization?acr_values=AAL2
// Token endpoint: https://oauth-latest.dev.lcip.org/v1/token
// scopes: openid profile
// Note that as per above, using the authorization parameter `acr_values=AAL2` will enforce authenticating accounts with 2FA only

function(accessToken, ctx, cb) {
// Auth0 already verified the id_token and it's signature at this stage
// See docs at https://developer.mozilla.org/en-US/docs/Mozilla/Tech/Firefox_Accounts/Introduction
// See also https://github.com/mozilla/fxa-oauth-server/issues/519#issuecomment-367196241 for information on fields
// Note that we assert this email is verified by FxA, though we do not check `amr` contains `email`. This is because
// We currently assert `email_verified` to be true if it has ever been verified, not if it's "just been verified"
var jwt = require('jsonwebtoken');
var id_token = jwt.decode(ctx.id_token);

// Request additional profile info, such as picture, locale, etc.
request.get('https://profile.stage.mozaws.net/v1/profile',
{
'headers': {
'Authorization': 'Bearer ' + accessToken,
'User-Agent': 'MozillaIAM-Auth0'
}
},
function(e, r, b) {
if (e) return callback(e);
if (r.statusCode !== 200) {
return cb(new Error('Failed to fetch user profile. StatusCode:' + r.statusCode));
}

var p = JSON.parse(b);

if (id_token.sub != p.sub) {
return cb(new Error('sub does not match, this should not happen'));
}
// We check if the current session was authenticated with 2FA (id_token knows this)
var two_factor = false;
if (id_token['fxa-aal'] >= 2) {
two_factor = true;
} else {
// if not , it might be the user just enabled 2FA and has not logged back in
// for now, handle this like GitHub 2FA by looking it up in the user info endpoint
// note that if for caching reasons this is not set, we may still get the incorrect value
// and in that case there's nothing we can currently do / user has to wait or log back in to get it "faster"
two_factor = p.twoFactorAuthentication;
}

return cb(null, {
user_id: id_token.sub,
picture: p.avatar,
preferredLanguage: p.locale,
email: p.email,
email_verified: true,
fxa_sub: id_token.sub,
amr: id_token.amr,
acr: id_token.acr,
fxa_twoFactorAuthentication: two_factor
});
}
);
}
Loading