fix: security & privacy (rate limiter fix, csrf session cookie, logout on server, drafts stale token passw, login timing, password over 72b, JWT_SECRET complexity, SMTP TLS, CSV export neutralised, fonts bundled, upload metadata, hourly cleanup job, privacy.md report)
This commit is contained in:
1 parent
e2812ee0b9
commit
ea98c5ec05
118 files changed
+3828
-130
No files matched your search
@@ -0,0 +1,35 @@
|
||||
package imaging
|
||||
|
||||
import (
|
||||
domain "RenewCMS/internal/domain/image"
|
||||
"errors"
|
||||
)
|
||||
|
||||
var errMalformedContainer = errors.New("malformed image container")
|
||||
|
||||
type MetadataStripper struct{}
|
||||
|
||||
var _ domain.MetadataStripper = &MetadataStripper{}
|
||||
|
||||
func NewMetadataStripper() *MetadataStripper {
|
||||
return &MetadataStripper{}
|
||||
}
|
||||
|
||||
func (s *MetadataStripper) Strip(contentType string, data []byte) ([]byte, error) {
|
||||
var stripped []byte
|
||||
var err error
|
||||
switch contentType {
|
||||
case "image/jpeg":
|
||||
stripped, err = stripJPEG(data)
|
||||
case "image/png":
|
||||
stripped, err = stripPNG(data)
|
||||
case "image/webp":
|
||||
stripped, err = stripWebP(data)
|
||||
default:
|
||||
return data, nil
|
||||
}
|
||||
if err != nil {
|
||||
return nil, errors.Join(domain.ErrImageUnreadable, err)
|
||||
}
|
||||
return stripped, nil
|
||||
}
|
||||
Reference in new issue
Block a user