fix: use 0600 permissions on config.yaml
This commit is contained in:
parent
698ad37008
commit
413c0bb26c
4 changed files with 10 additions and 7 deletions
|
|
@ -113,9 +113,9 @@ export function getConfigYamlPath(ideType?: IdeType): string {
|
|||
// https://github.com/continuedev/continue/pull/7224
|
||||
// This was here because we had different context provider support between jetbrains and vs code
|
||||
// Leaving so we could differentiate later but for now configs are the same between IDEs
|
||||
fs.writeFileSync(p, YAML.stringify(defaultConfig));
|
||||
fs.writeFileSync(p, YAML.stringify(defaultConfig), { mode: 0o600 });
|
||||
} else {
|
||||
fs.writeFileSync(p, YAML.stringify(defaultConfig));
|
||||
fs.writeFileSync(p, YAML.stringify(defaultConfig), { mode: 0o600 });
|
||||
}
|
||||
}
|
||||
return p;
|
||||
|
|
@ -255,12 +255,13 @@ function editConfigJson(
|
|||
}
|
||||
|
||||
function editConfigYaml(callback: (config: ConfigYaml) => ConfigYaml): void {
|
||||
const config = fs.readFileSync(getConfigYamlPath(), "utf8");
|
||||
const configPath = getConfigYamlPath();
|
||||
const config = fs.readFileSync(configPath, "utf8");
|
||||
let configYaml = YAML.parse(config);
|
||||
// Check if it's an object
|
||||
if (typeof configYaml === "object" && configYaml !== null) {
|
||||
configYaml = callback(configYaml as any) as any;
|
||||
fs.writeFileSync(getConfigYamlPath(), YAML.stringify(configYaml));
|
||||
fs.writeFileSync(configPath, YAML.stringify(configYaml), { mode: 0o600 });
|
||||
} else {
|
||||
console.warn("config.yaml is not a valid object");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ async function createOrUpdateConfig(apiKey: string): Promise<void> {
|
|||
: "";
|
||||
|
||||
const updatedContent = updateAnthropicModelInYaml(existingContent, apiKey);
|
||||
fs.writeFileSync(CONFIG_PATH, updatedContent);
|
||||
fs.writeFileSync(CONFIG_PATH, updatedContent, { mode: 0o600 });
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ export async function createOrUpdateConfig(apiKey: string): Promise<void> {
|
|||
: "";
|
||||
|
||||
const updatedContent = updateAnthropicModelInYaml(existingContent, apiKey);
|
||||
fs.writeFileSync(CONFIG_PATH, updatedContent);
|
||||
fs.writeFileSync(CONFIG_PATH, updatedContent, { mode: 0o600 });
|
||||
}
|
||||
|
||||
export async function runOnboardingFlow(
|
||||
|
|
|
|||
|
|
@ -715,7 +715,9 @@ const getCommandsMap: (
|
|||
const configYaml = convertJsonToYamlConfig(parsed);
|
||||
|
||||
const configYamlPath = getConfigYamlPath();
|
||||
fs.writeFileSync(configYamlPath, YAML.stringify(configYaml));
|
||||
fs.writeFileSync(configYamlPath, YAML.stringify(configYaml), {
|
||||
mode: 0o600,
|
||||
});
|
||||
|
||||
// Open config.yaml
|
||||
await openEditorAndRevealRange(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue