kryptheon 0.1.56 → 0.1.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -5
- package/kryptheon-api.js +607 -13
- package/kryptheon-authz.js +1 -0
- package/kryptheon-code.js +60 -5
- package/kryptheon-csv.js +153 -0
- package/kryptheon-map.js +189 -9
- package/kryptheon-roles.js +152 -28
- package/kryptheon-webhook.js +407 -0
- package/package.json +8 -4
package/README.md
CHANGED
|
@@ -305,11 +305,51 @@ anything it could not put back.
|
|
|
305
305
|
- **Across organizations and without a session:** each account is aimed at the
|
|
306
306
|
other organizations' records (found in the app's own lists), and every route
|
|
307
307
|
is tried with no session at all. Judged from what comes back and from what the
|
|
308
|
-
app holds before and after, never from a status code alone.
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
308
|
+
app holds before and after, never from a status code alone. A write to a
|
|
309
|
+
record's own address (a note on `/returns/5/notes`) is read back at that
|
|
310
|
+
address as the record's organization. Needs two accounts.
|
|
311
|
+
- **Who is calling, as the request says:** when the sign-in check takes the user
|
|
312
|
+
id itself from a cookie or a header (`uid=7`, `x-user-id: 7`) instead of a
|
|
313
|
+
session the server signed, Kryptheon asks the "who am I" route with nobody
|
|
314
|
+
signed in, carrying another account's id there. Answered as that person is a
|
|
315
|
+
confirmed problem: anyone can be anyone.
|
|
316
|
+
- **A webhook your app signs itself:** when a payment webhook is checked with an
|
|
317
|
+
HMAC your own code computes (`createHmac('sha256', process.env.SECRET)` over the
|
|
318
|
+
body, the signature in a header), Kryptheon reads how, takes the secret from
|
|
319
|
+
your `.env`, and sends events it makes itself - no real payment needed. First a
|
|
320
|
+
correctly signed one (if your app refuses even that, nothing else is sent), then
|
|
321
|
+
one with no signature, one with a wrong signature, a signed one for the wrong
|
|
322
|
+
amount, and a signed refund for a record nobody had paid. Each is judged from
|
|
323
|
+
your app's own list of those records before and after: an event with no
|
|
324
|
+
signature that changed a record is a confirmed problem. The secret is never
|
|
325
|
+
printed or saved. A signature made from more than the body (a timestamp in
|
|
326
|
+
front, a prefix) is said as not tried. A provider's own signed webhook still
|
|
327
|
+
goes through `npx kryptheon payments`. The first correctly signed event is
|
|
328
|
+
also sent a second time, unchanged; changing the record again is a confirmed
|
|
329
|
+
problem - a provider resends events whenever it is not sure.
|
|
330
|
+
- **Exports:** for a CSV export (a GET ending in `.csv`, or under `/export`),
|
|
331
|
+
a record is made through your own create route with its text fields set to a
|
|
332
|
+
marked value starting with `=`, and the file is downloaded. A cell written as
|
|
333
|
+
typed is a confirmed problem - Excel and Google Sheets run it as a formula; a
|
|
334
|
+
cell with a quote in front is held.
|
|
335
|
+
- **Jobs:** a route that runs a job (`/jobs/...`, `/cron`, `/notify...`) is run
|
|
336
|
+
twice in a row. If its answer counts the same non-zero number both times
|
|
337
|
+
(`created: 11`, then `created: 11`), it is a thing to check: the job may make
|
|
338
|
+
the same reminders or records every time it runs.
|
|
339
|
+
- **Changes that are kept:** a change route that is also read at the same
|
|
340
|
+
address (`PATCH /api/settings` and `GET /api/settings`) gets one plain text
|
|
341
|
+
field changed - never a role, a status, an organization or money - by an
|
|
342
|
+
account it lets in, then read back. Answered as done but still the old value
|
|
343
|
+
is a problem; a change that was kept is put back.
|
|
344
|
+
- **Bad values:** for each route that creates something, one field at a time
|
|
345
|
+
gets a value that should be turned away - text for a number and 3000
|
|
346
|
+
characters for a field the code never checks, a blank name or a negative
|
|
347
|
+
number for the rest - on top of a request that is otherwise taken. The app's
|
|
348
|
+
own list says whether it was kept. A value kept is a thing to check (a
|
|
349
|
+
confirmed problem when the code itself claims to check that field); a server
|
|
350
|
+
error is a smaller one. If the app stops answering altogether after a request,
|
|
351
|
+
that is a confirmed problem with the request that did it, and nothing more is
|
|
352
|
+
sent.
|
|
313
353
|
- **Who may do what:** with `--roles` and your `permissions-policy.json`, each
|
|
314
354
|
account also tries what its role may not do. `npx kryptheon api --draft`
|
|
315
355
|
writes `permissions-policy.draft.json`, a guess from your code that the roles
|