mirror of
https://github.com/Luzifer/ots.git
synced 2025-07-22 06:08:51 -04:00
Fix: Use a default maxSecretSize and limit the payload read (#144)
This commit is contained in:
parent
5ad6449757
commit
136c0e2c96
2 changed files with 26 additions and 0 deletions
|
@ -12,6 +12,13 @@ import (
|
|||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
// Frontend has a max attachment size of 64MiB as the base64 encoding
|
||||
// will break afterwards. Therefore we use a maximum secret size of
|
||||
// 65MiB and increase it by double base64 encoding:
|
||||
//
|
||||
// 65 MiB * 16/9 (twice 4/3 base64 size increase)
|
||||
const defaultMaxSecretSize = 65 * 1024 * 1024 * (16 / 9) // = 115.6MiB
|
||||
|
||||
type (
|
||||
// Customize holds the structure of the customization file
|
||||
Customize struct {
|
||||
|
@ -78,4 +85,8 @@ func (c *Customize) applyFixes() {
|
|||
if len(c.AppTitle) == 0 {
|
||||
c.AppTitle = "OTS - One Time Secrets"
|
||||
}
|
||||
|
||||
if c.MaxSecretSize == 0 {
|
||||
c.MaxSecretSize = defaultMaxSecretSize
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue