mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-05 10:51:12 -07:00
Disallow unsafe type assertions (#18688)
This commit is contained in:
committed by
GitHub
parent
bce1caefd0
commit
fd65416a2f
@@ -66,6 +66,7 @@ export async function isDirectorySecure(
|
||||
} catch (error) {
|
||||
return {
|
||||
secure: false,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
||||
reason: `A security check for the system policy directory '${dirPath}' failed and could not be completed. Please file a bug report. Original error: ${(error as Error).message}`,
|
||||
};
|
||||
}
|
||||
@@ -93,11 +94,13 @@ export async function isDirectorySecure(
|
||||
|
||||
return { secure: true };
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
||||
if ((error as NodeJS.ErrnoException).code === 'ENOENT') {
|
||||
return { secure: true };
|
||||
}
|
||||
return {
|
||||
secure: false,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
||||
reason: `Failed to access directory: ${(error as Error).message}`,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user