<commit_before>function (user, context, callback) {
  var namespace = 'https://sso.mozilla.com/claim/';
  var whitelist = ['']; // claim whitelist

  // If you're not OIDC Conformant, stop right there as this INCREASES the profile size
  // significantly! The metadata is set by us, manually.

  if (!context.clientMetadata || !context.clientMetadata.oidc_conformant || context.clientMetadata.oidc_conformant !== 'true') {
    console.log('Client '+context.clientID+' is not OIDC conformant yet, please fix!');
    // Bare minimum conversion to help migrating clients to OIDC conformant
    //context.idToken = context.idToken || {};
    //context.idToken[namespace+'groups'] = user.groups;
    return callback(null, user, context);
  }


  // If the only scope requested is openid, do not overload with custom claims
  if (context.request.query.scope === "openid") {
    console.log('Client '+context.clientID+' only requested scope:openid, not adding custom claims');
    return callback(null, user, context);<commit_msg>Bypass CIS fixup for requests with scopes of "openid" or "email"<commit_after>function (user, context, callback) {
  var namespace = 'https://sso.mozilla.com/claim/';
  var whitelist = ['']; // claim whitelist
  let isSetsEqual = (a, b) => a.size === b.size && [...a].every(value => b.has(value));

  // If you're not OIDC Conformant, stop right there as this INCREASES the profile size
  // significantly! The metadata is set by us, manually.

  if (!context.clientMetadata || !context.clientMetadata.oidc_conformant || context.clientMetadata.oidc_conformant !== 'true') {
    console.log('Client '+context.clientID+' is not OIDC conformant yet, please fix!');
    // Bare minimum conversion to help migrating clients to OIDC conformant
    //context.idToken = context.idToken || {};
    //context.idToken[namespace+'groups'] = user.groups;
    return callback(null, user, context);
  }


  // If the only scopes requested are openid or email, do not overload with custom claims
  let scopes = new Set(context.request.query.scope.split(' '));
  let whitelisted_scopes = new Set(["openid", "email"]);
  if (isSetsEqual(scopes, whitelisted_scopes)) {
    console.log('Client '+context.clientID+' only requested scope:openid or scope:email, not adding custom claims');
    return callback(null, user, context);
{'fraction_non_alphanumeric': 0.13213213213213212, 'fraction_numerical': 0.0, 'mean_word_length': 4.193763919821826, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3071215', 'n_tokens_mistral': 698, 'n_tokens_neox': 682, 'n_words': 218}