From 26933f74373f0f7097ffe3d886b820b587ad7f82 Mon Sep 17 00:00:00 2001 From: Brett Lamy Date: Tue, 11 Apr 2023 04:21:13 -0700 Subject: [PATCH] Can you add a rule that says anyone can access pub --- src/ai/generated/AdminLogs.ts | 24 ++++++++++++++++-------- src/ai/generated/Rules.ts | 30 ++++++++++++++++++++---------- 2 files changed, 36 insertions(+), 18 deletions(-) diff --git a/src/ai/generated/AdminLogs.ts b/src/ai/generated/AdminLogs.ts index 14a4eda..094364f 100644 --- a/src/ai/generated/AdminLogs.ts +++ b/src/ai/generated/AdminLogs.ts @@ -1,10 +1,18 @@ export default [ - { - "role": "system", - "content": "You are an access control engine. I will make up roles as I go along and make up rules about what they can access. Your job is to strictly adhere to what I say and adhere on the side of caution. If you do not know if a user can access something return error. \n\nYou will have access to a scratchpad. You should compress the rules into a readable lossless JSON format that you could understand in the future. Each time I add a role or make changes to the rules encode those changes into this format and tell me to write it to the scratch pad. \n\nEvery request will be in the format\n{ \"username\": string, \"role\": Role, \"action\": Action }\nEvery response should be in this format\n{ \"decision\": boolean, \"thought\": `I believe this user can perform this action because ${string}` }\n\nThe first rule i'd like to create is that admin can access everything but employees cannot access anything marked as confidential unless they are explicitly marked as doing so. BillyBob is special he can access confidential files even though he is only an employee. \n\nTo start please encode the above rules. Remember this encoding will be read by you in another chat and you must be able to decompress it and understand the original meaning well enough to not make mistakes. Format your response as ONLY JSON do not add any characters that would make your repsonse fail a JSON.parse" - }, - { - "role": "assistant", - "content": "Here are the new rules: \n ```json\n{\"rules\": [{\"role\": \"admin\", \"access\": \"all\"}, {\"role\": \"employee\", \"access\": \"non_confidential\"}, {\"username\": \"BillyBob\", \"access\": \"confidential\"}]}```" - } + { + "role": "system", + "content": "You are an access control engine. I will make up roles as I go along and make up rules about what they can access. Your job is to strictly adhere to what I say and adhere on the side of caution. If you do not know if a user can access something return error. \n\nYou will have access to a scratchpad. You should compress the rules into a readable lossless JSON format that you could understand in the future. Each time I add a role or make changes to the rules encode those changes into this format and tell me to write it to the scratch pad. \n\nEvery request will be in the format\n{ \"username\": string, \"role\": Role, \"action\": Action }\nEvery response should be in this format\n{ \"decision\": boolean, \"thought\": `I believe this user can perform this action because ${string}` }\n\nThe first rule i'd like to create is that admin can access everything but employees cannot access anything marked as confidential unless they are explicitly marked as doing so. BillyBob is special he can access confidential files even though he is only an employee. \n\nTo start please encode the above rules. Remember this encoding will be read by you in another chat and you must be able to decompress it and understand the original meaning well enough to not make mistakes. Format your response as ONLY JSON do not add any characters that would make your repsonse fail a JSON.parse" + }, + { + "role": "assistant", + "content": "Here are the new rules: \n ```json\n{\"rules\": [{\"role\": \"admin\", \"access\": \"all\"}, {\"role\": \"employee\", \"access\": \"non_confidential\"}, {\"username\": \"BillyBob\", \"access\": \"confidential\"}]}```" + }, + { + "role": "user", + "content": "Can you add a rule that says anyone can access public file unless they have been explicitly banned from the system the only person who has been banned is a guy named Mike." + }, + { + "role": "assistant", + "content": "Sure, here are the updated rules: \n\n```json\n{\"rules\": [{\"role\": \"admin\", \"access\": \"all\"}, {\"role\": \"employee\", \"access\": \"non_confidential\"}, {\"username\": \"BillyBob\", \"access\": \"confidential\"}, {\"access\": \"public\", \"ban\": [\"Mike\"]}]}```\n\nPlease write this to the scratchpad." + } ] as const; \ No newline at end of file diff --git a/src/ai/generated/Rules.ts b/src/ai/generated/Rules.ts index 5b8a7d8..e326fee 100644 --- a/src/ai/generated/Rules.ts +++ b/src/ai/generated/Rules.ts @@ -1,12 +1,22 @@ export default { - "rules": [{ - "role": "admin", - "access": "all" - }, { - "role": "employee", - "access": "non_confidential" - }, { - "username": "BillyBob", - "access": "confidential" - }] + "rules": [ + { + "role": "admin", + "access": "all" + }, + { + "role": "employee", + "access": "non_confidential" + }, + { + "username": "BillyBob", + "access": "confidential" + }, + { + "access": "public", + "ban": [ + "Mike" + ] + } + ] } as const; \ No newline at end of file