summaryrefslogtreecommitdiff
path: root/internal/processing
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2023-08-11 14:40:11 +0200
committerLibravatar GitHub <noreply@github.com>2023-08-11 14:40:11 +0200
commitdc96562b4084e058846aea9102ef0257461717d6 (patch)
treea0b4bdbaa266386c7fdbbc02ca3e62bae559bf17 /internal/processing
parent[feature] Set Content-Security-Policy header (#2095) (diff)
downloadgotosocial-dc96562b4084e058846aea9102ef0257461717d6.tar.xz
[bugfix] Use custom bluemonday policy to disallow inline img tags (#2100)
Diffstat (limited to 'internal/processing')
-rw-r--r--internal/processing/account/create.go2
-rw-r--r--internal/processing/account/update.go8
-rw-r--r--internal/processing/admin/domainblock.go4
-rw-r--r--internal/processing/instance.go8
-rw-r--r--internal/processing/media/update.go2
-rw-r--r--internal/processing/status/create.go2
6 files changed, 13 insertions, 13 deletions
diff --git a/internal/processing/account/create.go b/internal/processing/account/create.go
index 32a59d1ef..1925feb63 100644
--- a/internal/processing/account/create.go
+++ b/internal/processing/account/create.go
@@ -71,7 +71,7 @@ func (p *Processor) Create(
Username: form.Username,
Email: form.Email,
Password: form.Password,
- Reason: text.SanitizePlaintext(reason),
+ Reason: text.SanitizeToPlaintext(reason),
PreApproved: !config.GetAccountsApprovalRequired(), // Mark as approved if no approval required.
SignUpIP: form.IP,
Locale: form.Locale,
diff --git a/internal/processing/account/update.go b/internal/processing/account/update.go
index f75b3c8d9..ec343f160 100644
--- a/internal/processing/account/update.go
+++ b/internal/processing/account/update.go
@@ -67,7 +67,7 @@ func (p *Processor) Update(ctx context.Context, account *gtsmodel.Account, form
}
// Parse new display name (always from plaintext).
- account.DisplayName = text.SanitizePlaintext(displayName)
+ account.DisplayName = text.SanitizeToPlaintext(displayName)
// If display name has changed, account emojis may have also changed.
emojisChanged = true
@@ -110,8 +110,8 @@ func (p *Processor) Update(ctx context.Context, account *gtsmodel.Account, form
// Sanitize raw field values.
fieldRaw := &gtsmodel.Field{
- Name: text.SanitizePlaintext(name),
- Value: text.SanitizePlaintext(value),
+ Name: text.SanitizeToPlaintext(name),
+ Value: text.SanitizeToPlaintext(value),
}
fieldsRaw = append(fieldsRaw, fieldRaw)
}
@@ -255,7 +255,7 @@ func (p *Processor) Update(ctx context.Context, account *gtsmodel.Account, form
if err := validate.CustomCSS(customCSS); err != nil {
return nil, gtserror.NewErrorBadRequest(err, err.Error())
}
- account.CustomCSS = text.SanitizePlaintext(customCSS)
+ account.CustomCSS = text.SanitizeToPlaintext(customCSS)
}
if form.EnableRSS != nil {
diff --git a/internal/processing/admin/domainblock.go b/internal/processing/admin/domainblock.go
index c645f287a..a85d78a56 100644
--- a/internal/processing/admin/domainblock.go
+++ b/internal/processing/admin/domainblock.go
@@ -67,8 +67,8 @@ func (p *Processor) DomainBlockCreate(
ID: id.NewULID(),
Domain: domain,
CreatedByAccountID: account.ID,
- PrivateComment: text.SanitizePlaintext(privateComment),
- PublicComment: text.SanitizePlaintext(publicComment),
+ PrivateComment: text.SanitizeToPlaintext(privateComment),
+ PublicComment: text.SanitizeToPlaintext(publicComment),
Obfuscate: &obfuscate,
SubscriptionID: subscriptionID,
}
diff --git a/internal/processing/instance.go b/internal/processing/instance.go
index ac63814cd..edcfe5418 100644
--- a/internal/processing/instance.go
+++ b/internal/processing/instance.go
@@ -159,7 +159,7 @@ func (p *Processor) InstancePatch(ctx context.Context, form *apimodel.InstanceSe
return nil, gtserror.NewErrorBadRequest(err, fmt.Sprintf("site title invalid: %s", err))
}
updatingColumns = append(updatingColumns, "title")
- instance.Title = text.SanitizePlaintext(*form.Title) // don't allow html in site title
+ instance.Title = text.SanitizeToPlaintext(*form.Title) // don't allow html in site title
}
// validate & update site contact account if it's set on the form
@@ -215,7 +215,7 @@ func (p *Processor) InstancePatch(ctx context.Context, form *apimodel.InstanceSe
return nil, gtserror.NewErrorBadRequest(err, err.Error())
}
updatingColumns = append(updatingColumns, "short_description")
- instance.ShortDescription = text.SanitizeHTML(*form.ShortDescription) // html is OK in site description, but we should sanitize it
+ instance.ShortDescription = text.SanitizeToHTML(*form.ShortDescription) // html is OK in site description, but we should sanitize it
}
// validate & update site description if it's set on the form
@@ -224,7 +224,7 @@ func (p *Processor) InstancePatch(ctx context.Context, form *apimodel.InstanceSe
return nil, gtserror.NewErrorBadRequest(err, err.Error())
}
updatingColumns = append(updatingColumns, "description")
- instance.Description = text.SanitizeHTML(*form.Description) // html is OK in site description, but we should sanitize it
+ instance.Description = text.SanitizeToHTML(*form.Description) // html is OK in site description, but we should sanitize it
}
// validate & update site terms if it's set on the form
@@ -233,7 +233,7 @@ func (p *Processor) InstancePatch(ctx context.Context, form *apimodel.InstanceSe
return nil, gtserror.NewErrorBadRequest(err, err.Error())
}
updatingColumns = append(updatingColumns, "terms")
- instance.Terms = text.SanitizeHTML(*form.Terms) // html is OK in site terms, but we should sanitize it
+ instance.Terms = text.SanitizeToHTML(*form.Terms) // html is OK in site terms, but we should sanitize it
}
var updateInstanceAccount bool
diff --git a/internal/processing/media/update.go b/internal/processing/media/update.go
index 33649f201..59ade9ca5 100644
--- a/internal/processing/media/update.go
+++ b/internal/processing/media/update.go
@@ -47,7 +47,7 @@ func (p *Processor) Update(ctx context.Context, account *gtsmodel.Account, media
var updatingColumns []string
if form.Description != nil {
- attachment.Description = text.SanitizePlaintext(*form.Description)
+ attachment.Description = text.SanitizeToPlaintext(*form.Description)
updatingColumns = append(updatingColumns, "description")
}
diff --git a/internal/processing/status/create.go b/internal/processing/status/create.go
index 36842ee07..d671ea8c4 100644
--- a/internal/processing/status/create.go
+++ b/internal/processing/status/create.go
@@ -54,7 +54,7 @@ func (p *Processor) Create(ctx context.Context, account *gtsmodel.Account, appli
Local: &local,
AccountID: account.ID,
AccountURI: account.URI,
- ContentWarning: text.SanitizePlaintext(form.SpoilerText),
+ ContentWarning: text.SanitizeToPlaintext(form.SpoilerText),
ActivityStreamsType: ap.ObjectNote,
Sensitive: &sensitive,
CreatedWithApplicationID: application.ID,