bug: fix stored XSS in About page feedback slideshow - #331
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
Render feedback comments as interpolated text instead of concatenating them into an HTML string passed through bypassSecurityTrustHtml and bound to [innerHTML]. Signed-off-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Comment on lines
+127
to
+139
| it('should pass feedback comments to the gallery as plain text without marking them as trusted HTML', () => { | ||
| feedbackService.find.mockReturnValue(of([{ comment: '<iframe src="javascript:alert(`xss`)">', rating: 2 }])) | ||
| component.galleryRef = { addImage: vi.fn().mockName('GalleryRef.addImage') } as any | ||
|
|
||
| component.populateSlideshowFromFeedbacks() | ||
|
|
||
| expect(component.galleryRef.addImage).toHaveBeenCalledWith({ | ||
| src: 'assets/public/images/carousel/1.jpg', | ||
| args: { | ||
| comment: '<iframe src="javascript:alert(`xss`)">', | ||
| stars: ['fas fa-star', 'fas fa-star', 'far fa-star', 'far fa-star', 'far fa-star'] | ||
| } | ||
| }) |
Author
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Fixes a stored XSS on the About page (
frontend/src/app/about/about.component.ts).populateSlideshowFromFeedbacks()concatenated each user-submitted feedbackcommentinto an HTML string, wrapped it inDomSanitizer.bypassSecurityTrustHtml()and the template bound it via[innerHTML]="item?.args", so any payload that survived the backend's single-pass sanitizer executed for every/aboutvisitor.Fix (frontend only, breaks the sink):
about.component.ts: dropDomSanitizerand thestarsHTML strings; galleryargsis now{ comment: string, stars: string[] }built bystarIcons(rating).about.component.html:<figure>builds the caption structurally — comment rendered with{{ }}interpolation (always escaped), star icons via@forover class names. No[innerHTML]remains.about.component.spec.ts: test asserting an<iframe src="javascript:...">comment is passed to the gallery as plain text, not a trustedSafeHtml.models/feedback.ts/POST /api/Feedbacksare intentionally untouched (persistedXssFeedbackChallenge).Resolved or fixed issue: none
AI Tool Disclosure
DevinDevin (Cognition AI)Fix stored XSS via bypassSecurityTrustHtml on About page feedback comments and open a PRAffirmation
Devin-Org: engineering