Skip to content

Commit

Permalink
fix: sanitize html string (#784)
Browse files Browse the repository at this point in the history
  • Loading branch information
moughxyz authored Dec 24, 2021
1 parent ebdae31 commit 7f011d7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 717 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ const startApplication: StartApplication = async function startApplication(
SNLog.onLog = console.log;
startErrorReporting();

angular.module('app', ['ngSanitize']);
angular.module('app', []);

// Config
angular
Expand Down
10 changes: 8 additions & 2 deletions app/assets/javascripts/components/NotesListItem.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { CollectionSort, SNNote } from '@standardnotes/snjs';
import {
CollectionSort,
sanitizeHtmlString,
SNNote,
} from '@standardnotes/snjs';
import { FunctionComponent } from 'preact';

type Props = {
Expand Down Expand Up @@ -108,7 +112,9 @@ export const NotesListItem: FunctionComponent<Props> = ({
{note.preview_html ? (
<div
className="html-preview"
dangerouslySetInnerHTML={{ __html: note.preview_html }}
dangerouslySetInnerHTML={{
__html: sanitizeHtmlString(note.preview_html),
}}
></div>
) : null}
{!note.preview_html && note.preview_plain ? (
Expand Down
1 change: 0 additions & 1 deletion app/assets/javascripts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import '../stylesheets/index.css.scss';

// Vendor
import 'angular';
import '../../../vendor/assets/javascripts/angular-sanitize';
import '../../../vendor/assets/javascripts/zip/deflate';
import '../../../vendor/assets/javascripts/zip/inflate';
import '../../../vendor/assets/javascripts/zip/zip';
Expand Down
Loading

0 comments on commit 7f011d7

Please sign in to comment.