11// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
22//
33// [#27884] A datasource definition is served only to datasource
4- // administrators, whichever door reads it. The metadata read door
5- // (`GET /api/v1/meta/datasource`) already admits only holders of the
6- // datasource family's read capability; the stored row the definition lives in
7- // is also a record of the stored-metadata table, and the generic data door must
8- // admit the same callers to it. Pinned at the REST doors of a booted stack,
9- // with the platform's own security composition:
4+ // administrators, at every exit that serves it: the stored row the definition
5+ // lives in admits the same callers the metadata read door
6+ // (`GET /api/v1/meta/datasource`) admits. Pinned at the REST doors of a booted
7+ // stack, with the platform's own security composition:
108//
11- // - the platform administrator reads the row whole through the data door,
12- // connection configuration and `external.credentialsRef` included;
13- // - the shipped organization-administrator set (below datasource
14- // administration) and a plain member are served no row: the list and the
15- // query answer none, a get of the row's id answers 404, and the metadata
16- // door refuses them as before;
17- // - parity: for each caller, the data door serves the row exactly when the
9+ // - the platform administrator reads the row whole;
10+ // - a caller below datasource administration and a plain member are served
11+ // no row, and the metadata door refuses them as before;
12+ // - parity: for each caller, the stored row is served exactly when the
1813// metadata door serves the definition.
1914
2015import { describe , it , expect , beforeAll , afterAll } from 'vitest' ;
@@ -92,7 +87,7 @@ describe('[#27884] the stored row of a datasource definition admits only datasou
9287 await stack ?. stop ( ) ;
9388 } ) ;
9489
95- it ( 'the platform administrator reads the row whole: connection configuration and credentialsRef ' , async ( ) => {
90+ it ( 'the platform administrator reads the row whole' , async ( ) => {
9691 const list = await call ( tokens . admin , 'GET' , `/data/sys_metadata?type=datasource&name=${ DS } &fields=name,type,metadata` ) ;
9792 expect ( list . status , list . text ) . toBe ( 200 ) ;
9893 const [ row ] = listRows ( list ) ;
@@ -104,7 +99,7 @@ describe('[#27884] the stored row of a datasource definition admits only datasou
10499 } ) ;
105100
106101 for ( const who of [ 'orgAdmin' , 'member' ] as const ) {
107- it ( `${ who === 'orgAdmin' ? 'the built-in organization administrator ' : 'a plain member' } is served no row through any data-door read ` , async ( ) => {
102+ it ( `${ who === 'orgAdmin' ? 'a caller below datasource administration ' : 'a plain member' } is served no row` , async ( ) => {
108103 const token = tokens [ who ] ;
109104 const list = await call ( token , 'GET' , `/data/sys_metadata?type=datasource&fields=name,type,metadata` ) ;
110105 // 403 (the object is not readable at all) or 200 with no datasource row.
@@ -124,7 +119,7 @@ describe('[#27884] the stored row of a datasource definition admits only datasou
124119 } ) ;
125120 }
126121
127- it ( 'parity: each caller is served the row by the data door exactly when the metadata door serves the definition' , async ( ) => {
122+ it ( 'parity: each caller is served the stored row exactly when the metadata door serves the definition' , async ( ) => {
128123 for ( const who of [ 'admin' , 'orgAdmin' , 'member' ] as const ) {
129124 const meta = await call ( tokens [ who ] , 'GET' , `/meta/datasource/${ DS } ` ) ;
130125 const data = await call ( tokens [ who ] , 'GET' , `/data/sys_metadata/${ encodeURIComponent ( rowId ) } ` ) ;
0 commit comments