Skip to content

Commit

Permalink
Merge branch 'main' into feature/encryption-info-versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
dmihalcik-virtru committed Jul 17, 2024
2 parents 3b3d766 + 4efa118 commit a9d658d
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 46 deletions.
20 changes: 10 additions & 10 deletions cli/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions lib/src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,18 @@ export class TdfError extends Error {

export class UnsafeUrlError extends Error {
override name = 'UnsafeUrlError';
readonly url: string;
readonly url: string | string[];

constructor(message: string, url: string) {
constructor(message: string, ...urls: string[]) {
super(message);
Object.setPrototypeOf(this, new.target.prototype);
this.url = url;
if (urls && urls.length) {
if (urls.length > 1) {
this.url = urls;
} else {
this.url = urls[0];
}
}
}
}

Expand Down
8 changes: 5 additions & 3 deletions lib/tdf3/src/tdf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import {
TdfDecryptError,
TdfError,
TdfPayloadExtractionError,
UnsafeUrlError,
} from '../../src/errors.js';
import { htmlWrapperTemplate } from './templates/index.js';

Expand Down Expand Up @@ -815,10 +816,11 @@ export function splitLookupTableFactory(
const disallowedKases = new Set(
keyAccess.filter(({ url }) => !allowedKases.includes(url)).map(({ url }) => url)
);
throw new KasDecryptError(
`Unreconstructable key - disallowed KASes include: [${JSON.stringify(
throw new UnsafeUrlError(
`unreconstructable key - disallowed KASes include: ${JSON.stringify(
disallowedKases
)}] from splitIds [${JSON.stringify(splitIds)}]`
)} from splitIds ${JSON.stringify(splitIds)}`,
...disallowedKases
);
}
const splitPotentials: Record<string, Record<string, KeyAccessObject>> = Object.fromEntries(
Expand Down
20 changes: 10 additions & 10 deletions remote-store/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 20 additions & 20 deletions web-app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a9d658d

Please sign in to comment.