summaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorArne Juul <arnej@yahooinc.com>2022-09-21 09:46:21 +0000
committerArne Juul <arnej@yahooinc.com>2022-09-21 09:46:21 +0000
commit3167b1f5779f4f0814389922e3d43b61c1a5cf82 (patch)
tree4c9f707811f30eb0894faf216dd126e77fa1fb49 /config-model
parent04b195343586990e6a612d33e98c7fa8603ee0f4 (diff)
restrict vespamalloc attributes
* only "name tokens' allowed
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/resources/schema/content.rnc24
-rw-r--r--config-model/src/test/schema-test-files/services-bad-vespamalloc.xml13
-rw-r--r--config-model/src/test/schema-test-files/services-hosted.xml4
-rwxr-xr-xconfig-model/src/test/sh/test-schema.sh7
4 files changed, 34 insertions, 14 deletions
diff --git a/config-model/src/main/resources/schema/content.rnc b/config-model/src/main/resources/schema/content.rnc
index 3db0daa6490..3d1873507ce 100644
--- a/config-model/src/main/resources/schema/content.rnc
+++ b/config-model/src/main/resources/schema/content.rnc
@@ -203,10 +203,10 @@ ContentNode = element node {
attribute capacity { xsd:double { minExclusive = "0.0" } }? &
attribute mmap-core-limit { xsd:nonNegativeInteger }? &
attribute core-on-oom { xsd:boolean }? &
- attribute no-vespamalloc { xsd:string }? &
- attribute vespamalloc { xsd:string }? &
- attribute vespamalloc-debug { xsd:string }? &
- attribute vespamalloc-debug-stacktrace { xsd:string }? &
+ attribute no-vespamalloc { xsd:NMTOKENS }? &
+ attribute vespamalloc { xsd:NMTOKENS }? &
+ attribute vespamalloc-debug { xsd:NMTOKENS }? &
+ attribute vespamalloc-debug-stacktrace { xsd:NMTOKENS }? &
attribute cpu-socket { xsd:nonNegativeInteger }?
}
@@ -215,10 +215,10 @@ ContentNodes = element nodes {
attribute cpu-socket-affinity { xsd:string }? &
attribute mmap-core-limit { xsd:nonNegativeInteger }? &
attribute core-on-oom { xsd:boolean }? &
- attribute no-vespamalloc { xsd:string }? &
- attribute vespamalloc { xsd:string }? &
- attribute vespamalloc-debug { xsd:string }? &
- attribute vespamalloc-debug-stacktrace { xsd:string }? &
+ attribute no-vespamalloc { xsd:NMTOKENS }? &
+ attribute vespamalloc { xsd:NMTOKENS }? &
+ attribute vespamalloc-debug { xsd:NMTOKENS }? &
+ attribute vespamalloc-debug-stacktrace { xsd:NMTOKENS }? &
(
(
attribute count { xsd:positiveInteger | xsd:string } &
@@ -242,10 +242,10 @@ TopGroup = element group {
attribute cpu-socket-affinity { xsd:string }? &
attribute mmap-core-limit { xsd:nonNegativeInteger }? &
attribute core-on-oom { xsd:boolean }? &
- attribute no-vespamalloc { xsd:string }? &
- attribute vespamalloc { xsd:string }? &
- attribute vespamalloc-debug { xsd:string }? &
- attribute vespamalloc-debug-stacktrace { xsd:string }? &
+ attribute no-vespamalloc { xsd:NMTOKENS }? &
+ attribute vespamalloc { xsd:NMTOKENS }? &
+ attribute vespamalloc-debug { xsd:NMTOKENS }? &
+ attribute vespamalloc-debug-stacktrace { xsd:NMTOKENS }? &
attribute distribution-key { xsd:nonNegativeInteger }? &
(
ContentNode +
diff --git a/config-model/src/test/schema-test-files/services-bad-vespamalloc.xml b/config-model/src/test/schema-test-files/services-bad-vespamalloc.xml
new file mode 100644
index 00000000000..9245d976128
--- /dev/null
+++ b/config-model/src/test/schema-test-files/services-bad-vespamalloc.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!-- Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<services version="1.0">
+
+ <content id="foo" version="1.0">
+ <redundancy>2</redundancy>
+ <documents>
+ <document type='bar' mode="index"/>
+ </documents>
+ <nodes count="1" no-vespamalloc="`curl something`"/>
+ </content>
+
+</services>
diff --git a/config-model/src/test/schema-test-files/services-hosted.xml b/config-model/src/test/schema-test-files/services-hosted.xml
index 8ce35f5efbd..2fbb0bc979b 100644
--- a/config-model/src/test/schema-test-files/services-hosted.xml
+++ b/config-model/src/test/schema-test-files/services-hosted.xml
@@ -22,14 +22,14 @@
<content id="search" version="1.0">
<redundancy>2</redundancy>
- <nodes count="7" flavor="large" groups="12">
+ <nodes count="7" flavor="large" groups="12" no-vespamalloc="proton distributord">
<resources vcpu="3.0" memory="32000.0Mb" disk="300 Gb"/>
</nodes>
</content>
<content id="ml" version="1.0">
<redundancy>2</redundancy>
- <nodes count="[10,20]" flavor="large" groups="[1,3]">
+ <nodes count="[10,20]" flavor="large" groups="[1,3]" vespamalloc-debug-stacktrace="proton">
<resources vcpu="[3.0, 4]" memory="[32000.0Mb, 33Gb]" disk="[300 Gb, 1Tb]"/>
</nodes>
</content>
diff --git a/config-model/src/test/sh/test-schema.sh b/config-model/src/test/sh/test-schema.sh
index 11e592d1bce..efee3087ebe 100755
--- a/config-model/src/test/sh/test-schema.sh
+++ b/config-model/src/test/sh/test-schema.sh
@@ -32,3 +32,10 @@ $cmd
cmd="java -jar $jar target/generated-sources/trang/resources/schema/validation-overrides.rng src/test/schema-test-files/validation-overrides.xml"
echo $cmd
$cmd
+
+cmd="java -jar $jar target/generated-sources/trang/resources/schema/services.rng src/test/schema-test-files/services-bad-vespamalloc.xml"
+echo $cmd
+if $cmd; then
+ echo 'invalid attribute not detected'
+ exit 1
+fi