Skip to content

Commit 0693b5b

Browse files
committed
fix: windows license file parse issues. now exitance of licence file itself is ok
1 parent ca507be commit 0693b5b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src-node/utils.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const {lintFile} = require("./ESLint/service");
99
let openModule, open; // dynamic import when needed
1010

1111
const options = { name: 'Phoenix Code' };
12-
const licenseFileContent = JSON.stringify({licensedDevice: true});
12+
const licenseFileContent = JSON.stringify({});
1313

1414
async function _importOpen() {
1515
if(open){
@@ -310,6 +310,10 @@ function readFileUtf8(p) {
310310
async function addDeviceLicense() {
311311
const targetPath = getLicensePath();
312312
let command;
313+
// we should not store any sensitive information in this file as this is world readable. we use the
314+
// device id itself as license key for that machine. the device id is not associated with any cloud credits
315+
// and all entitlements are local to device only for this threat model to work. So stolen device IDs doesn't
316+
// have any meaning.
313317

314318
if (os.platform() === 'win32') {
315319
// Windows: write file and explicitly grant Everyone read rights
@@ -350,8 +354,8 @@ async function isLicensedDevice() {
350354
const targetPath = getLicensePath();
351355
try {
352356
const data = await readFileUtf8(targetPath);
353-
const json = JSON.parse(data);
354-
return json && json.licensedDevice === true;
357+
JSON.parse(data);
358+
return true; // currently, the existence of the file itself is flag. in future, we may choose to add more.
355359
} catch {
356360
// file missing, unreadable, or invalid JSON
357361
return false;

0 commit comments

Comments
 (0)