Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
c0a2234
fix: added warning for legacy cross_origin_auth and added sanitizeDep…
palashgdev Dec 1, 2025
ab164bb
test: add migration tests for deprecated cross_origin_auth to cross_o…
palashgdev Dec 2, 2025
e0c2c30
fix: rename variable for clarity in sanitizeClientFields function
palashgdev Dec 2, 2025
a2fde34
fix: update client sanitization to handle deprecated cross_origin_aut…
palashgdev Dec 2, 2025
ea2f8a5
fix: refactor client field sanitization to improve clarity and handle…
palashgdev Dec 2, 2025
3afb313
fix: specify type for fields in sanitizeClientFields function
palashgdev Dec 2, 2025
b81fd2e
fix: rename variable for clarity in sanitizeClientFields function and…
palashgdev Dec 2, 2025
9817e51
fix: migrate deprecated cross_origin_auth to cross_origin_authenticat…
palashgdev Dec 2, 2025
fbb8b5d
fix: ensure newline at end of file in clients.tests.js
palashgdev Dec 2, 2025
bf39d23
fix: refactor cross_origin_auth sanitization into a dedicated method
palashgdev Dec 2, 2025
38c4f6c
fix: improve client field sanitization and handle deprecated cross_or…
palashgdev Dec 4, 2025
24a7b0a
Refactor code structure for improved readability and maintainability
palashgdev Dec 5, 2025
8b12f9d
fix: correct spelling of 'sanitized' in client field sanitization met…
palashgdev Dec 5, 2025
652f4e9
fix: update deprecation warning for 'cross_origin_auth' parameter
palashgdev Dec 5, 2025
89d0f0d
Merge branch 'master' into DXCDT-1301-cross-auth
palashgdev Dec 5, 2025
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
54 changes: 50 additions & 4 deletions src/tools/auth0/handlers/clients.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import {
ClientExpressConfiguration,
ClientOrganizationRequireBehaviorEnum,
} from 'auth0';
import { has, omit } from 'lodash';
import { Assets, Auth0APIClient } from '../../../types';
import { paginate } from '../client';
import DefaultAPIHandler from './default';
import { getConnectionProfile } from './connectionProfiles';
import { getUserAttributeProfiles } from './userAttributeProfiles';
import log from '../../../logger';

const multiResourceRefreshTokenPoliciesSchema = {
type: ['array', 'null'],
Expand Down Expand Up @@ -276,6 +278,8 @@ export type Client = {
app_type?: string;
is_first_party?: boolean;
resource_server_identifier?: string;
cross_origin_authentication?: boolean;
cross_origin_auth?: boolean;
custom_login_page?: string;
custom_login_page_on?: boolean;
express_configuration?: ClientExpressConfiguration;
Expand Down Expand Up @@ -344,9 +348,10 @@ export default class ClientHandler extends DefaultAPIHandler {
);

// Sanitize client fields
const sanitizeClientFields = (list: Client[]): Client[] =>
list.map((item) => {
// For resourceServers app type `resource_server`, don't include `oidc_backchannel_logout`, `oidc_logout`, `refresh_token`
const sanitizeClientFields = (list: Client[]): Client[] => {
const sanitizedClients = this.sanitizeCrossOriginAuth(list);

return sanitizedClients.map((item: Client) => {
if (item.app_type === 'resource_server') {
if ('oidc_backchannel_logout' in item) {
delete item.oidc_backchannel_logout;
Expand All @@ -360,6 +365,7 @@ export default class ClientHandler extends DefaultAPIHandler {
}
return item;
});
};

const changes = {
del: sanitizeClientFields(filterClients(del as Client[])),
Expand All @@ -373,6 +379,44 @@ export default class ClientHandler extends DefaultAPIHandler {
});
}

/**
* @description
* Sanitize the deprecated field `cross_origin_auth` to `cross_origin_authentication`
*
* @param {Client[]} clients - The client array to sanitize.
* @returns {Client[]} The sanitized array of clients.
*/
private sanitizeCrossOriginAuth(clients: Client[]): Client[] {
const deprecatedClients: string[] = [];

const updatedClients = clients.map((client) => {
let updated: Client = { ...client };

if (has(updated, 'cross_origin_auth')) {
deprecatedClients.push(client.name);

if (!has(updated, 'cross_origin_authentication')) {
updated.cross_origin_authentication = updated.cross_origin_auth;
}

updated = omit(updated, 'cross_origin_auth') as Client;
}

return updated;
});

if (deprecatedClients.length > 0) {
log.warn(
"The 'cross_origin_auth' parameter is deprecated in clients and scheduled for removal in future releases.\n" +
`Use 'cross_origin_authentication' going forward. Clients using the deprecated setting: [${deprecatedClients.join(
', '
)}]`
);
}

return updatedClients;
}

async getType() {
if (this.existing) return this.existing;

Expand All @@ -387,7 +431,9 @@ export default class ClientHandler extends DefaultAPIHandler {
...(excludeThirdPartyClients && { is_first_party: true }),
});

this.existing = clients;
const sanitizedClients = this.sanitizeCrossOriginAuth(clients);

this.existing = sanitizedClients;
return this.existing;
}

Expand Down
Loading