Skip to content

Commit 0de24c0

Browse files
committed
Merge remote-tracking branch 'origin/main' into claude/project-thread-eonc0l
2 parents 3bc338e + 9bf3286 commit 0de24c0

27 files changed

Lines changed: 939 additions & 42 deletions
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@objectstack/driver-sql': patch
3+
---
4+
5+
fix(driver-sql): an Oracle `RAW(16)` uuid column (a `SYS_GUID()` key, or a lookup over one) is now filtered and written by the uuid text it reads back as
6+
7+
Clause-②: yes (widening)
8+
Metadata-protocol: none
9+
10+
The driver already read a `RAW(16)` column as a lowercase hyphenated uuid, but it bound that same text back as a string, which Oracle refuses against `RAW`. So a lookup keyed by a `SYS_GUID()` column displayed correctly and could not be filtered, written, updated or deleted by its value.
11+
12+
The driver now reads, once per federated object, which of its remote columns are `RAW(16)` (`ALL_TAB_COLUMNS`), and binds a comparand, a written value or a by-id key for those columns as `HEXTORAW(?)` over the uuid's 32 hex digits. The column type decides, never the value: a `VARCHAR2` column holding uuids is bound as text, as before. Uuid text is accepted dashed (the read form) or as the 32 digits undashed, in either case. Anything else is refused before the statement is sent: a filter comparand with `INVALID_FILTER` / 400, a written value with `VALIDATION_ERROR` / 400. A failed catalog read changes nothing: values are bound as before and the next read asks again. Other dialects are unchanged.

‎content/docs/permissions/authentication.mdx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,6 +1203,10 @@ the identity provider to it, then revoke the old one; both authenticate until
12031203
you do. Each mint and each revoke writes one `sys_audit_log` row naming the
12041204
administrator and the connection, never the credential.
12051205

