Skip to content

Commit a56cc16

Browse files
committed
Merge branch 'hotfix/3.0.3' - Security hotfix v3.0.3
2 parents 4f7951f + eb724f3 commit a56cc16

File tree

4 files changed

+30
-5
lines changed

4 files changed

+30
-5
lines changed

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
<a name="3.0.3"></a>
2+
## [3.0.3](https://github.com/kolkov/angular-editor/compare/v3.0.2...v3.0.3) (2025-01-22) - Security Hotfix
3+
4+
### Security
5+
* **CRITICAL:** Fixed XSS vulnerability in `refreshView()` method ([#580](https://github.com/kolkov/angular-editor/issues/580)) ([774a97d](https://github.com/kolkov/angular-editor/commit/774a97d))
6+
- XSS could bypass sanitizer when setting editor value via ngModel/formControl
7+
- Sanitization now properly applied to all innerHTML assignments
8+
- Thanks to @MarioTesoro for responsible disclosure with PoC
9+
10+
### Bug Fixes
11+
* **links:** Preserve relative URLs when editing existing links ([#359](https://github.com/kolkov/angular-editor/issues/359)) ([c691d30](https://github.com/kolkov/angular-editor/commit/c691d30))
12+
- Use `getAttribute('href')` instead of `.href` property
13+
- Prevents adding hostname to relative paths
14+
* **debug:** Remove debug `console.log` statement from focus() method ([#324](https://github.com/kolkov/angular-editor/issues/324)) ([c691d30](https://github.com/kolkov/angular-editor/commit/c691d30))
15+
16+
### Upgrade Recommendation
17+
**IMMEDIATE UPGRADE RECOMMENDED** for all users. This release fixes a critical security vulnerability.
18+
19+
---
20+
121
<a name="3.0.2"></a>
222
## [3.0.2](https://github.com/kolkov/angular-editor/compare/v3.0.1...v3.0.2) (2025-01-22)
323

projects/angular-editor/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@kolkov/angular-editor",
3-
"version": "3.0.2",
3+
"version": "3.0.3",
44
"description": "A simple native WYSIWYG editor for Angular 20+. Rich Text editor component for Angular.",
55
"author": "Andrey Kolkov <a.kolkov@gmail.com>",
66
"repository": "https://github.com/kolkov/angular-editor",

projects/angular-editor/src/lib/ae-toolbar/ae-toolbar.component.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,10 @@ export class AeToolbarComponent {
260260
const selection = this.editorService.savedSelection;
261261
if (selection && selection.commonAncestorContainer.parentElement.nodeName === 'A') {
262262
const parent = selection.commonAncestorContainer.parentElement as HTMLAnchorElement;
263-
if (parent.href !== '') {
264-
url = parent.href;
263+
// Use getAttribute to preserve relative URLs instead of href which returns absolute URL
264+
const href = parent.getAttribute('href');
265+
if (href !== '' && href !== null) {
266+
url = href;
265267
}
266268
}
267269
url = prompt('Insert URL link', url);
@@ -380,6 +382,5 @@ export class AeToolbarComponent {
380382

381383
focus() {
382384
this.execute.emit('focus');
383-
console.log('focused');
384385
}
385386
}

projects/angular-editor/src/lib/editor/angular-editor.component.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,11 @@ export class AngularEditorComponent implements OnInit, ControlValueAccessor, Aft
275275
*/
276276
refreshView(value: string): void {
277277
const normalizedValue = value === null ? '' : value;
278-
this.r.setProperty(this.textArea.nativeElement, 'innerHTML', normalizedValue);
278+
// Apply sanitization to prevent XSS when setting innerHTML
279+
const sanitizedValue = this.config.sanitize !== false
280+
? this.sanitizer.sanitize(SecurityContext.HTML, normalizedValue)
281+
: normalizedValue;
282+
this.r.setProperty(this.textArea.nativeElement, 'innerHTML', sanitizedValue);
279283

280284
return;
281285
}

0 commit comments

Comments
 (0)