Skip to content

Commit

Permalink
fix(annotation): unset default creator name from os username (Fixes #…
Browse files Browse the repository at this point in the history
…2628)

for security reason do not export creator name in annotation set from os
username and let the user to set his own nickname.
  • Loading branch information
panaC committed Dec 18, 2024
1 parent 1a9aeb5 commit f0f4763
Showing 1 changed file with 5 additions and 30 deletions.
35 changes: 5 additions & 30 deletions src/common/redux/reducers/creator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string | undefined>((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",
Expand Down

0 comments on commit f0f4763

Please sign in to comment.