Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can you add a rule that says anyone can access pub #9

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions src/ai/generated/AdminLogs.ts
Original file line number Diff line number Diff line change
@@ -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;
30 changes: 20 additions & 10 deletions src/ai/generated/Rules.ts
Original file line number Diff line number Diff line change
@@ -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;