Permissions here are per database and per collection, and the most important thing to understand is what they cannot express. A user gets a level on a database - read-write, read-only or none - and can be given a level per collection within it. That is enough for a clean separation of services: an ingest user with read-write on the collections it writes and nothing else, a query service with read-only, a search service with read-only on the view's collections, and administrators separately.
And there is no row or document-level access control. A user who can read a collection can read every document in it. So document-level authorisation is your application's responsibility, and the shapes that work are: a separate database per tenant, which is a real boundary the database enforces; or one database with the filter applied in your application layer, where the boundary is the correctness of your query construction - which means every query path needs the filter and a test proving it. After the previous course, where the engine itself filtered rows, this is a genuine capability difference and worth stating plainly in a design document rather than discovering during a security review. A Foxx microservice running inside the database can centralise the filtering, which helps by reducing the number of places the filter must be right - it does not change who is responsible for it.
The tenant decision therefore has a sharper edge here. A database per tenant gives you enforcement, per-tenant backup and restore, per-tenant deletion, and - usefully on a cluster - a OneShard database per tenant, which solves the traversal problem and the isolation problem with one decision. Its cost is many databases to migrate and monitor. One database with application-level filtering scales to many tenants and puts the whole boundary in your code. For a knowledge graph on a cluster, a OneShard database per tenant is often the strongest answer available, and it is worth evaluating before defaulting to the shared model.
Authentication and TLS are the ordinary disciplines: authentication enabled - which is not the default in every deployment method, so check it rather than assume it; TLS on coordinator endpoints and between cluster members; the root user given a real password and ideally not used by anything; and JWT for cluster-internal communication with its secret managed properly. The web interface deserves specific attention - it is genuinely useful and it is a full administrative surface, so it should not be reachable from anywhere a user could reach it.
Monitoring. ArangoDB exposes Prometheus metrics, and the set that matters: cluster health and shard distribution, including any shard not in sync, which is your warning that a replica has fallen behind and failover would lose data; agency health and leadership changes, since repeated elections mean something is wrong underneath; query latency and the slow query log, which is the single most useful diagnostic here; queries killed by the memory or runtime limit, because a rising count means either an attack or a new query shape; ArangoSearch view commit lag, which is how long until writes are searchable and therefore a user-visible number; transaction counts and aborts; RocksDB metrics, particularly write stalls and compaction backlog; connection counts per coordinator; and disk usage per DB-Server with the growth rate. Plus the ordinary host metrics.
Rolling upgrades have a required order and getting it wrong breaks the cluster. Agents first, one at a time, waiting for the agency to be healthy between each; then DB-Servers, one at a time, waiting for shards to be in sync; then coordinators. The reasoning is that newer agents and DB-Servers tolerate older coordinators, and the reverse is not guaranteed - so the order follows the compatibility direction. Read the release notes for your specific version jump, check the supported upgrade paths because skipping minor versions is not always allowed, and rehearse the whole sequence on a restored copy. A single server is simpler - stop, upgrade, start - and still deserves a backup first.
Cluster sizing, which should come from your measurements rather than a formula. Coordinators scale with query concurrency, are stateless, and three is a reasonable starting point for availability. DB-Servers scale with data volume and with shard count - and remember that numberOfShards was fixed at creation, so your shard count constrains how far you can spread. The agency is three agents, small and critical. Memory is usually the binding constraint, because RocksDB wants block cache and ArangoSearch wants memory for its indexes, and the two compete. Size from your measured working set rather than from your total data.
And the licence, which belongs in the sizing checklist because it belongs in the decision. Recent Community Edition versions ship under a source-available licence rather than a permissive one, with terms varying by version. The features this course has shown to matter most for a graph workload at scale - SmartGraphs, OneShard, hot backups - are Enterprise. So the honest sizing conversation includes: which edition, what the licence for that exact version permits for your use, and what the Enterprise features are worth given your measurements. That is a conversation with legal and procurement, informed by your numbers. Produce the numbers; do not attempt to answer the licence question yourself.
Laboratory exercise 6 - make it defensible.
Enable authentication, configure TLS on coordinators and between members, give root a real password, and restrict the web interface. Then demonstrate what an unauthenticated deployment costs: in an isolated lab network, start one without authentication and read and modify everything from another container.
Build the permission set - ingest, query, search and admin users - and test every denial.
Then demonstrate the row-level gap, because it is the finding people miss: show that a user with read access to a collection can read every document in it including other tenants'. Then implement both mitigations - a database per tenant, and application-level filtering - and test the second one by attempting to bypass it, which means finding a query path where the filter was not applied. Write this up as a design decision with the responsibility stated explicitly.
Configure monitoring with every metric above. Then demonstrate two alerts earning their place: take a shard out of sync and show the alert firing, and run a query that exceeds the memory limit and show that alert firing.
Perform a rolling upgrade on your cluster in the correct order, with the system under load, timing each phase and recording what the application saw. Then do it in the wrong order deliberately on a disposable cluster - coordinators first - and record what broke. That contrast is what makes the runbook credible.
Produce the sizing and cost checklist: coordinators, DB-Servers and agents from your measurements; memory split between RocksDB and ArangoSearch with the evidence; storage with growth rate; backup storage and schedule; the topology decision with its traversal measurement; and the edition and licence question stated as an open item with the numbers that inform it.
Deliverable: the security configuration, the unauthenticated demonstration, the permission set with every denial tested, the row-level gap demonstrated with both mitigations and a bypass attempt, the monitoring with two alerts demonstrated firing, the correct rolling upgrade timed and the wrong-order failure recorded, and the sizing and cost checklist including the licence item.
// ==================================================================
// *** PERMISSIONS ARE PER DATABASE AND PER COLLECTION - AND THE MOST
// *** IMPORTANT THING IS WHAT THEY CANNOT EXPRESS. ***
// ==================================================================
// var users = require("@arangodb/users");
//
// users.save("kg_ingest", "...");
// users.grantDatabase("kg_ingest", "kg", "ro"); // base level
// users.grantCollection("kg_ingest", "kg", "entity", "rw");
// users.grantCollection("kg_ingest", "kg", "employs", "rw");
// users.grantCollection("kg_ingest", "kg", "document", "rw");
// users.grantCollection("kg_ingest", "kg", "audit", "none");
//
// users.save("kg_query", "...");
// users.grantDatabase("kg_query", "kg", "ro"); // READ ONLY
//
// users.save("kg_search", "...");
// users.grantDatabase("kg_search", "kg", "none");
// users.grantCollection("kg_search", "kg", "document", "ro");
// users.grantCollection("kg_search", "kg", "entity", "ro");
//
// users.permission("kg_ingest", "kg", "audit"); // VERIFY
//
// *** TEST EVERY DENIAL: ***
// kg_ingest reading audit -> *** DENIED ***
// kg_query writing anything -> *** DENIED ***
// kg_search reading employs -> *** DENIED ***
// any non-admin creating a collection -> *** DENIED ***
// ==================================================================
// *** AND THERE IS NO ROW OR DOCUMENT-LEVEL ACCESS CONTROL. A USER
// *** WHO CAN READ A COLLECTION CAN READ EVERY DOCUMENT IN IT. ***
// ==================================================================
// *** DEMONSTRATE IT - it is the finding people miss: ***
// as kg_query, scoped to "tenant A" by your application:
FOR e IN entity RETURN e.tenant
// -> *** EVERY TENANT. The engine applied no filter, because there
// is no filter to apply. ***
//
// *** SO DOCUMENT-LEVEL AUTHORISATION IS YOUR APPLICATION'S
// *** RESPONSIBILITY. *** The two shapes that work:
//
// (A) *** A DATABASE PER TENANT *** - a REAL boundary the database
// ENFORCES, plus per-tenant BACKUP, RESTORE and DELETION:
// db._createDatabase("kg_acme", { sharding: "single",
// replicationFactor: 2 });
// *** AND ON A CLUSTER, A ONESHARD DATABASE PER TENANT SOLVES
// *** THE TRAVERSAL PROBLEM AND THE ISOLATION PROBLEM WITH ONE
// *** DECISION *** - which for a knowledge graph is often the
// strongest answer available. COST: many databases to migrate
// and monitor.
//
// (B) ONE DATABASE + THE FILTER IN YOUR APPLICATION LAYER - where
// *** THE BOUNDARY IS THE CORRECTNESS OF YOUR QUERY
// *** CONSTRUCTION ***, so EVERY query path needs the filter
// AND A TEST PROVING IT:
// FOR e IN entity FILTER e.tenant == @tenant ...
// *** THEN TRY TO BYPASS IT: find a query path where the
// *** filter was not applied. *** There usually is one - a
// report, an export, an admin screen, a traversal that starts
// from an identifier the caller supplied.
// A Foxx microservice inside the database can CENTRALISE the
// filtering, which helps by REDUCING THE NUMBER OF PLACES IT
// MUST BE RIGHT. *** IT DOES NOT CHANGE WHO IS RESPONSIBLE. ***
//
// *** AFTER THE PREVIOUS COURSE, WHERE THE ENGINE ITSELF FILTERED
// *** ROWS, THIS IS A GENUINE CAPABILITY DIFFERENCE - STATE IT
// *** PLAINLY IN A DESIGN DOCUMENT RATHER THAN DISCOVERING IT DURING
// *** A SECURITY REVIEW. ***
// ==================================================================
// AUTHENTICATION AND TLS - the ordinary disciplines.
// ==================================================================
// --server.authentication true // *** NOT THE DEFAULT IN EVERY
// // DEPLOYMENT METHOD. CHECK IT
// // RATHER THAN ASSUME IT. ***
// --ssl.keyfile /etc/ssl/arango.pem
// --cluster.require-persisted-id true
// --server.jwt-secret-keyfile /etc/arango/jwt-secret
// root: a REAL password, and ideally USED BY NOTHING.
//
// *** THE WEB INTERFACE DESERVES SPECIFIC ATTENTION: it is GENUINELY
// *** USEFUL AND IT IS A FULL ADMINISTRATIVE SURFACE ***, so it
// should not be reachable from anywhere a user could reach it.
//
// *** DEMONSTRATE WHAT AN UNAUTHENTICATED DEPLOYMENT COSTS *** in an
// ISOLATED lab network: start one with auth off and, from another
// container, read every collection, modify documents, and drop one.
// ==================================================================
// MONITORING: Prometheus metrics, and the set that matters.
// ==================================================================
// GET /_admin/metrics/v2
//
// *** CLUSTER HEALTH AND SHARD DISTRIBUTION *** - and
// *** ANY SHARD NOT IN SYNC ***, which is your warning that A
// REPLICA HAS FALLEN BEHIND AND FAILOVER WOULD LOSE DATA.
// ALERT ON IT. Demonstrate the alert firing.
// *** AGENCY HEALTH AND LEADERSHIP CHANGES *** - REPEATED
// ELECTIONS MEAN SOMETHING IS WRONG UNDERNEATH (usually network
// or disk latency on an agent).
// query latency, and *** THE SLOW QUERY LOG - the single most
// useful diagnostic here: ***
// --query.slow-threshold 3
// require("@arangodb/aql/queries").slow();
// *** QUERIES KILLED BY THE MEMORY OR RUNTIME LIMIT *** - a rising
// count means EITHER AN ATTACK OR A NEW QUERY SHAPE. Both are
// news. Demonstrate this alert too.
// *** ARANGOSEARCH VIEW COMMIT LAG *** - how long until writes are
// searchable, and therefore *** A USER-VISIBLE NUMBER ***, not
// an internal one.
// transaction counts and ABORTS
// RocksDB: *** WRITE STALLS *** and COMPACTION BACKLOG
// connections per coordinator
// disk per DB-Server, *** WITH THE GROWTH RATE *** (the input to
// the cost model)
// ==================================================================
// *** ROLLING UPGRADES HAVE A REQUIRED ORDER, AND GETTING IT WRONG
// *** BREAKS THE CLUSTER. ***
// ==================================================================
// *** 1. AGENTS, one at a time, waiting for the agency to be
// *** HEALTHY between each
// 2. DB-SERVERS, one at a time, waiting for SHARDS IN SYNC
// 3. COORDINATORS ***
//
// THE REASONING: *** NEWER AGENTS AND DB-SERVERS TOLERATE OLDER
// *** COORDINATORS, AND THE REVERSE IS NOT GUARANTEED *** - so the
// order FOLLOWS THE COMPATIBILITY DIRECTION, which is why it is not
// arbitrary and why it is worth remembering rather than looking up.
//
// *** DO IT WRONG DELIBERATELY ON A DISPOSABLE CLUSTER ***
// (coordinators first) and record what broke. *** THAT CONTRAST IS
// WHAT MAKES THE RUNBOOK CREDIBLE. ***
//
// * READ THE RELEASE NOTES FOR YOUR SPECIFIC VERSION JUMP.
// * *** CHECK THE SUPPORTED UPGRADE PATHS - SKIPPING MINOR
// *** VERSIONS IS NOT ALWAYS ALLOWED. ***
// * *** REHEARSE THE WHOLE SEQUENCE ON A RESTORED COPY. ***
// * a SINGLE SERVER is simpler - stop, upgrade, start - and still
// deserves A BACKUP FIRST.
// ==================================================================
// CLUSTER SIZING - from YOUR MEASUREMENTS, not a formula.
// ==================================================================
// COORDINATORS scale with QUERY CONCURRENCY. Stateless. 3 is a
// reasonable start for availability.
// DB-SERVERS scale with DATA VOLUME and SHARD COUNT - and
// *** numberOfShards WAS FIXED AT CREATION, so your
// *** SHARD COUNT CONSTRAINS HOW FAR YOU CAN
// *** SPREAD. ***
// AGENTS 3. Small, critical.
// *** MEMORY IS USUALLY THE BINDING CONSTRAINT ***, because
// RocksDB wants BLOCK CACHE and ArangoSearch wants memory for
// ITS INDEXES, *** AND THE TWO COMPETE. *** Size from your
// MEASURED WORKING SET, not your total data:
// --rocksdb.block-cache-size ______ (measured)
// ArangoSearch index memory ______ (measured)
// headroom for query memoryLimit x concurrency ______
// ==================================================================
// *** AND THE LICENCE, WHICH BELONGS IN THE SIZING CHECKLIST BECAUSE
// *** IT BELONGS IN THE DECISION. ***
// ==================================================================
// Recent Community Edition versions ship under a *** SOURCE-AVAILABLE
// *** LICENCE RATHER THAN A PERMISSIVE ONE, with terms VARYING BY
// *** VERSION. ***
//
// And the features this course has shown to matter most for a graph
// workload at scale are *** ENTERPRISE: ***
// *** SMARTGRAPHS *** (co-located traversal)
// *** ONESHARD *** (local traversal and transactions)
// *** HOT BACKUPS *** (consistent cluster backup)
//
// *** SO THE HONEST SIZING CONVERSATION INCLUDES: WHICH EDITION,
// *** WHAT THE LICENCE FOR THAT EXACT VERSION PERMITS FOR YOUR USE,
// *** AND WHAT THE ENTERPRISE FEATURES ARE WORTH GIVEN YOUR
// *** MEASUREMENTS. ***
//
// That is a conversation with LEGAL AND PROCUREMENT, INFORMED BY
// YOUR NUMBERS. *** PRODUCE THE NUMBERS; DO NOT ATTEMPT TO ANSWER
// THE LICENCE QUESTION YOURSELF. *** Record it in the checklist as
// an OPEN ITEM WITH AN OWNER AND A DATE, which is what turns it from
// a vague worry into a tracked decision:
// edition / licence review OPEN - owner ______ , due ______
// version deployed ______
// traversal measurement single ___ ms / cluster ___ ms
// -> *** what SmartGraphs or OneShard would be worth: ______ ***
Open this example in the editor and change it. Nothing you type is saved.
Discussion
No questions on this topic yet. Sign in to ask the first one.