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

Improve test coverage #462

Merged
merged 105 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
f97c86f
major fixes
dividehex Dec 7, 2023
bfea828
Fix the mozilla logo image link in the passwordless email
dividehex Feb 9, 2024
2dcb795
Remove original_connection_user_id namespaced claim
dividehex Feb 16, 2024
6052778
Update package.json
dividehex Feb 15, 2024
48fcf2b
GHA run tests in root dir
dividehex Feb 15, 2024
664237d
Fix a couple test file names so they actually run
dividehex Feb 15, 2024
6501b4b
return _ in the callback handler
dividehex Feb 15, 2024
3d17510
Make sure callback is always returned in OIDC-conformance-workaround …
dividehex Feb 15, 2024
40d00f7
Expand OIDC-conformance-workaround rule test
dividehex Feb 15, 2024
1cc375f
Expand the test for default-deny-for-maintenance rule
dividehex Feb 15, 2024
ef50eb7
Be more explict and check the url on the default-deny-for-maintenance…
dividehex Feb 15, 2024
3b4964d
Lint and clean up SAML-Braintree-attribute rule
dividehex Feb 15, 2024
3d48323
Expand test coverage for SAML-Braintree-attribute rule
dividehex Feb 15, 2024
3ef0288
Lint and clean up SAML-Navex-partition-id rule
dividehex Feb 15, 2024
2dfead6
Expand test coverage for SAML-Navex-partition-id rule
dividehex Feb 15, 2024
80c5856
Lint and clean up SAML-gcp-gsuite rule
dividehex Feb 15, 2024
fa3906b
Expand test coverage for SAML-gcp-gsuite rule
dividehex Feb 15, 2024
1f079e3
Lint and clean up SAML-lgtm rule
dividehex Feb 15, 2024
d8854e9
Expand test coverage for SAML-lgtm rule
dividehex Feb 15, 2024
4bc1a87
Lint and clean up SAML-test-mozilla-com-google rule
dividehex Feb 15, 2024
73250be
Expand test coverage for SAML-test-mozilla-com-google rule
dividehex Feb 15, 2024
2609173
Lint and clean up aai rule
dividehex Feb 16, 2024
9bccc29
Expand test coverage for aai rule
dividehex Feb 16, 2024
b85a93c
Expand test coverage for CIS-Claims-fixup rule
dividehex Feb 16, 2024
c8fa42d
Lint and clean up Global-Function-Declarations rule
dividehex Feb 26, 2024
e190df0
Mock the UnauthorizedError object and return the global object in the…
dividehex Feb 26, 2024
ec9a8ff
Expand test coverage for Global-Function-Declarations rule
dividehex Feb 26, 2024
9a22e52
Remove SAML-Convercent-Community rule and tests
dividehex Feb 26, 2024
ff1ed6a
Add test coverage for SAML-vectra rule
dividehex Feb 26, 2024
fb85d6a
Convert all sync tests to async
dividehex Mar 6, 2024
0bbe879
Fix up the rule loader
dividehex Mar 6, 2024
1bed83f
Rewrite AccessRules.js and add test coverage for it
dividehex Mar 6, 2024
2f1de32
Clean up and lint rules/GHE-Groups.js
dividehex Mar 6, 2024
fbb6e65
Missing semicolon
dividehex Mar 7, 2024
74006b5
Add some env vars to configuration object needed for GHE-Groups rules
dividehex Mar 7, 2024
721f066
Fix test in force-ldap-logins-over-ldap.test.js
dividehex Mar 7, 2024
bff57d8
Return _log as standalone object instead of inside the context object
dividehex Mar 7, 2024
02dd76a
Refactor and use async/await in rules/GHE-Groups.js for clarity and r…
dividehex Mar 7, 2024
1efb7c6
Add test coverage for GHE-Groups.js
dividehex Mar 7, 2024
d78ec7e
Add a mock function for auth0.updateUserMetadata
dividehex Mar 11, 2024
2fba96a
Add environment vars to the configuration object needed for unittests
dividehex Mar 11, 2024
df0e3bc
Refactor rules/activate-new-users-in-CIS.js for better error handlein…
dividehex Mar 11, 2024
010a2f3
Expand on tests/activate-new-users-in-CIS.test.js for better test cov…
dividehex Mar 11, 2024
8626035
Merge pull request #459 from dividehex/passwordless_html
dividehex May 15, 2024
51c16e5
Merge pull request #461 from dividehex/remove_mozillians_claim
dividehex May 15, 2024
44a11bd
Update GHE mapping to match current rule in production
dividehex May 22, 2024
44f12e8
Merge pull request #463 from dividehex/ghe_updates
dividehex May 22, 2024
ec547a5
Spelling and grammatical fixed
dividehex May 29, 2024
e24da42
Stop overwriting primary metadata with secondary while account linking
dividehex Dec 13, 2023
a9b7c1a
Add mozilliansorg_http-observatory-rds group for awsSaml
dividehex Jan 29, 2024
f291202
Vectra SAML modifications
dividehex Feb 12, 2024
23cbd57
Fix the mozilla logo image link in the passwordless email
dividehex Feb 9, 2024
4237ede
Remove original_connection_user_id namespaced claim
dividehex Feb 16, 2024
2901636
Update GHE mapping to match current rule in production
dividehex May 22, 2024
f3f2699
major fixes
dividehex Dec 7, 2023
e62e79c
Fix various typos in comments and missing logic case
dividehex May 29, 2024
fcc377d
Merge branch 'master' into major_fixes
dividehex May 29, 2024
6a6d645
Remove erroneous newline
dividehex May 29, 2024
8435755
Last minute fixes and cleanup
dividehex May 30, 2024
6569b1e
More cleanup after testing
dividehex May 30, 2024
5c26bb1
Merge pull request #455 from dividehex/major_fixes
dividehex May 31, 2024
360c5c8
Update package.json
dividehex Feb 15, 2024
d5529f7
GHA run tests in root dir
dividehex Feb 15, 2024
f77b4bc
Fix a couple test file names so they actually run
dividehex Feb 15, 2024
314b707
return _ in the callback handler
dividehex Feb 15, 2024
ffb31e1
Make sure callback is always returned in OIDC-conformance-workaround …
dividehex Feb 15, 2024
fd1de15
Expand OIDC-conformance-workaround rule test
dividehex Feb 15, 2024
9e46fde
Expand the test for default-deny-for-maintenance rule
dividehex Feb 15, 2024
e886972
Be more explict and check the url on the default-deny-for-maintenance…
dividehex Feb 15, 2024
ec3501c
Lint and clean up SAML-Braintree-attribute rule
dividehex Feb 15, 2024
d0c0847
Expand test coverage for SAML-Braintree-attribute rule
dividehex Feb 15, 2024
0451720
Lint and clean up SAML-Navex-partition-id rule
dividehex Feb 15, 2024
9dd99d9
Expand test coverage for SAML-Navex-partition-id rule
dividehex Feb 15, 2024
c89bae4
Lint and clean up SAML-gcp-gsuite rule
dividehex Feb 15, 2024
0d20cc0
Expand test coverage for SAML-gcp-gsuite rule
dividehex Feb 15, 2024
736b1cd
Lint and clean up SAML-lgtm rule
dividehex Feb 15, 2024
ee6ae52
Expand test coverage for SAML-lgtm rule
dividehex Feb 15, 2024
6dde012
Lint and clean up SAML-test-mozilla-com-google rule
dividehex Feb 15, 2024
a996d5d
Expand test coverage for SAML-test-mozilla-com-google rule
dividehex Feb 15, 2024
6a6a249
Lint and clean up aai rule
dividehex Feb 16, 2024
2459ba1
Expand test coverage for aai rule
dividehex Feb 16, 2024
cf9f649
Expand test coverage for CIS-Claims-fixup rule
dividehex Feb 16, 2024
49fa5e4
Lint and clean up Global-Function-Declarations rule
dividehex Feb 26, 2024
ee9cced
Mock the UnauthorizedError object and return the global object in the…
dividehex Feb 26, 2024
9465340
Expand test coverage for Global-Function-Declarations rule
dividehex Feb 26, 2024
c4e5a3f
Remove SAML-Convercent-Community rule and tests
dividehex Feb 26, 2024
e22c9c9
Add test coverage for SAML-vectra rule
dividehex Feb 26, 2024
39ecebe
Convert all sync tests to async
dividehex Mar 6, 2024
bf24822
Fix up the rule loader
dividehex Mar 6, 2024
d25c52c
Rewrite AccessRules.js and add test coverage for it
dividehex Mar 6, 2024
b8a6032
Clean up and lint rules/GHE-Groups.js
dividehex Mar 6, 2024
0252df8
Missing semicolon
dividehex Mar 7, 2024
2c224aa
Add some env vars to configuration object needed for GHE-Groups rules
dividehex Mar 7, 2024
1ef1784
Fix test in force-ldap-logins-over-ldap.test.js
dividehex Mar 7, 2024
2e90c54
Return _log as standalone object instead of inside the context object
dividehex Mar 7, 2024
0eee0f7
Refactor and use async/await in rules/GHE-Groups.js for clarity and r…
dividehex Mar 7, 2024
f0b9669
Add test coverage for GHE-Groups.js
dividehex Mar 7, 2024
c092ec6
Add a mock function for auth0.updateUserMetadata
dividehex Mar 11, 2024
c73f803
Add environment vars to the configuration object needed for unittests
dividehex Mar 11, 2024
b48f1a2
Refactor rules/activate-new-users-in-CIS.js for better error handlein…
dividehex Mar 11, 2024
0760522
Expand on tests/activate-new-users-in-CIS.test.js for better test cov…
dividehex Mar 11, 2024
d3e5f6a
Merge remote-tracking branch 'dividehex/better_tests' into better_tests
dividehex May 31, 2024
b3c05ff
Removes missed merge markers
dividehex May 31, 2024
e445192
Update GHE-groups tests to include latest client_ids
dividehex May 31, 2024
d7a12e4
Convert all rules to be async functions
dividehex May 31, 2024
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
1 change: 0 additions & 1 deletion .github/workflows/test-rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@ jobs:
node-version: ${{ matrix.node-version }}
- name: Test Rules
run: |
cd tests
npm install
npm run tests
332 changes: 332 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,332 @@
# Created by https://www.toptal.com/developers/gitignore/api/visualstudiocode,node,python
# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudiocode,node,python

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

