Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions srv/lib/data-subject-resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* The resolver cannot produce tab IDs without a DB query, so it returns a
* nested marker instead of resolved values:
*
* { column: 'tab_ID', values: null, nested: true, via: 'DeveloperEnvironmentTabs' }
* { column: 'tab_ID', values: null, nested: true, via: 'com.sap.developers.ims.DeveloperEnvironmentTabs' }
*
* Task-4 (export handler) and Task-5 (anonymization cascade fix) MUST check
* for `result.nested === true` and:
Expand Down Expand Up @@ -75,12 +75,21 @@ export async function resolveSubjectKeys(user, planEntry) {

// DeveloperEnvironmentLinks — linked via parent DeveloperEnvironmentTabs (tab_ID)
// Cannot resolve without a DB query; return a nested marker for the caller to handle.
//
// `via` MUST be the fully-qualified CDS name, not the bare "DeveloperEnvironmentTabs".
// The cascade runs inside the AdminService request context (the GDPR actions are
// bound to that served service), where a bare "DeveloperEnvironmentTabs" resolves to
// the AdminService *projection* and CAP emits literal `SELECT ID FROM
// DeveloperEnvironmentTabs` — a table that does not exist (the physical table is
// `com_sap_developers_ims_DeveloperEnvironmentTabs`), producing a 500
// "no such table: DeveloperEnvironmentTabs". Qualifying the name forces resolution
// to the db-layer entity and the correct namespaced table.
if (dataSubjectField === 'tab_ID') {
return {
column: 'tab_ID',
values: null,
nested: true,
via: 'DeveloperEnvironmentTabs'
via: 'com.sap.developers.ims.DeveloperEnvironmentTabs'
};
}

Expand Down
6 changes: 5 additions & 1 deletion test/unit/anonymization-cascade-authorid-gap.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,12 @@ describe('anonymization-cascade: AuthorAiRequests authorId gap', () => {
// never runs AND this intermediate SELECT never runs either.
// If `resolved.via` were changed to a wrong entity, a different SELECT
// would appear instead — both cases cause this assertion to fail.
// capturedRuns stores JSON.stringify(cqn), so it holds the fully-qualified
// CDS name `com.sap.developers.ims.DeveloperEnvironmentTabs` (dotted) — NOT
// the bare "DeveloperEnvironmentTabs", which would collide with the
// AdminService projection and 500 through the served context (#977 CI bug).
const nestedSelectFired = capturedRuns.some(
s => s.includes('"DeveloperEnvironmentTabs"') && s.includes('user_ID') && s.includes(userId)
s => s.includes('com.sap.developers.ims.DeveloperEnvironmentTabs') && s.includes('user_ID') && s.includes(userId)
);
expect(nestedSelectFired).toBe(true);

Expand Down
2 changes: 1 addition & 1 deletion test/unit/data-subject-resolver.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ describe('resolveSubjectKeys', () => {
expect(result).not.toBeNull();
expect(result.column).toBe('tab_ID');
expect(result.nested).toBe(true);
expect(result.via).toBe('DeveloperEnvironmentTabs');
expect(result.via).toBe('com.sap.developers.ims.DeveloperEnvironmentTabs');
// values should be null (caller must resolve the parent Tabs first)
expect(result.values).toBeNull();
});
Expand Down
Loading