mirror of
https://github.com/truenas/charts.git
synced 2026-06-14 22:25:57 +08:00
NAS-122694 / 23.10 / Add some validation in webdav and other apps (#1312)
* Add some validation in webdav * add validation in resources * formatting * Update error message * remove extra `\` * negate logic * bump
This commit is contained in:
@@ -3,7 +3,7 @@ description: WebDAV is a set of extensions to the HTTP protocol which allows use
|
||||
annotations:
|
||||
title: WebDAv
|
||||
type: application
|
||||
version: 1.0.5
|
||||
version: 1.0.6
|
||||
apiVersion: v2
|
||||
appVersion: '1.1.3.2982'
|
||||
kubeVersion: '>=1.16.0-0'
|
||||
|
||||
@@ -156,6 +156,8 @@ questions:
|
||||
description: Shares for WebDAV.
|
||||
schema:
|
||||
type: list
|
||||
empty: false
|
||||
required: true
|
||||
default: []
|
||||
items:
|
||||
- variable: shareEntry
|
||||
@@ -177,6 +179,8 @@ questions:
|
||||
Example: [share1] will be available at [http://<webdav-ip>:<webdav-port>/share1]
|
||||
schema:
|
||||
type: string
|
||||
valid_chars: '^[a-zA-Z0-9_-]+$'
|
||||
valid_chars_error: 'Share name can only consist of [Letters(a-z, A-Z), Numbers(0-9), Underscores(_), Dashes(-)]'
|
||||
required: true
|
||||
- variable: description
|
||||
label: Description
|
||||
@@ -203,7 +207,7 @@ questions:
|
||||
description: |
|
||||
Enable permission fix for the share.</br>
|
||||
This will fix the permissions of the share on startup.</br>
|
||||
This will change the owner of the share to the user and group specified in [User and Group Configuration].
|
||||
This will change the owner of the share to the user and group specified in [User and Group Configuration].</br>
|
||||
Note: This will still change permissions even if [Read Only] for the share is enabled.
|
||||
schema:
|
||||
type: boolean
|
||||
@@ -225,6 +229,13 @@ questions:
|
||||
description: CPU limit for WebDAV.
|
||||
schema:
|
||||
type: string
|
||||
max_length: 6
|
||||
valid_chars: '^(0\.[1-9]|[1-9][0-9]*)(\.[0-9]|m?)$'
|
||||
valid_chars_error: |
|
||||
Valid CPU limit formats are</br>
|
||||
- Plain Integer - eg. 1</br>
|
||||
- Float - eg. 0.5</br>
|
||||
- Milicpu - eg. 500m
|
||||
default: "4000m"
|
||||
required: true
|
||||
- variable: memory
|
||||
@@ -232,5 +243,13 @@ questions:
|
||||
description: Memory limit for WebDAV.
|
||||
schema:
|
||||
type: string
|
||||
max_length: 12
|
||||
valid_chars: '^[1-9][0-9]*([EPTGMK]i?|e[0-9]+)?$'
|
||||
valid_chars_error: |
|
||||
Valid Memory limit formats are</br>
|
||||
- Suffixed with E/P/T/G/M/K - eg. 1G</br>
|
||||
- Suffixed with Ei/Pi/Ti/Gi/Mi/Ki - eg. 1Gi</br>
|
||||
- Plain Integer in bytes - eg. 1024</br>
|
||||
- Exponent - eg. 134e6
|
||||
default: "8Gi"
|
||||
required: true
|
||||
|
||||
@@ -26,9 +26,15 @@
|
||||
{{- fail "WebDAV - Expected at least 1 [Share] to be configured" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $names := list -}}
|
||||
{{- range .Values.webdavStorage.shares -}}
|
||||
{{- $names = mustAppend $names .name -}}
|
||||
{{- if not (mustRegexMatch "^[a-zA-Z0-9_-]+$" .name) -}}
|
||||
{{- fail "WebDAV - Expected [Share] name to only consist of [Letters(a-z, A-Z), Numbers(0-9), Underscores(_), Dashes(-)]" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if not (deepEqual $names (uniq $names)) -}}
|
||||
{{- fail (printf "WebDAV - Expected Share names to be unique, but got [%v]" (join ", " $names)) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
Reference in New Issue
Block a user