1206+
A connection's groups grant permission sets through the same group mappings an
1207+
SSO provider's sign-in uses; see
1208+
[Grant permission sets from IdP groups](/docs/permissions/sso#grant-permission-sets-from-idp-groups).
1209+
12061210
---
12071211

12081212
## Client Integration

‎content/docs/permissions/sso.mdx‎

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,64 @@ before this rule, turn on `allowJit` for that provider.
426426

427427
---
428428

429+
## Grant permission sets from IdP groups
430+
431+
An SSO provider, OIDC or SAML, can decide what its users may do from the groups
432+
the identity provider sends at sign-in. It uses the same group mappings
433+
(`sys_idp_group_mapping`) as a
434+
[SCIM connection](/docs/permissions/authentication#scim-connection-credentials):
435+
one mapping model, two sources.
436+
437+
**Where the groups come from.** Set the provider's own claim mapping to fill
438+
`groups`: `mapping.extraFields.groups` names the OIDC claim or the SAML attribute
439+
that carries the user's groups, for example `extraFields: { groups: 'groups' }`
440+
in `oidcConfig.mapping` (or `samlConfig.mapping`) when the provider is registered
441+
through `POST /api/v1/auth/sso/register`. The **Setup → SSO Providers** form does
442+
not set it. The value may be one string or a list of strings. A provider whose
443+
mapping fills no `groups` signs users in as before.
444+
445+
**Saving a mapping.** A platform administrator saves one mapping per group and
446+
permission set through `POST /api/v1/auth/admin/scim/set-group-mapping`, naming
447+
the provider with `providerId`:
448+
449+
```bash
450+
curl -X POST http://localhost:3000/api/v1/auth/admin/scim/set-group-mapping \
451+
-H 'Content-Type: application/json' -H "Authorization: Bearer $ADMIN_SESSION" \
452+
-d '{ "providerId": "okta", "groupDisplayName": "Sales", "permissionSet": "sales_rep" }'
453+
# → { success, data: { mappingId, created, providerId, permissionSet, organizationId, reprojected: false, … } }
454+
```
455+
456+
- Name the source with exactly one of `connectionId` (a SCIM connection) or
457+
`providerId` (an SSO provider). Name the group with exactly one of
458+
`groupExternalId` (matched against the group's id, such as an Entra ID group
459+
object id) or `groupDisplayName` (matched against its exact name).
460+
- The grant's organization is the provider's own organization. An unknown
461+
provider, or one that belongs to no organization, is refused
462+
`400 VALIDATION_FAILED` on `providerId`. With SSO off the save is refused `503`.
463+
- Only an ordinary permission set inside that organization can be granted. An
464+
administrator set, or any set outside the organization boundary, is refused
465+
`400 VALIDATION_FAILED` on `permissionSet`, and nothing is stored. With no
466+
security service to judge the boundary, the save is refused `503`.
467+
- `POST /api/v1/auth/admin/scim/delete-group-mapping` with `{ "mappingId": "…" }`
468+
removes a mapping, and at once the grants of that set its provider made in
469+
that organization, unless another of the provider's mappings still names the
470+
set.
471+
472+
**At every sign-in.** The user's grants follow the IdP's groups. A mapped group
473+
grants its set in the provider's organization, and a group the user has left
474+
loses its set at their next sign-in. A sign-in with no groups claim removes the
475+
grants that provider made earlier. The boundary is judged again before every
476+
grant. Only grants the provider itself made are ever removed: a grant made by
477+
hand or through SCIM is never touched. A saved mapping applies at each member's
478+
next sign-in, because a provider sends groups only when someone signs in; use
479+
SCIM when a group change must take effect between sign-ins.
480+
481+
**When applying the mappings fails**, the sign-in still succeeds and the failure
482+
is logged at `error`. The user keeps the grants of their previous sign-in until
483+
the next one applies the mappings again.
484+
485+
---
486+
429487
## Verify configuration
430488

431489
Restart the server (`pnpm dev`), then:

‎docs/adr/0011-actions-as-ai-tools.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,10 @@ ships next.
315315
316316
The opt-in binds the platform's `sys_*` actions exactly as it binds an app's: an action reaches an
317317
agent only when it declares `ai: { exposed: true, description }`. The named actions on the twelve
318-
identity objects in `packages/platform-objects/src/identity/` were assessed once, as one set, into
319-
three buckets, and the declarations were written in the same change as this addendum.
318+
identity objects that carried them in `packages/platform-objects/src/identity/` at the 2026-10-30
319+
assessment were assessed once, as one set, into three buckets, and the declarations were written in
320+
the same change as this addendum; the 2026-11-07 amendment below brought in a thirteenth,
321+
`sys_scim_connection_credential`.
320322

321323
| Bucket | Test | What the action declares |
322324
|:--|:--|:--|

‎packages/drivers/driver-sql/src/sql-driver-aggregation.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,26 @@ export interface AggregationHost {
6363
readonly fractionalNumericFields: SqlDriver['fractionalNumericFields'];
6464
getBuilder: SqlDriver['getBuilder'];
6565
readonly isMssql: SqlDriver['isMssql'];
66+
readonly isOracle: SqlDriver['isOracle'];
6667
readonly knex: SqlDriver['knex'];
6768
mapAggregateFunc: SqlDriver['mapAggregateFunc'];
6869
readonly numericFields: SqlDriver['numericFields'];
6970
presentReadColumns: SqlDriver['presentReadColumns'];
7071
primeMssqlGuidColumns: SqlDriver['primeMssqlGuidColumns'];
72+
primeOracleRawUuidColumns: SqlDriver['primeOracleRawUuidColumns'];
7173
readPresentationKind: SqlDriver['readPresentationKind'];
7274
remoteColumn: SqlDriver['remoteColumn'];
7375
}
7476

7577
/** The bodies of the "Aggregation" section of `SqlDriver`: a stateless facet, called by the class's stubs. */
7678
export class AggregationFacet {
7779
/** The body of `SqlDriver#aggregate`; the method's docblock there is its contract. */
78-
static async aggregate(this: Pick<AggregationHost, 'aggregandColumnClassOf' | 'aggregateBackendFault' | 'aliasIdentifierSql' | 'applyFilters' | 'applyTenantScope' | 'buildDateBucketExpr' | 'coercionKey' | 'config' | 'dateGranularityCapabilities' | 'dialectName' | 'foldEmptyAggregateAnswers' | 'getBuilder' | 'isMssql' | 'knex' | 'mapAggregateFunc' | 'presentReadColumns' | 'primeMssqlGuidColumns' | 'readPresentationKind' | 'remoteColumn'>, object: string, query: DriverQuery, options?: DriverOptions): Promise<Record<string, unknown>[]> {
80+
static async aggregate(this: Pick<AggregationHost, 'aggregandColumnClassOf' | 'aggregateBackendFault' | 'aliasIdentifierSql' | 'applyFilters' | 'applyTenantScope' | 'buildDateBucketExpr' | 'coercionKey' | 'config' | 'dateGranularityCapabilities' | 'dialectName' | 'foldEmptyAggregateAnswers' | 'getBuilder' | 'isMssql' | 'isOracle' | 'knex' | 'mapAggregateFunc' | 'presentReadColumns' | 'primeMssqlGuidColumns' | 'primeOracleRawUuidColumns' | 'readPresentationKind' | 'remoteColumn'>, object: string, query: DriverQuery, options?: DriverOptions): Promise<Record<string, unknown>[]> {
7981
// [#31395] SQL Server: which columns are GUIDs, before a text operator compiles.
8082
if (this.isMssql) await this.primeMssqlGuidColumns(object, query.where);
83+
// [#31390] On Oracle a federated object's RAW(16) uuid columns are read from
84+
// the remote catalog before a comparand or a written value is bound.
85+
if (this.isOracle) await this.primeOracleRawUuidColumns(object);
8186
const builder = this.getBuilder(object, options);
8287
// The column a FIELD names in this statement: its `external.columnMap`
8388
// remote column on a federated object, the field itself otherwise. Every

‎packages/drivers/driver-sql/src/sql-driver-bulk-operations.ts‎

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,12 @@ export interface BulkOperationsHost {
5959
injectTenantOnInsert: SqlDriver['injectTenantOnInsert'];
6060
readonly insertReturnsStoredRows: SqlDriver['insertReturnsStoredRows'];
6161
readonly isMssql: SqlDriver['isMssql'];
62+
readonly isOracle: SqlDriver['isOracle'];
6263
keepSuppliedUpdatedAt: SqlDriver['keepSuppliedUpdatedAt'];
6364
readonly knex: SqlDriver['knex'];
65+
oracleUuidBinding: SqlDriver['oracleUuidBinding'];
6466
primeMssqlGuidColumns: SqlDriver['primeMssqlGuidColumns'];
67+
primeOracleRawUuidColumns: SqlDriver['primeOracleRawUuidColumns'];
6568
readBackInsertedRows: SqlDriver['readBackInsertedRows'];
6669
resyncSequenceToDataMax: SqlDriver['resyncSequenceToDataMax'];
6770
remoteColumn: SqlDriver['remoteColumn'];
@@ -79,7 +82,10 @@ export interface BulkOperationsHost {
7982
/** The bodies of the "Bulk & Batch Operations" section of `SqlDriver`: a stateless facet, called by the class's stubs. */
8083
export class BulkOperationsFacet {
8184
/** The body of `SqlDriver#bulkCreate`; the method's docblock there is its contract. */
82-
static async bulkCreate(this: Pick<BulkOperationsHost, 'applyWriteColumnMap' | 'auditMissingTenant' | 'autoNumberCounterKey' | 'collidingAutoNumberReservations' | 'fillAutoNumberFields' | 'formatInput' | 'formatOutput' | 'getBuilder' | 'injectTenantOnInsert' | 'insertReturnsStoredRows' | 'isMssql' | 'readBackInsertedRows' | 'resyncSequenceToDataMax' | 'rotationWriteTarget' | 'stampInsertTimestamps'>, object: string, data: any[], options?: DriverOptions): Promise<Record<string, unknown>[]> {
85+
static async bulkCreate(this: Pick<BulkOperationsHost, 'applyWriteColumnMap' | 'auditMissingTenant' | 'autoNumberCounterKey' | 'collidingAutoNumberReservations' | 'fillAutoNumberFields' | 'formatInput' | 'formatOutput' | 'getBuilder' | 'injectTenantOnInsert' | 'insertReturnsStoredRows' | 'isMssql' | 'isOracle' | 'primeOracleRawUuidColumns' | 'readBackInsertedRows' | 'resyncSequenceToDataMax' | 'rotationWriteTarget' | 'stampInsertTimestamps'>, object: string, data: any[], options?: DriverOptions): Promise<Record<string, unknown>[]> {
86+
// [#31390] On Oracle a federated object's RAW(16) uuid columns are read from
87+
// the remote catalog before a comparand or a written value is bound.
88+
if (this.isOracle) await this.primeOracleRawUuidColumns(object);
8389
// Same client-side id assignment as create() (id/_id normalization,
8490
// nanoid fallback when neither is supplied) — a row missing an id must
8591
// not be silently inserted with a NULL primary key just because the
@@ -262,21 +268,29 @@ export class BulkOperationsFacet {
262268
}
263269

264270
/** The body of `SqlDriver#bulkDelete`; the method's docblock there is its contract. */
265-
static async bulkDelete(this: Pick<BulkOperationsHost, 'applyTenantScope' | 'auditMissingTenant' | 'getBuilder' | 'remoteColumn' | 'rotationShardsOf'>, object: string, ids: Array<string | number>, options?: DriverOptions): Promise<void> {
271+
static async bulkDelete(this: Pick<BulkOperationsHost, 'applyTenantScope' | 'auditMissingTenant' | 'getBuilder' | 'isOracle' | 'oracleUuidBinding' | 'primeOracleRawUuidColumns' | 'remoteColumn' | 'rotationShardsOf'>, object: string, ids: Array<string | number>, options?: DriverOptions): Promise<void> {
272+
// [#31390] On Oracle a federated object's RAW(16) uuid columns are read from
273+
// the remote catalog before a comparand or a written value is bound.
274+
if (this.isOracle) await this.primeOracleRawUuidColumns(object);
266275
this.auditMissingTenant(object, 'bulkDelete', options);
267276
for (const target of this.rotationShardsOf(object) ?? [object]) {
268277
// The primary key's column: the `external.columnMap` remote column on a
269278
// federated object, `id` otherwise (a rotation shard is never federated).
270-
const builder = this.getBuilder(target, options).whereIn(this.remoteColumn(object, 'id', 'id'), ids);
279+
// [#31390] On Oracle a RAW(16) uuid key binds each id as `HEXTORAW(?)`.
280+
const keys = ids.map((id) => this.oracleUuidBinding(object, 'id', id, 'comparand'));
281+
const builder = this.getBuilder(target, options).whereIn(this.remoteColumn(object, 'id', 'id'), keys as any[]);
271282
this.applyTenantScope(builder, object, options);
272283
await builder.delete();
273284
}
274285
}
275286

276287
/** The body of `SqlDriver#updateMany`; the method's docblock there is its contract. */
277-
static async updateMany(this: Pick<BulkOperationsHost, 'applyFilters' | 'applyTenantScope' | 'applyWriteColumnMap' | 'auditMissingTenant' | 'formatInput' | 'getBuilder' | 'isMssql' | 'keepSuppliedUpdatedAt' | 'primeMssqlGuidColumns' | 'rotationShardsOf' | 'stampsUpdatedAt' | 'updateWithPresumedTimestamp' | 'updatedAtStamp' | 'updatedAtStampIsPresumed'>, object: string, query: DriverQuery, data: any, options?: DriverOptions): Promise<number> {
288+
static async updateMany(this: Pick<BulkOperationsHost, 'applyFilters' | 'applyTenantScope' | 'applyWriteColumnMap' | 'auditMissingTenant' | 'formatInput' | 'getBuilder' | 'isMssql' | 'isOracle' | 'keepSuppliedUpdatedAt' | 'primeMssqlGuidColumns' | 'primeOracleRawUuidColumns' | 'rotationShardsOf' | 'stampsUpdatedAt' | 'updateWithPresumedTimestamp' | 'updatedAtStamp' | 'updatedAtStampIsPresumed'>, object: string, query: DriverQuery, data: any, options?: DriverOptions): Promise<number> {
278289
// [#31395] SQL Server: which columns are GUIDs, before a text operator compiles.
279290
if (this.isMssql) await this.primeMssqlGuidColumns(object, query.where);
291+
// [#31390] On Oracle a federated object's RAW(16) uuid columns are read from
292+
// the remote catalog before a comparand or a written value is bound.
293+
if (this.isOracle) await this.primeOracleRawUuidColumns(object);
280294
this.auditMissingTenant(object, 'updateMany', options);
281295

282296
// `data ?? {}` keeps the nullish tolerance this door already had on the
@@ -318,9 +332,12 @@ export class BulkOperationsFacet {
318332
}
319333

320334
/** The body of `SqlDriver#deleteMany`; the method's docblock there is its contract. */
321-
static async deleteMany(this: Pick<BulkOperationsHost, 'applyFilters' | 'applyTenantScope' | 'auditMissingTenant' | 'getBuilder' | 'isMssql' | 'primeMssqlGuidColumns' | 'rotationShardsOf'>, object: string, query: DriverQuery, options?: DriverOptions): Promise<number> {
335+
static async deleteMany(this: Pick<BulkOperationsHost, 'applyFilters' | 'applyTenantScope' | 'auditMissingTenant' | 'getBuilder' | 'isMssql' | 'isOracle' | 'primeMssqlGuidColumns' | 'primeOracleRawUuidColumns' | 'rotationShardsOf'>, object: string, query: DriverQuery, options?: DriverOptions): Promise<number> {
322336
// [#31395] SQL Server: which columns are GUIDs, before a text operator compiles.
323337
if (this.isMssql) await this.primeMssqlGuidColumns(object, query.where);
338+
// [#31390] On Oracle a federated object's RAW(16) uuid columns are read from
339+
// the remote catalog before a comparand or a written value is bound.
340+
if (this.isOracle) await this.primeOracleRawUuidColumns(object);
324341
this.auditMissingTenant(object, 'deleteMany', options);
325342
let total = 0;
326343
for (const target of this.rotationShardsOf(object) ?? [object]) {
@@ -363,9 +380,12 @@ export class BulkOperationsFacet {
363380
}
364381

365382
/** The body of `SqlDriver#count`; the method's docblock there is its contract. */
366-
static async count(this: Pick<BulkOperationsHost, 'applyFilters' | 'applyTenantScope' | 'backendStatementFault' | 'getBuilder' | 'isMssql' | 'primeMssqlGuidColumns' | 'unresolvableFilterColumnRefusal'>, object: string, query?: DriverQuery, options?: DriverOptions): Promise<number> {
383+
static async count(this: Pick<BulkOperationsHost, 'applyFilters' | 'applyTenantScope' | 'backendStatementFault' | 'getBuilder' | 'isMssql' | 'isOracle' | 'primeMssqlGuidColumns' | 'primeOracleRawUuidColumns' | 'unresolvableFilterColumnRefusal'>, object: string, query?: DriverQuery, options?: DriverOptions): Promise<number> {
367384
// [#31395] SQL Server: which columns are GUIDs, before a text operator compiles.
368385
if (this.isMssql) await this.primeMssqlGuidColumns(object, query?.where);
386+
// [#31390] On Oracle a federated object's RAW(16) uuid columns are read from
387+
// the remote catalog before a comparand or a written value is bound.
388+
if (this.isOracle) await this.primeOracleRawUuidColumns(object);
369389
const builder = this.getBuilder(object, options);
370390
this.applyTenantScope(builder, object, options);
371391

‎packages/drivers/driver-sql/src/sql-driver-compile-refusal-seam.test.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,20 @@ const DOORS: readonly Door[] = [
293293
Object.defineProperty(driver, 'isOracle', { get: () => true, configurable: true });
294294
},
295295
},
296+
// ── #31390: a RAW(16) uuid column's comparand must be uuid text ──────────
297+
{
298+
builder: 'assertOracleUuidComparand',
299+
where: () => ({ [POLICY_COL]: SECRET }),
300+
secrets: [POLICY_COL],
301+
klass: 'compares a uuid column with a value that is not a uuid',
302+
// The fixture is SQLite; the refusal reads the dialect and the catalog's
303+
// RAW(16) reading for the object, both set here.
304+
setup: (driver) => {
305+
Object.defineProperty(driver, 'isOracle', { get: () => true, configurable: true });
306+
(driver as unknown as { oracleRawUuidFieldsByObject: Map<string, ReadonlySet<string>> })
307+
.oracleRawUuidFieldsByObject.set('deal', new Set([POLICY_COL]));
308+
},
309+
},
296310
// ── #31327: JSON-array membership on SQL Server, refused rather than guessed ──
297311
{
298312
builder: 'jsonMembershipUnsupportedDialectError',

0 commit comments

Comments
 (0)