summaryrefslogtreecommitdiff
path: root/internal/processing/account/update.go
diff options
context:
space:
mode:
authorLibravatar Tobi Smethurst <31960611+tsmethurst@users.noreply.github.com>2021-07-13 16:03:51 +0200
committerLibravatar GitHub <noreply@github.com>2021-07-13 16:03:51 +0200
commitbdba3ff9a9f98c1605c01c0e84f6bd6ed5c3efae (patch)
treefaf0be2250d23aec1af6a6d2bcf321d1d8826ba9 /internal/processing/account/update.go
parentBlock/unblock (#96) (diff)
downloadgotosocial-bdba3ff9a9f98c1605c01c0e84f6bd6ed5c3efae.tar.xz
sanitize html for statuses + instance (#97)
* sanitize html for statuses + instance * sanitization
Diffstat (limited to 'internal/processing/account/update.go')
-rw-r--r--internal/processing/account/update.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/internal/processing/account/update.go b/internal/processing/account/update.go
index 830fec60a..fbe29ac86 100644
--- a/internal/processing/account/update.go
+++ b/internal/processing/account/update.go
@@ -50,7 +50,8 @@ func (p *processor) Update(account *gtsmodel.Account, form *apimodel.UpdateCrede
if err := util.ValidateDisplayName(*form.DisplayName); err != nil {
return nil, err
}
- if err := p.db.UpdateOneByID(account.ID, "display_name", *form.DisplayName, &gtsmodel.Account{}); err != nil {
+ displayName := util.RemoveHTML(*form.DisplayName) // no html allowed in display name
+ if err := p.db.UpdateOneByID(account.ID, "display_name", displayName, &gtsmodel.Account{}); err != nil {
return nil, err
}
}
@@ -59,7 +60,8 @@ func (p *processor) Update(account *gtsmodel.Account, form *apimodel.UpdateCrede
if err := util.ValidateNote(*form.Note); err != nil {
return nil, err
}
- if err := p.db.UpdateOneByID(account.ID, "note", *form.Note, &gtsmodel.Account{}); err != nil {
+ note := util.SanitizeHTML(*form.Note) // html OK in note but sanitize it
+ if err := p.db.UpdateOneByID(account.ID, "note", note, &gtsmodel.Account{}); err != nil {
return nil, err
}
}