Runs live, versioned Python application objects on one VM, with a suite of apps: projects, notes, tasks, files and more.

9 downloads

Install on DigitalOcean Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-object-server.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-object-server.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-object-server.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

Daniel Quellhorst Changelog for this batch. 65ef78d 3 hours, 41 minutes ago History
rules.json · 4.7 KB · 96 lines
1{
2 "rules": [
3 {
4 "effect": "deny",
5 "principal": "owner_fallback",
6 "actions": [
7 "update",
8 "delete"
9 ],
10 "collection": "promotion_redemptions",
11 "reason": "these rows are the redemption count that gates every code; only checkout writes one. No rule grants this; the engine's owner fallback did, to whoever the row's owner key names. This switches the fallback off for these actions only: an explicit grant still grants, and admins and in-process writers are unaffected"
12 },
13 {
14 "effect": "deny",
15 "principal": "owner_fallback",
16 "actions": [
17 "update",
18 "delete"
19 ],
20 "collection": "promotions",
21 "reason": "a promotion somebody may have redeemed is stopped with is_active=false, never deleted; and it is edited by the shop's managers, not by whoever the row names as owner -- a manager who created a code and has since lost the role must not keep editing it through the fallback. No rule grants a registered user either; this switches the engine's owner fallback off for both. The manager grant still grants update; admins and in-process writers are unaffected"
22 },
23 {
24 "effect": "allow",
25 "principal": "role:manager",
26 "actions": [
27 "create",
28 "read",
29 "update"
30 ],
31 "collection": "promotions",
32 "reason": "a discount code is shop configuration that gives money away, so it is written by whoever runs the shop (role:manager, as for pickup slots, invoices and refunds) and read back by them when a customer rings about it. Customers get no grant at all: a code is looked up server side by action_checkout and the public action_check_promotion, which answer only what the shop would print on the offer, so there is nothing a customer needs to list -- and listing is how an unpublished code leaks. No DELETE: a promotion somebody has already redeemed cannot be made not to have existed; the way to stop a code is is_active=false"
33 },
34 {
35 "effect": "allow",
36 "principal": "registered",
37 "actions": [
38 "read"
39 ],
40 "collection": "promotion_redemptions",
41 "row_filter": {
42 "owner_id": "$user_id"
43 },
44 "reason": "the redeeming customer reads their own uses of a code (action_checkout writes the row under the basket's owner), which answers 'why was my code refused?' for them. READ ONLY and only their own: these rows carry the customer's email and order, and nothing but action_checkout may write one"
45 },
46 {
47 "effect": "allow",
48 "principal": "role:manager",
49 "actions": [
50 "read"
51 ],
52 "collection": "promotion_redemptions",
53 "reason": "the shop's managers read every redemption: they are the count that gates every code and the answer when a customer asks why theirs was refused. Read only -- the collection is append storage written by action_checkout alone"
54 },
55 {
56 "effect": "allow",
57 "principal": "public",
58 "actions": [
59 "execute"
60 ],
61 "object_id": "action_check_promotion",
62 "reason": "PUBLIC on the check action only, never on the collection: this shop's default sale is a guest checkout, so the person typing a code has no account and this is the read their basket page needs. What it hands back is bounded to what a shop would print on the offer itself -- whether the code works on this basket, what it takes off, and every reason it does not -- with no owner, no notes, no list of codes to enumerate and no way to redeem anything. The same split app-pickup uses for action_pickup_slots and app-invoices for site_invoice_portal"
63 }
64 ],
65 "retracted": [
66 {
67 "effect": "allow",
68 "principal": "registered",
69 "actions": [
70 "create",
71 "read",
72 "update"
73 ],
74 "collection": "promotions",
75 "reason": "withdrawn in app-promotions 0.2.0: on a shop every customer is a registered user, and this let any of them POST a 100%-off code, raise a live code's value, or list every code including the unpublished ones. Codes are written by role:manager; customers never list them (checkout and action_check_promotion look a code up server side)"
76 },
77 {
78 "effect": "allow",
79 "principal": "registered",
80 "actions": [
81 "read"
82 ],
83 "collection": "promotion_redemptions",
84 "reason": "withdrawn in app-promotions 0.2.0: it let any signed-in user list every redemption -- other customers' emails and order ids. Replaced by an owner-filtered read for the redeeming customer and a read for role:manager"
85 },
86 {
87 "effect": "deny",
88 "principal": "owner_fallback",
89 "actions": [
90 "delete"
91 ],
92 "collection": "promotions",
93 "reason": "replaced in app-promotions 0.2.0 by the same opt-out covering update as well"
94 }
95 ]
96}