Skip to content

Commit 4478195

Browse files
committed
file permissions for anthropic credentials
1 parent 54c4a78 commit 4478195

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

packages/opencode/src/auth/anthropic.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { generatePKCE } from "@openauthjs/openauth/pkce"
22
import { Global } from "../global"
33
import path from "path"
4+
import fs from "fs/promises"
5+
import type { BunFile } from "bun"
46

57
export namespace AuthAnthropic {
68
const CLIENT_ID = "9d1c250a-e61b-44d9-88ed-5944d1962f5e"
@@ -45,7 +47,9 @@ export namespace AuthAnthropic {
4547
}),
4648
})
4749
if (!result.ok) throw new ExchangeFailed()
48-
await Bun.write(path.join(Global.Path.data, "anthropic.json"), result)
50+
const file = Bun.file(path.join(Global.Path.data, "anthropic.json"))
51+
await Bun.write(file, result)
52+
await fs.chmod(file.name!, 0o600)
4953
}
5054

5155
export async function access() {

packages/opencode/src/cli/cmd/run.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ export const RunCommand = {
8282
printEvent(UI.Style.TEXT_INFO_BOLD, "Read", args.filePath)
8383
if (tool === "opencode_write")
8484
printEvent(UI.Style.TEXT_SUCCESS_BOLD, "Create", args.filePath)
85+
if (tool === "opencode_list")
86+
printEvent(UI.Style.TEXT_INFO_BOLD, "List", args.path)
8587
if (tool === "opencode_glob")
8688
printEvent(
8789
UI.Style.TEXT_INFO_BOLD,

0 commit comments

Comments
 (0)