-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat(api): anonymise newfields not specified by default #4351
feat(api): anonymise newfields not specified by default #4351
Conversation
@@ -0,0 +1,806 @@ | |||
const applicationSchemaFields = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File anonymise-model-fields.js
has 789 lines of code (exceeds 700 allowed). Consider refactoring.
deepObj[lastKey] = value; | ||
} | ||
|
||
function anonymizeNewFields(item, knownFields, schemaFields) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function anonymizeNewFields
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
@@ -0,0 +1,837 @@ | |||
const applicationSchemaFields = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File anonymise-model-fields.js
has 817 lines of code (exceeds 700 allowed). Consider refactoring.
deepObj[lastKey] = value; | ||
} | ||
|
||
function getAllPaths(obj, parentPath = "") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function getAllPaths
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
@@ -0,0 +1,854 @@ | |||
const applicationSchemaFields = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File anonymise-model-fields.js
has 832 lines of code (exceeds 700 allowed). Consider refactoring.
return paths; | ||
} | ||
|
||
function anonymizeNewFields(item, knownFields, schemaFields) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function anonymizeNewFields
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
@@ -0,0 +1,857 @@ | |||
const applicationSchemaFields = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File anonymise-model-fields.js
has 835 lines of code (exceeds 700 allowed). Consider refactoring.
e557569
to
6235726
Compare
@@ -1,6 +1,330 @@ | |||
const { generateAddress, generateRandomName, generateRandomEmail, generateBirthdate, getYoungLocation, generateNewPhoneNumber, starify } = require("../utils/anonymise"); | |||
const { anonymizeNonDeclaredFields } = require("../utils/anonymise-model-fields"); | |||
|
|||
function anonymize(itemToAnonymize) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function anonymize
has 387 lines of code (exceeds 200 allowed). Consider refactoring.
return paths; | ||
} | ||
|
||
function anonymizeNonDeclaredFields(item, whitelist) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function anonymizeNonDeclaredFields
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
return paths; | ||
} | ||
|
||
function anonymizeNonDeclaredFields(item, whitelist) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function anonymizeNonDeclaredFields
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
} | ||
|
||
// Anonymise tous les champs d'un objet qui ne sont pas dans la whitelist | ||
function anonymizeNonDeclaredFields(item, whitelist) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function anonymizeNonDeclaredFields
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Code Climate has analyzed commit ec8a144 and detected 3 issues on this pull request. Here's the issue category breakdown:
The test coverage on the diff in this pull request is 100.0% (50% is the threshold). This pull request will bring the total coverage in the repository to 45.5% (-0.1% change). View more on Code Climate. |
api/src/anonymization/young.js
Outdated
@@ -67,8 +399,8 @@ function anonymize(item) { | |||
item.forgotPasswordResetToken = ""; | |||
item.invitationToken = ""; | |||
item.phase3Token = ""; | |||
item.parent1Inscription2023Token = ""; | |||
item.parent2Inscription2023Token = ""; | |||
item.parent1Inscription2023Token = crypto.randomBytes(20).toString("hex"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pourquoi ne pas avoir laissé une chaine de caractère vide ?
Quel interêt d'avoir une valeur aléatoire ?
les fonctions crypto peuvent ralentir l'anonymization (utilisées 2 x / jeune)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ça empêche de faire certains test sur la plate-forme pour la team jeune
@@ -45,7 +45,7 @@ | |||
"aws-sdk": "^2.1248.0", | |||
"bcryptjs": "^2.4.3", | |||
"body-parser": "^1.20.3", | |||
"bson": "^6.7.0", | |||
"bson": "^4.7.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pourquoi avoir downgradé la version de bson ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
J'avais des erreurs avec la version upgrade je peux retest vu les modifs qu'il y a eu sur la PR depuis le temps
https://www.notion.so/jeveuxaider/Anonymiser-par-d-faut-lors-de-l-anonymisation-10372a322d508003aabfe390772d8540