Add Warning for FB Employee

Summary: Add warning dialog when FB employee uses OSS Flipper

Reviewed By: passy, danielbuechele

Differential Revision: D16783408

fbshipit-source-id: 3e7e533c5b96d4204fc38570a4e65c23ac0aaa25
This commit is contained in:
Chaiwat Ekkaewnumchai
2019-08-14 06:11:02 -07:00
committed by Facebook Github Bot
parent fc01f5536e
commit b9e0aae1e4
4 changed files with 113 additions and 9 deletions

25
src/utils/fbEmployee.js Normal file
View File

@@ -0,0 +1,25 @@
/**
* Copyright 2019-present Facebook.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
* @format
*/
import util from 'util';
const exec = util.promisify(require('child_process').exec);
const cmd = 'klist --json';
const endWith = '@THEFACEBOOK.COM';
export function isFBEmployee(): Promise<boolean> {
return exec(cmd).then(
(stdobj: {stderr: string, stdout: string}) => {
const principal = String(JSON.parse(stdobj.stdout).principal);
return principal.endsWith(endWith);
},
err => {
return false;
},
);
}