### Node Patch ###
# Serverless Webpack directories
.webpack/

# Optional stylelint cache

# SvelteKit build / generate output
.svelte-kit

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

### Python Patch ###
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
poetry.toml

# ruff
.ruff_cache/

# LSP config files
pyrightconfig.json

### VisualStudioCode ###
.vscode/*
#!.vscode/settings.json
#!.vscode/tasks.json
#!.vscode/launch.json
#!.vscode/extensions.json
#!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix

### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide

# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,node,python
6 changes: 6 additions & 0 deletions connections/firefoxaccounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ function firefoxAccountsConnection(accessToken, ctx, cb) {
user_id: id_token.sub,
picture: p.avatar,
preferredLanguage: p.locale,
// Mozilla accounts (formerly Firefox Accounts), allows mixed case characters in their email property
// I'm adding this comment here in case we want to actually enforce email case conformity in the future
// Although, it will need extensive testing to ensure we aren't breaking anything. In the meantime, we will
// need to account for the fact that this and other IdP connectors return email with mixed case.
// So until otherwise decided, we allow mixed case email.
// email: p.email.toLowerCase(),
email: p.email,
email_verified: true,
fxa_sub: id_token.sub,
Expand Down
2 changes: 1 addition & 1 deletion manual/passwordless.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<td align="center" valign="top" id="bodyCell" style="-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%;mso-table-lspace: 0pt;mso-table-rspace: 0pt;margin: 0;padding: 20px;font-family: &quot;ProximaNova&quot;, sans-serif;height: 100% !important;">
<div class="main">
<p style="text-align: center;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%; margin-bottom: 30px;">
<img src="https://sso.mozilla.com/media/img/sandstone/header-mozilla-stone.png" width=100 alt="Mozilla" style="-ms-interpolation-mode: bicubic;border: 0;height: auto;line-height: 100%;outline: none;text-decoration: none;">
<img src="https://sso.mozilla.com/static/img/mozilla.svg" width=100 alt="Mozilla" style="-ms-interpolation-mode: bicubic;border: 0;height: auto;line-height: 100%;outline: none;text-decoration: none;">
</p>

<!-- Email change content -->
Expand Down
Loading