@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.
- package/.env.example +136 -0
- package/CHANGELOG.md +296 -0
- package/CHARTER.md +125 -0
- package/LICENSE +22 -0
- package/README.md +783 -2
- package/docs/AUTHORSHIP.md +26 -0
- package/docs/BENCHMARKS.md +261 -0
- package/docs/BOOTSTRAP.md +127 -0
- package/docs/BOTS.md +79 -0
- package/docs/COVERAGE.md +64 -0
- package/docs/DEPLOY.md +246 -0
- package/docs/DISCIPLINES.md +29 -0
- package/docs/GUARDRAILS-AND-MONORAILS.md +107 -0
- package/docs/GUIDED-SETUP.md +296 -0
- package/docs/PERMISSIONS.md +118 -0
- package/docs/ROADMAP.md +59 -0
- package/docs/SETUP.md +259 -0
- package/guides/NEURODIVERGENT_SUPPORT.md +278 -0
- package/package.json +70 -4
- package/server.json +39 -0
- package/src/aleph.js +395 -0
- package/src/annotations.js +135 -0
- package/src/approve-throttle.js +54 -0
- package/src/atlas-role.js +58 -0
- package/src/conformance.js +688 -0
- package/src/content_analyzer.js +450 -0
- package/src/database.js +811 -0
- package/src/disciplines.js +26 -0
- package/src/dispatch.js +279 -0
- package/src/env.js +52 -0
- package/src/floor.js +187 -0
- package/src/gaps.js +476 -0
- package/src/guides.js +48 -0
- package/src/http-remote.js +269 -0
- package/src/index.js +390 -0
- package/src/invites.js +167 -0
- package/src/layers.js +449 -0
- package/src/lessons-to-checks.js +366 -0
- package/src/logger.js +299 -0
- package/src/metadata.js +61 -0
- package/src/module-path.js +32 -0
- package/src/mongo-connect.js +48 -0
- package/src/named-items.js +208 -0
- package/src/oauth-provider.js +838 -0
- package/src/persons.js +116 -0
- package/src/provenance.js +257 -0
- package/src/redact.js +231 -0
- package/src/request-log.js +124 -0
- package/src/scopes.js +97 -0
- package/src/security-headers.js +26 -0
- package/src/session-graph.js +945 -0
- package/src/session.js +1097 -0
- package/src/setup.js +1313 -0
- package/src/startup-pages.js +354 -0
- package/src/startup-payload.js +126 -0
- package/src/tools.js +4271 -0
- package/src/transcript-session.js +106 -0
- package/src/validation.js +1163 -0
- package/src/version.js +2 -0
- package/templates/BOARD.md +72 -0
- package/templates/BOTHANDOFF.md +57 -0
- package/templates/CHARACTER.md +30 -0
- package/templates/HANDOFF.md +63 -0
- package/templates/IDENTITY.md +29 -0
- package/templates/INDEX.md +82 -0
- package/templates/INSTALL.md +29 -0
- package/templates/PROCEDURE.md +39 -0
- package/templates/ROSTER.md +43 -0
- package/templates/SEED.md +65 -0
- package/templates/STAGING.md +37 -0
- package/templates/STANDARD.md +99 -0
- package/templates/THREAD.md +43 -0
- 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 };
|