mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-19 08:44:22 +01:00
tweak: whitelist
This commit is contained in:
@@ -49,14 +49,14 @@ export const ReadTool = Tool.define("read", {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const block = (() => {
|
const block = iife(() => {
|
||||||
const whitelist = [".env.example", ".env.sample"]
|
const whitelist = [".env.sample", ".example"]
|
||||||
|
|
||||||
if (whitelist.some((w) => filepath.endsWith(w))) return false
|
if (whitelist.some((w) => filepath.endsWith(w))) return false
|
||||||
if (filepath.includes(".env")) return true
|
if (filepath.includes(".env")) return true
|
||||||
|
|
||||||
return false
|
return false
|
||||||
})()
|
})
|
||||||
|
|
||||||
if (block) {
|
if (block) {
|
||||||
throw new Error(`The user has blocked you from reading ${filepath}, DO NOT make further attempts to read it`)
|
throw new Error(`The user has blocked you from reading ${filepath}, DO NOT make further attempts to read it`)
|
||||||
|
|||||||
Reference in New Issue
Block a user