Skip to content
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

Misleading error message which can cause trouble in debugging #115

Open
YashKumarVerma opened this issue Jul 2, 2021 · 1 comment
Open

Comments

@YashKumarVerma
Copy link
Contributor

try {
const prikeyPath = './keys/key';
if (fs.existsSync(prikeyPath)) {
PRIKEY = fs.readFileSync(prikeyPath, 'utf8');
} else {
if (DISABLE_SEC || ENABLE_SECURITY_AT && Date.parse(ENABLE_SECURITY_AT) > Date.now()) {
PRIKEY = '';
console.warn('prikey null since DISABLE_SEC and no prikey provided');
} else {
console.error('prikey does not exist');
}
}
} catch (err) {
console.error(err);
}
try {
const pubkeyPath = './keys/key.pub';
if (fs.existsSync(pubkeyPath)) {
var PUBKEY = fs.readFileSync(pubkeyPath, 'utf8');
} else {
if (DISABLE_SEC || ENABLE_SECURITY_AT && Date.parse(ENABLE_SECURITY_AT) > Date.now()) {
PUBKEY = '';
console.warn('pubkey null since DISABLE_SEC and no pubkey provided');
} else {
console.error('pubkey does not exist');
}
}
} catch (err) {
console.error(err);
}

The code block on line 40 and 56 are triggered when DISABLE_SEC || ENABLE_SECURITY_AT && Date.parse(ENABLE_SECURITY_AT) > Date.now() turns false. This has no relation to the files being present or not, whereas the block logs out a message saying XXX does not exist

@VishalMyla
Copy link

it seems that the purpose of this error message is to alert the user that the file is missing and cannot be used for authentication.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants