@dreamforgestudiollc/emet 0.0.0-stage → 0.2.4

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.
Files changed (73) hide show
  1. package/.env.example +136 -0
  2. package/CHANGELOG.md +296 -0
  3. package/CHARTER.md +125 -0
  4. package/LICENSE +22 -0
  5. package/README.md +783 -2
  6. package/docs/AUTHORSHIP.md +26 -0
  7. package/docs/BENCHMARKS.md +261 -0
  8. package/docs/BOOTSTRAP.md +127 -0
  9. package/docs/BOTS.md +79 -0
  10. package/docs/COVERAGE.md +64 -0
  11. package/docs/DEPLOY.md +246 -0
  12. package/docs/DISCIPLINES.md +29 -0
  13. package/docs/GUARDRAILS-AND-MONORAILS.md +107 -0
  14. package/docs/GUIDED-SETUP.md +296 -0
  15. package/docs/PERMISSIONS.md +118 -0
  16. package/docs/ROADMAP.md +59 -0
  17. package/docs/SETUP.md +259 -0
  18. package/guides/NEURODIVERGENT_SUPPORT.md +278 -0
  19. package/package.json +70 -4
  20. package/server.json +39 -0
  21. package/src/aleph.js +395 -0
  22. package/src/annotations.js +135 -0
  23. package/src/approve-throttle.js +54 -0
  24. package/src/atlas-role.js +58 -0
  25. package/src/conformance.js +688 -0
  26. package/src/content_analyzer.js +450 -0
  27. package/src/database.js +811 -0
  28. package/src/disciplines.js +26 -0
  29. package/src/dispatch.js +279 -0
  30. package/src/env.js +52 -0
  31. package/src/floor.js +187 -0
  32. package/src/gaps.js +476 -0
  33. package/src/guides.js +48 -0
  34. package/src/http-remote.js +269 -0
  35. package/src/index.js +390 -0
  36. package/src/invites.js +167 -0
  37. package/src/layers.js +449 -0
  38. package/src/lessons-to-checks.js +366 -0
  39. package/src/logger.js +299 -0
  40. package/src/metadata.js +61 -0
  41. package/src/module-path.js +32 -0
  42. package/src/mongo-connect.js +48 -0
  43. package/src/named-items.js +208 -0
  44. package/src/oauth-provider.js +838 -0
  45. package/src/persons.js +116 -0
  46. package/src/provenance.js +257 -0
  47. package/src/redact.js +231 -0
  48. package/src/request-log.js +124 -0
  49. package/src/scopes.js +97 -0
  50. package/src/security-headers.js +26 -0
  51. package/src/session-graph.js +945 -0
  52. package/src/session.js +1097 -0
  53. package/src/setup.js +1313 -0
  54. package/src/startup-pages.js +354 -0
  55. package/src/startup-payload.js +126 -0
  56. package/src/tools.js +4271 -0
  57. package/src/transcript-session.js +106 -0
  58. package/src/validation.js +1163 -0
  59. package/src/version.js +2 -0
  60. package/templates/BOARD.md +72 -0
  61. package/templates/BOTHANDOFF.md +57 -0
  62. package/templates/CHARACTER.md +30 -0
  63. package/templates/HANDOFF.md +63 -0
  64. package/templates/IDENTITY.md +29 -0
  65. package/templates/INDEX.md +82 -0
  66. package/templates/INSTALL.md +29 -0
  67. package/templates/PROCEDURE.md +39 -0
  68. package/templates/ROSTER.md +43 -0
  69. package/templates/SEED.md +65 -0
  70. package/templates/STAGING.md +37 -0
  71. package/templates/STANDARD.md +99 -0
  72. package/templates/THREAD.md +43 -0
  73. package/templates/USER.md +29 -0
@@ -0,0 +1,58 @@
1
+ /**
2
+ * EMET - the least-privilege MongoDB Atlas role for the server's own login
3
+ * (2026-09-29; security audit question 9).
4
+ *
5
+ * The record is retained, never deleted (the owner's rule, 2026-09-08). Until
6
+ * this role existed that rule lived only in the code: the server's login held
7
+ * readWrite on its database, so the database itself would have allowed any
8
+ * holder of the connection string to remove documents or drop collections.
9
+ *
10
+ * This is the one statement of what the server may do. scripts/atlas-role.mjs
11
+ * builds the Atlas CLI commands from it, docs/ATLAS.md explains it, and
12
+ * tests/atlas-role.test.js fails if the code ever deletes from a collection
13
+ * this role does not allow - so a new delete forces a visible decision here
14
+ * rather than a silent breakage in production.
15
+ *
16
+ * Deletes EMET performs, read from src/ on 2026-09-29, and why each is allowed:
17
+ * - emet_oauth_tokens: revoking a sign-in token (oauth-provider.js). Tokens
18
+ * are credentials, not the record.
19
+ * - _emet_verify: the status probe writes one document, reads it back, and
20
+ * deletes that document (setup.js verifyConnection). The collection stays.
21
+ * Everything else - memory layers, documents, their history, transcripts - is
22
+ * find / insert / update only.
23
+ */
24
+
25
+ export const ATLAS_ROLE_NAME = 'emetRecordKeeper';
26
+
27
+ /** Actions on the whole EMET database (Atlas action names). No REMOVE, no DROP. */
28
+ export const DATABASE_ACTIONS = Object.freeze([
29
+ 'FIND', 'INSERT', 'UPDATE',
30
+ 'CREATE_COLLECTION', 'CREATE_INDEX',
31
+ 'LIST_COLLECTIONS', 'LIST_INDEXES', 'COLL_STATS', 'DB_STATS',
32
+ // Added 2026-09-29 after the first apply: without it emet_status cannot name
33
+ // the vector index (search itself needs only FIND and kept working).
34
+ 'LIST_SEARCH_INDEXES'
35
+ ]);
36
+
37
+ /**
38
+ * The only collections the server may delete from, and what it may do there.
39
+ * `{prefix}` is the install's EMET_COLLECTION_PREFIX (default `emet_`): the
40
+ * OAuth store is prefixed, the probe collection is not.
41
+ */
42
+ export const DELETE_ALLOWED = Object.freeze({
43
+ '{prefix}oauth_tokens': Object.freeze(['REMOVE']),
44
+ _emet_verify: Object.freeze(['REMOVE'])
45
+ });
46
+
47
+ /** Privileges in the Atlas CLI form ACTION@db or ACTION@db.collection. */
48
+ export function atlasPrivileges(dbName, prefix = 'emet_') {
49
+ if (!dbName || typeof dbName !== 'string' || /[\s@.]/.test(dbName)) throw new Error('database name must be a plain name');
50
+ if (typeof prefix !== 'string' || /[\s@.]/.test(prefix)) throw new Error('prefix must be a plain name');
51
+ const out = DATABASE_ACTIONS.map((a) => `${a}@${dbName}`);
52
+ for (const [col, actions] of Object.entries(DELETE_ALLOWED)) {
53
+ for (const a of actions) out.push(`${a}@${dbName}.${col.replace('{prefix}', prefix)}`);
54
+ }
55
+ return out;
56
+ }
57
+
58
+ export default { ATLAS_ROLE_NAME, DATABASE_ACTIONS, DELETE_ALLOWED, atlasPrivileges };