-
Notifications
You must be signed in to change notification settings - Fork 82
feat: added consent notice and intent mapping logic #1586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
37dfbc1
feat: added API to store intent and notice URL
tipusinghaw b0befd1
feat: added intent notice related changes
tipusinghaw 382a06f
feat: updated intent notice APIs
tipusinghaw f146548
feat: updated the consent notice APIs
tipusinghaw e2b0cbe
fix: resolved fetch issue
tipusinghaw 8a2fd10
refactore: resolved coderabbit suggestions
tipusinghaw 5903dec
refactor: resolved intent based verification presentation comments
tipusinghaw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
apps/api-gateway/src/oid4vc-verification/dtos/create-intent-notice.dto.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; | ||
| import { IsDefined, IsOptional, IsString, IsUrl, IsUUID } from 'class-validator'; | ||
|
|
||
| export class CreateIntentNoticeDto { | ||
| @ApiProperty({ description: 'Intent ID to associate the notice with', example: 'uuid-of-intent' }) | ||
| @IsDefined() | ||
| @IsUUID() | ||
| intentId: string; | ||
|
|
||
| @ApiProperty({ description: 'URL of the notice', example: 'https://example.com/notice' }) | ||
| @IsDefined() | ||
| @IsString() | ||
| noticeUrl: string; | ||
|
|
||
| @ApiPropertyOptional({ description: 'Organization ID (optional)', example: 'uuid-of-org' }) | ||
| @IsOptional() | ||
| @IsUUID() | ||
| orgId?: string; | ||
| } | ||
|
|
||
| export class UpdateIntentNoticeDto { | ||
| @ApiPropertyOptional({ description: 'URL of the notice', example: 'https://example.com/notice' }) | ||
| @IsOptional() | ||
| @IsUrl() | ||
| noticeUrl?: string; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GET /intent/noticeallows unscoped cross-ecosystem reads.At Line 647-Line 672, both filters are optional and no ecosystem/user scope is sent downstream. A user with ecosystem role access can retrieve notices outside their intended scope.
🔧 Suggested direction
Additionally, prefer a scoped contract (ecosystemId + caller context) for this read path, or deprecate this route in favor of
GET /intent/ecosystem/:ecosystemId/notice.📝 Committable suggestion
🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ecosystem filter is applied in DB query
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Length of output: 29429
@tipusinghaw, that's correct — whenintentIdis supplied, the repository does derive the intent'secosystemIdand scopes the DB query accordingly (Lines 1726–1735 inecosystem.repository.ts). Thanks for the clarification.That said, two edge cases remain unscoped:
idsupplied — thewhereclause becomes{ id }with no ecosystem filter, so a caller can fetch any notice by its PK regardless of ecosystem membership.idnorintentIdsupplied — thewhereclause is{}, which returns allintent_noticesacross every ecosystem.A minimal guard at the controller level would close both gaps:
And for the
id-only path, passing the caller's verifiedecosystemId(from the JWT /EcosystemRolesGuardcontext) down to the repository so it can addintent: { is: { ecosystemId } }to thewhereclause would fully close the cross-ecosystem read.Would you like to address these two residual cases, or is the
GET /intent/noticeroute intentionally an admin/internal endpoint where cross-ecosystem reads are acceptable?🧠 Learnings used