Commit b0a82570 authored by mrodzis's avatar mrodzis 🦊 Committed by Mathias Goebel

Bugfix/restrict fork name #67

parent e75c4921
......@@ -17,7 +17,7 @@ declare namespace expath="http://expath.org/ns/pkg";
declare namespace repo="http://exist-db.org/xquery/repo";
(:~
: Generate a password in the given length.
: Generates a password in the given length.
:
: @param $length the length of the resulting password
: @author Mathias Göbel
......@@ -25,7 +25,7 @@ declare namespace repo="http://exist-db.org/xquery/repo";
: :)
declare function local:passwordGenerator($length as xs:integer) {
if($length lt 10)
then error( QName("https://sade.textgrid.de/ns/error", "FORK04"), "Short password. use at least 10 chars")
then error( QName("https://sade.textgrid.de/ns/error", "FORK04"), "Short password. Use at least 10 characters.")
else
(: charmap must not contain characters that do not evaluate against xs:anyURI
or a regular expression REPLACEMENT. :)
......@@ -59,6 +59,7 @@ declare variable $repoConf :=
<author>Mathias Göbel</author>
<author>Markus Matoni</author>
<author>Ubbo Veentjer</author>
<author>Michelle Weidling</author>
<website>https://sade.textgrid.de</website>
<status>alpha</status>
<license>GNU-LGPL</license>
......@@ -97,7 +98,15 @@ declare function local:xar($app-collection as xs:string, $expand-xincludes as xs
$xar
};
if( $target = "" ) then error( QName("https://sade.textgrid.de/ns/error", "FORK01"), "No target provided.") else
let $listTargetsNotAllowed := ("develop", xmldb:get-child-collections('/db/apps')[starts-with(., "sade-")] ! substring-after(., "sade-"))
if( $target = "" ) then
error( QName("https://sade.textgrid.de/ns/error", "FORK01"), "No target provided.")
else if ( $target = $listTargetsNotAllowed ) then
error( QName("https://sade.textgrid.de/ns/error", "FORK05"), "The fork must not be namend " || string-join($listTargetsNotAllowed, "; ") || ".")
else if ( $expathConf/string(@name) = (//expath:package/string(@name)) )
error( QName("https://sade.textgrid.de/ns/error", "FORK06"), "Target collection is available, but target name is not.")
else
let $expand-xincludes := request:get-parameter("expand-xincludes", "false") cast as xs:boolean
let $name := string($expathConf/@abbrev)
......
......@@ -14,6 +14,20 @@
<prepare>pre-install.xq</prepare>
<finish>post-install.xq</finish>
<changelog>
<change version="4.1.0">
<ul xmlns="http://www.w3.org/1999/xhtml">
<li class="feat">Features
<ul>
<li/>
</ul>
</li>
<li class="bugs">Bugfixes
<ul>
<li>test for invalid fork names (e.g. 'develop' and all present targets)</li>
</ul>
</li>
</ul>
</change>
<change version="4.0.0">
<ul xmlns="http://www.w3.org/1999/xhtml">
<li class="feat">Features
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment