Skip to content

Commit

Permalink
fix(logs): Improves on decrypt unsafe fail (#303)
Browse files Browse the repository at this point in the history
This is a failure before rewrap, not upsert.
  • Loading branch information
dmihalcik-virtru authored Jul 17, 2024
1 parent 0e1426b commit 4efa118
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/tdf3/src/tdf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import {
TdfDecryptError,
TdfError,
TdfPayloadExtractionError,
UnsafeUrlError,
} from '../../src/errors.js';
import { htmlWrapperTemplate } from './templates/index.js';

Expand Down Expand Up @@ -824,7 +825,12 @@ async function unwrapKey({
const rewrappedKeys = await Promise.all(
keyAccess.map(async (keySplitInfo) => {
if (!allowedKases.includes(keySplitInfo.url)) {
throw new KasUpsertError(`Unexpected KAS url: [${keySplitInfo.url}]`);
throw new UnsafeUrlError(
`cannot decrypt TDF: [${keySplitInfo.url}] not on allowlist ${JSON.stringify(
allowedKases
)}`,
keySplitInfo.url
);
}
const url = `${keySplitInfo.url}/${isAppIdProvider ? '' : 'v2/'}rewrap`;

Expand Down

0 comments on commit 4efa118

Please sign in to comment.