From 704c10e677425605222a655205e5061e48c0bac8 Mon Sep 17 00:00:00 2001
From: Pierre Leroux
Date: Tue, 10 Dec 2024 13:28:54 +0100
Subject: [PATCH] fix(annotation): unset default creator name from os username
(Fixes #2628)
for security reason do not export creator name in annotation set from os
username and let the user to set his own nickname.
---
src/common/redux/reducers/creator.ts | 35 ++++------------------------
1 file changed, 5 insertions(+), 30 deletions(-)
diff --git a/src/common/redux/reducers/creator.ts b/src/common/redux/reducers/creator.ts
index bb561e34b..c5e2ab133 100644
--- a/src/common/redux/reducers/creator.ts
+++ b/src/common/redux/reducers/creator.ts
@@ -10,39 +10,14 @@ import { type Reducer } from "redux";
import { creatorActions } from "../actions";
import { IAnnotationCreator } from "../states/creator";
import { v4 as uuidv4 } from "uuid";
-import { userInfo } from "os";
-// // Generated by llama-3.1-sonar-large
-// not needed seems to works fine with os.userInfo on windows
-// export async function creatorInitGetUsernameFromWin32Promise() {
-
-// let username = "";
-// if (process.platform === 'win32') {
-// const powershell = spawn('powershell.exe', ['[System.Security.Principal.WindowsIdentity]::GetCurrent().Name']);
-// let usernameFromPS = await new Promise((resolve) => {
-// let data = '';
-// powershell.stdout.on('data', (chunk) => {
-// data += chunk.toString();
-// });
-// powershell.on('close', () => {
-// resolve(data);
-// });
-// });
-
-// const indexOfBackslash = usernameFromPS?.indexOf('\\');
-// username = usernameFromPS?.slice(indexOfBackslash + 1).replace(/\r\n/g, '');
-// }
-
-// return username;
+const username = "";
+// try {
+// username = process.env.USERNAME || process.env.USER || userInfo().username;
+// } catch {
+// // ignore
// }
-let username = "";
-try {
- username = process.env.USERNAME || process.env.USER || userInfo().username;
-} catch {
- // ignore
-}
-
const initialState: IAnnotationCreator = {
id: uuidv4(),
type: "Organization",