Repository navigation
Expand file tree
/
Copy pathhooks-security-seeds-datasources.json
More file actions
95 lines (95 loc) · 6.83 KB
/
Copy pathhooks-security-seeds-datasources.json
File metadata and controls
95 lines (95 loc) · 6.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
{
"skill_name": "objectstack-data",
"evals": [
{
"id": 1,
"prompt": "Support agents want to search tasks by their project's name.",
"expected_output": "A stored `text` mirror `project_name` on `task`, in `searchableFields: ['name', 'project_name']`; a `beforeInsert` / `beforeUpdate` hook on `task` stamps it, an `afterUpdate` hook on `project` re-stamps it on rename; rows written outside hooks get a backfill.",
"files": [],
"assertions": {
"must_contain": ["searchableFields", "project_name", "beforeInsert", "afterUpdate"],
"must_not_contain": ["'project_id.name'", "type: 'formula'"]
}
},
{
"id": 2,
"prompt": "Sales reps see only their own leads, sales managers their unit and everything below it; every signed-in user reads the `product` catalog.",
"expected_output": "`lead` is `sharingModel: 'private'`; the rep grant carries `readScope: 'own'`, the manager grant `readScope: 'unit_and_below'` (`@objectstack/security-enterprise` + `requires: ['hierarchy-security']`, else fails closed to `own`); `product` is `sharingModel: 'public_read'`.",
"files": [],
"assertions": {
"must_contain": ["sharingModel: 'private'", "readScope", "unit_and_below", "public_read", "hierarchy-security"],
"must_not_contain": ["permissions: {"]
}
},
{
"id": 3,
"prompt": "Expose the `customers` table of our Postgres reporting database as a read-only `legacy_customer` object.",
"expected_output": "A `defineDatasource` entry (say `reporting`) with `schemaMode: 'external'` (the remote schema stays unaltered) and no credential in the declaration: the password is read at connect from `OS_DATASOURCE_REPORTING_PASSWORD` (the name upper-cased) while the host switch `OS_DATASOURCE_ENV_CREDENTIALS` is `on` (`os serve`/`start`/`dev` default it on); the object sets `datasource: 'reporting'` and `external: { remoteName: 'customers', columnMap }`; the write gate stays closed (no `allowWrites`, no `writable`).",
"files": [],
"assertions": {
"must_contain": ["defineDatasource", "datasource", "remoteName", "columnMap", "schemaMode", "OS_DATASOURCE_ENV_CREDENTIALS", "_PASSWORD"],
"must_not_contain": ["columnName:"]
}
},
{
"id": 4,
"prompt": "Seed the `country` table for every environment; add demo `opportunity` rows (dev/test only) closing 45 days after install, owned by the installer. A nightly job advances `stage`; a seed replay must not reset it.",
"expected_output": "`defineSeed(Country, { externalId: 'code', mode: 'upsert', records })` for reference data; `defineSeed(Opportunity, { env: ['dev', 'test'], ... })` for demo rows — natural-key lookups, CEL values (`close_date: cel`daysFromNow(45)``, `owner_id: cel`os.user.id``), parents first; `columns: { stage: { applyOn: 'create' } }` so an `upsert` replay leaves the job-owned column.",
"files": [],
"assertions": {
"must_contain": ["defineSeed", "externalId", "upsert", "env:", "daysFromNow", "applyOn: 'create'"],
"must_not_contain": ["new Date(", "defineDataset", "externalId: 'id'"]
}
},
{
"id": 5,
"prompt": "Finance may edit a contract's legal terms (`governing_law`, `liability_cap`) while it is a draft, not once approved, signing or active; legal still edits them.",
"expected_output": "Row-conditioned field permission entries on the finance set — `'clm_contract.governing_law': { readable: true, editable: false, when: \"status in ['approved', 'signing', 'active']\" }`, likewise `liability_cap`; legal keeps its edit grant.",
"files": [],
"assertions": {
"must_contain": ["when:", "editable: false", "readable: true", "clm_contract.governing_law"],
"must_not_contain": ["validations:", "readonlyWhen"]
}
},
{
"id": 6,
"prompt": "Portal users may read only the orders of the accounts they belong to, never another account's.",
"expected_output": "On the roster object `account_member` (`user` + `account` lookup): `membershipKeys: { portal_account_ids: { userField: 'user', valueField: 'account' } }`; a portal permission set reads it (`using: 'account in current_user.portal_account_ids'`), a position names it in `permissionSets`, portal staff join on the `external` tier outside the `everyone` baseline. No policy per account, no owner stamp per order.",
"files": [],
"assertions": {
"must_contain": ["membershipKeys", "current_user.portal_account_ids", "userField", "valueField", "permissionSets", "external"],
"must_not_contain": ["permissions: {"]
}
},
{
"id": 7,
"prompt": "We serve English and Chinese users. An `order` whose `amount` exceeds its account's `credit_limit` must not save; API clients branch on `CREDIT_LIMIT`, a zh-CN rep reads `超出账户信用额度`.",
"expected_output": "A `beforeInsert` / `beforeUpdate` hook on `order` declares `refusals: { CREDIT_LIMIT: { message: 'Over the account credit limit.' } }`; its sandboxed `body: { language: 'js', source }` reads the account via `ctx.api` and refuses by code only (`throw Object.assign(new Error(), { code: 'CREDIT_LIMIT' })`); the zh-CN bundle's `hooks: { <hook>: { refusals: { CREDIT_LIMIT: { message: '超出账户信用额度' } } } }` is served in the caller's locale; a catalogue on a hook without a `js` body is refused at save.",
"files": [],
"assertions": {
"must_contain": ["refusals:", "CREDIT_LIMIT: {", "code: 'CREDIT_LIMIT'", "language: 'js'", "hooks: {", "超出账户信用额度"],
"must_not_contain": ["new Error('", "handler:"]
}
},
{
"id": 8,
"prompt": "Web-form leads arrive ownerless; inside sales holds them until a rep takes one, and two reps must never own the same lead.",
"expected_output": "`queues: [defineQueue({ name: 'inside_sales', label: 'Inside Sales', members: [{ type: 'position', value: 'inside_sales_rep' }] })]` and an `assignmentRules` entry `assignTo: { type: 'queue', value: 'inside_sales' }` with no `strategy` park each lead in the injected `queue` column; a rep claims by an ordinary by-id `{ owner_id: <self> }` update, the loser gets `409 CONCURRENT_UPDATE`.",
"files": [],
"assertions": {
"must_contain": ["defineQueue", "type: 'position'", "type: 'queue'", "CONCURRENT_UPDATE"],
"must_not_contain": ["assigned_to", "beforeInsert"]
}
},
{
"id": 9,
"prompt": "A `vendor` list view of the rows whose `api_key` (a `secret` field) starts with `sk_live`.",
"expected_output": "Redirects: a credential is filtered only by presence, `filter: [{ field: 'api_key', operator: 'is_not_null' }]`; any other filter or sort is `400 INVALID_FIELD`.",
"files": [],
"assertions": {
"must_contain": ["INVALID_FIELD", "is_not_null"],
"must_not_contain": ["starts_with"]
}
}
]
}