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

Clean up and remove unused rules #438

Merged
merged 9 commits into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
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 rules/AccessRules.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ function AccessRules(user, context, callback) {
// Use whatever is available from the group struct. Sometimes there's a race condition where user.app_metadata.*
// isnt reintegrated to user.* for example
var groups = user.app_metadata.groups || user.ldap_groups || user.groups || [];

// Inject the everyone group and filter duplicates
groups.push("everyone")
groups = groups.filter((value, index, array) => array.indexOf(value) === index);


// This is used for authorized user/groups
var authorized = false;
// Defaut app requested aal to MEDIUM for all apps which do not have this set in access file
Expand Down
22 changes: 0 additions & 22 deletions rules/Everyone-is-in-the-everyone-group.js

This file was deleted.

4 changes: 0 additions & 4 deletions rules/Everyone-is-in-the-everyone-group.json

This file was deleted.

44 changes: 0 additions & 44 deletions rules/HRIS-is-staff.js

This file was deleted.

4 changes: 0 additions & 4 deletions rules/HRIS-is-staff.json

This file was deleted.

6 changes: 0 additions & 6 deletions rules/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,10 @@ This is the list of keys we're using for secrets (and abuse for certain configur
- `force-ldap-logins-over-ldap.js` Ensure LDAP users only login with LDAP (i.e. "Staff uses Staff login"). This
forbids using passwordless, GitHub, etc. login methods with a `@mozilla.com` email for example.
- `CIS-Claims-fixups.js` Adds custom OIDC claims in our namespace, like groups or AAI
- `CIS-New-User-hook.js` Invoke the Auth0 CIS Publisher hook with a user_id, in order to notify it of potentially new
or modified users.
- `Everyone-is-in-the-everyone-group.js` Adds all users in a group called `everyone` to function correctly with the
apps.yml file, which assume you have this group, historically
- `Global-Function-Declarations.js` A place to have a cache of functions. This cache dies when the webtasks die, so
every 60s
- `SAML-AWS-consolidatedbilling-readonly.js` Custom claim mapping for SAML
- `SAML-AWS-mozillaiam-account-readonly.js` Ditto
- `SAML-temporary-AWS-consolidatedbilling-admin.js` Ditto
- `SAML-test-mozilla-com-google.js` Ditto
- `SAML-thinksmart.js` Ditto
- `gcp-gsuite-SAML-claims.js` Ditto
Expand All @@ -60,7 +55,6 @@ This is the list of keys we're using for secrets (and abuse for certain configur
- `temporary-LDAP-re-reintegration.js` Temporary rule that reintegrates LDAP groups to the profile. This should be
removed and replaced by person-api v2 calls eventually
available.
- `temporary-hris-connector.js` Temporary rule that fix the missing `hris_is_staff` group for Mozillians.org, until
person-apiv2 is available.
- `link-users-by-email-with-metadata.js` Links user profiles by primary email (GH [email protected] and FxA [email protected] become the same
profile). The user profile to be main (ie main user_id) is decided by ratcheting logic.
43 changes: 0 additions & 43 deletions rules/hris-is-staff overrides.js

This file was deleted.

4 changes: 0 additions & 4 deletions rules/hris-is-staff overrides.json

This file was deleted.

62 changes: 0 additions & 62 deletions rules/restricted-users.js

This file was deleted.

4 changes: 0 additions & 4 deletions rules/restricted-users.json

This file was deleted.

20 changes: 0 additions & 20 deletions rules/security-block-ips.js

This file was deleted.

4 changes: 0 additions & 4 deletions rules/security-block-ips.json

This file was deleted.

20 changes: 0 additions & 20 deletions rules/temporary-LDAP-re-reintegration.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,4 @@ function temporaryLDAPReReintergration(user, context, callback) {
}
}
}

// This is a work-around because the SSO Dashboard apps.yml authorization rules
// decided to have a group that's called `everyone` hardcoded, even though no such group exists
// This rule hard codes it for all users, as it is meant to represent, well, every user.
// Without this rule, users would otherwise be denied access when an RP has an authorization of "`everyone`" in the SSO Dashboard apps.yml
Array.prototype.push.apply(groups, ['everyone']);
Array.prototype.push.apply(groups, user.app_metadata.groups);
Array.prototype.push.apply(groups, user.groups);
groups = Array.from(new Set(groups));
user.groups = groups;
user.app_metadata.groups = groups;
auth0.users.updateAppMetadata(user.user_id, user.app_metadata)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't mean to remove all of this part. I'll add part of it back in.

.then(function(){
console.log("reintegration complete for " + user.user_id);
return callback(null, user, context);
})
.catch(function(err){
console.log(err);
return callback(err);
});
}
25 changes: 0 additions & 25 deletions tests/Everyone-is-in-the-everyone-group.test.js

This file was deleted.

64 changes: 0 additions & 64 deletions tests/HRIS-is-staff.test.js

This file was deleted.

Loading