Skip to content

Commit 81ab0c5

Browse files
Add URL validation for Dentity verification credentials
- Add ALLOWED_DENTITY_URL constant to restrict fetching to authorized endpoints - Filter verification URIs to only allow those starting with https://oidc.dentity.com/oidc/vp-token - Prevent fetching verification credentials from unauthorized sources 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent ba6b200 commit 81ab0c5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/hooks/verification/useVerifiedRecords/useVerifiedRecords.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import {
1313
VerifiedRecord,
1414
} from './utils/parseVerificationData/parseVerificationData'
1515

16+
const ALLOWED_DENTITY_URL = 'https://oidc.dentity.com/oidc/vp-token'
17+
1618
type UseVerifiedRecordsParameters = {
1719
verificationsRecord?: string
1820
ownerAddress?: Hash
@@ -47,8 +49,12 @@ export const getVerifiedRecords = async <TParams extends UseVerifiedRecordsParam
4749
queryKey: [{ verificationsRecord, ownerAddress, name }],
4850
}: QueryFunctionContext<QueryKey<TParams>>): Promise<UseVerifiedRecordsReturnType> => {
4951
const verifiablePresentationUris = parseVerificationRecord(verificationsRecord)
52+
53+
// Filter to only allow Dentity verification URLs
54+
const validUris = verifiablePresentationUris.filter((uri) => uri.startsWith(ALLOWED_DENTITY_URL))
55+
5056
const responses = await Promise.allSettled(
51-
verifiablePresentationUris.map((uri) => fetch(uri).then((resp) => resp.json())),
57+
validUris.map((uri) => fetch(uri).then((resp) => resp.json())),
5258
)
5359
return Promise.all(
5460
responses

0 commit comments

Comments
 (0)