fix(doc0): call DOC0 as the granted service actor
CI (SIAX Cloud) / sonar (pull_request) Skipped
CI (SIAX Cloud) / integration (push) Skipped
CI (SIAX Cloud) / sonar (push) Skipped
masterplan-lock / check (pull_request) Successful in 3s
CI (SIAX Cloud) / security (push) Successful in 15s
Security Scan (SIAX Cloud) / security (push) Successful in 15s
Security Scan (SIAX Cloud) / security (pull_request) Successful in 15s
CI (SIAX Cloud) / security (pull_request) Successful in 1m2s
CI (SIAX Cloud) / integration (pull_request) Successful in 1m11s
masterplan-lock / check (push) Successful in 1m38s
CI (SIAX Cloud) / quality (push) Successful in 1m49s
CI (SIAX Cloud) / quality (pull_request) Successful in 1m50s
CI (SIAX Cloud) / sonar (pull_request) Skipped
CI (SIAX Cloud) / integration (push) Skipped
CI (SIAX Cloud) / sonar (push) Skipped
masterplan-lock / check (pull_request) Successful in 3s
CI (SIAX Cloud) / security (push) Successful in 15s
Security Scan (SIAX Cloud) / security (push) Successful in 15s
Security Scan (SIAX Cloud) / security (pull_request) Successful in 15s
CI (SIAX Cloud) / security (pull_request) Successful in 1m2s
CI (SIAX Cloud) / integration (pull_request) Successful in 1m11s
masterplan-lock / check (push) Successful in 1m38s
CI (SIAX Cloud) / quality (push) Successful in 1m49s
CI (SIAX Cloud) / quality (pull_request) Successful in 1m50s
DOC0 denies an x-actor-id that the service identity has no actor_grant for, so every upload/structure call from 0pt failed with DOC0_ACCESS_DENIED and became outcome_unknown. The journal and project authorization keep the verified end-user actor; only the DOC0 request acts as the service (DOC0_SERVICE_ACTOR_ID).
This commit is contained in:
@@ -216,6 +216,10 @@ NOCODB_API_TOKEN=
|
|||||||
# DOC0 document service. URL must be absolute HTTPS; token is a service PAT.
|
# DOC0 document service. URL must be absolute HTTPS; token is a service PAT.
|
||||||
DOC0_URL=https://doc0.siax.io
|
DOC0_URL=https://doc0.siax.io
|
||||||
DOC0_SERVICE_TOKEN=
|
DOC0_SERVICE_TOKEN=
|
||||||
|
# The DOC0 service identity's own actor id (token subject). DOC0 rejects an
|
||||||
|
# x-actor-id it has no actor_grant for; 0pt keeps the end-user actor in its own
|
||||||
|
# journal and lets the DOC0 call act as the service.
|
||||||
|
DOC0_SERVICE_ACTOR_ID=
|
||||||
# Maximum accepted upload size (bytes). Default 25 MiB.
|
# Maximum accepted upload size (bytes). Default 25 MiB.
|
||||||
OPT_MAX_UPLOAD_BYTES=26214400
|
OPT_MAX_UPLOAD_BYTES=26214400
|
||||||
|
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ export async function POST(request: NextRequest) {
|
|||||||
}).read({
|
}).read({
|
||||||
tenantId,
|
tenantId,
|
||||||
projectId,
|
projectId,
|
||||||
actorId,
|
actorId: runtimeConfig.doc0.actorId ?? actorId,
|
||||||
requestId: correlationId,
|
requestId: correlationId,
|
||||||
receipt: {
|
receipt: {
|
||||||
documentId,
|
documentId,
|
||||||
|
|||||||
@@ -163,13 +163,22 @@ export async function POST(request: NextRequest) {
|
|||||||
|
|
||||||
const authorize = createProjectAuthorizer();
|
const authorize = createProjectAuthorizer();
|
||||||
const sql = getRepositorySql(databaseUrl);
|
const sql = getRepositorySql(databaseUrl);
|
||||||
|
// DOC0 authorizes the SERVICE identity and requires x-actor-id to be an
|
||||||
|
// actor that identity holds a grant for. The end-user actor is still the
|
||||||
|
// journal/authorization scope on our side; only the DOC0 call acts as the
|
||||||
|
// service.
|
||||||
|
const doc0ActorId = runtimeConfig.doc0.actorId ?? actorId;
|
||||||
|
const doc0Client = new Doc0UploadClient({
|
||||||
|
baseUrl: runtimeConfig.doc0.baseUrl,
|
||||||
|
serviceToken: runtimeConfig.doc0.serviceToken,
|
||||||
|
maxBytes: runtimeConfig.doc0.maxUploadBytes,
|
||||||
|
});
|
||||||
const coordinator = new DocumentUploadCoordinator({
|
const coordinator = new DocumentUploadCoordinator({
|
||||||
attempts: new PostgresUploadAttemptStore(sql),
|
attempts: new PostgresUploadAttemptStore(sql),
|
||||||
doc0: new Doc0UploadClient({
|
doc0: {
|
||||||
baseUrl: runtimeConfig.doc0.baseUrl,
|
upload: (input) => doc0Client.upload({ ...input, actorId: doc0ActorId }),
|
||||||
serviceToken: runtimeConfig.doc0.serviceToken,
|
inspect: (input) => doc0Client.inspect({ ...input, actorId: doc0ActorId }),
|
||||||
maxBytes: runtimeConfig.doc0.maxUploadBytes,
|
},
|
||||||
}),
|
|
||||||
authorize: async (scope) => authorize(scope),
|
authorize: async (scope) => authorize(scope),
|
||||||
maxBytes: runtimeConfig.doc0.maxUploadBytes,
|
maxBytes: runtimeConfig.doc0.maxUploadBytes,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export interface HttpsEndpoint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface DocumentWorkbenchRuntime {
|
export interface DocumentWorkbenchRuntime {
|
||||||
doc0?: HttpsEndpoint & { maxUploadBytes: number };
|
doc0?: HttpsEndpoint & { maxUploadBytes: number; actorId?: string };
|
||||||
inf0?: HttpsEndpoint;
|
inf0?: HttpsEndpoint;
|
||||||
pay0?: HttpsEndpoint;
|
pay0?: HttpsEndpoint;
|
||||||
n0d?: HttpsEndpoint;
|
n0d?: HttpsEndpoint;
|
||||||
@@ -84,6 +84,7 @@ export function readDocumentWorkbenchRuntime(env: NodeJS.ProcessEnv = process.en
|
|||||||
doc0: {
|
doc0: {
|
||||||
...doc0,
|
...doc0,
|
||||||
maxUploadBytes: positiveInt(env.OPT_MAX_UPLOAD_BYTES, DEFAULT_MAX_UPLOAD_BYTES),
|
maxUploadBytes: positiveInt(env.OPT_MAX_UPLOAD_BYTES, DEFAULT_MAX_UPLOAD_BYTES),
|
||||||
|
...(env.DOC0_SERVICE_ACTOR_ID ? { actorId: env.DOC0_SERVICE_ACTOR_ID.trim() } : {}),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
: {}),
|
: {}),
|
||||||
|
|||||||
Reference in New Issue
Block a user