Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address issues identified by Craig Berry's eXist 5 audit script #66

Open
joewiz opened this issue Sep 16, 2019 · 1 comment
Open

Address issues identified by Craig Berry's eXist 5 audit script #66

joewiz opened this issue Sep 16, 2019 · 1 comment
Labels

Comments

@joewiz
Copy link
Member

joewiz commented Sep 16, 2019

Running https://github.com/craigberry/audit_exist_5x_removals on this repository reveals several outstanding issues:

Replace the following instances of the function map:new with map:merge

./modules/search.xql:48 		        templates:process($node/*, map:new((map { "results-by-entry" := $match, "id" := $entry/atom:id, "entry" := $entry }, $model)))
./modules/app.xql:82                     templates:process($node/*[1], map:new(($model, map { "entry" := $entry, "count" := count($entries) }))),
./modules/app.xql:83                 templates:process($node/*[2], map:new(($model, map { "count" := count($entries), "perPage" := $count })))
./modules/app.xql:141                         templates:process($node/node(), map:new(($model, map { "entry" := $entry })))
./modules/app.xql:143                 templates:process($node/node(), map:new(($model, map { "entry" := atomic:create-entry() })))
./modules/gallery.xql:524         templates:process($node/node(), map:new(($model, map {"entry" := $entry, "index" := ($start + $index -1)})))            
./modules/restxq.xql:191                             map:new(($params, map:entry($var, $accessor)))
./modules/restxq.xql:235         map:new(($params, map:entry($var, $param)))
./modules/restxq.xql:246         map:new(($params, map:entry($var, $header)))
./modules/restxq.xql:274                 map:new((
./modules/acl.xql:122                     let $processed := templates:copy-node($node, map:new(($model, map { "permissions" := $permissions })))

Replace the following instances of the function xmldb:copy with xmldb:copy-collection or xmldb:copy-resource (no replacement in 4.x.x!)

./modules/migrate.xql:98         xmldb:copy($source, $target, $resource),

Replace the following instances of the function xmldb:get-current-user with sm:id

./modules/atomic.xql:77         <atom:author><atom:name>{ xmldb:get-current-user() }</atom:name></atom:author>
./modules/atomic.xql:86         <atom:author><atom:name>{ xmldb:get-current-user() }</atom:name></atom:author>
./modules/atomic.xql:151         if ($lock and not($lock = xmldb:get-current-user())) then
./modules/atomic.xql:157                     <wiki:lock user="{xmldb:get-current-user()}"/>
./modules/annotations.xql:45                 <user>{xmldb:get-current-user()}</user>
./modules/annotations.xql:87             <user>{xmldb:get-current-user()}</user>
./modules/app.xql:388         if ($lockedBy and not($lockedBy = xmldb:get-current-user())) then
./modules/app.xql:397         if ($lockedBy and not($lockedBy = xmldb:get-current-user())) then
./modules/app.xql:417     let $user := xmldb:get-current-user()
./modules/store.xql:32         if ($owner != xmldb:get-current-user()) then
./modules/store.xql:166     let $user := xmldb:get-current-user()
./modules/store.xql:210                 <atom:name>{xmldb:get-current-user()}</atom:name>
./modules/store.xql:229     let $author := request:get-parameter("author", xmldb:get-current-user())
./modules/store.xql:260                     if (xmldb:get-current-user() = $author) then
./modules/store.xql:320                     <wiki:lock user="{xmldb:get-current-user()}"/>
./modules/store.xql:368     let $author := request:get-parameter("author", xmldb:get-current-user())
./modules/store.xql:383             <atom:author><atom:name>{ xmldb:get-current-user() }</atom:name></atom:author>
./modules/store.xql:395         if ($owner = xmldb:get-current-user()) then (
./modules/acl.xql:65     acl:get-user-name(xmldb:get-current-user())
./modules/acl.xql:85     let $user := xmldb:get-current-user()
./modules/acl.xql:116                 if ($owner != xmldb:get-current-user()) then

Replace the following instances of the function xmldb:get-user-groups with sm:get-user-groups

./controller.xql:37     if ($config:users-group = xmldb:get-user-groups($user)) then

Replace the following instances of the function xmldb:get-users with sm:list-users

./modules/users.xql:58                         for $user in xmldb:get-users($group)
./modules/users.xql:88     let $managers := xmldb:get-users($config:admin-group)
./modules/users.xql:179     let $managers := xmldb:get-users($config:admin-group)

Replace the following instances of the function xmldb:is-admin-user with sm:is-dba

./modules/login.xql:87     if (not($asDba) or xmldb:is-admin-user($user)) then (
./modules/login.xql:137         if ($isLoggedIn and (not($asDba) or xmldb:is-admin-user($user))) then (

Replace the following instances of the module datetime with XQuery 3.1, FunctX, or other implementations

./modules/dates.xql:5 import module namespace dt="http://exist-db.org/xquery/datetime" at "java:org.exist.xquery.modules.datetime.DateTimeModule";
./modules/app.xql:10 import module namespace date="http://exist-db.org/xquery/datetime" at "java:org.exist.xquery.modules.datetime.DateTimeModule";

Replace the following instances of the module httpclient with EXPath HTTP Client

./data/util/TwitterUserFeed.xql:7 import module namespace httpclient="http://exist-db.org/xquery/httpclient"
@joewiz
Copy link
Member Author

joewiz commented Oct 14, 2019

@duncdrum noted in last week's community call many of these were fixed. I re-ran the latest version of the script on the latest, and got these remaining issues:

$ perl ../audit_exist_5x_removals/audit_removals.pl 

>>>  Replace the following instances of the function httpclient:get with EXPath HTTP Client.

./src/main/xar-resources/modules/display/image-view.xql:21             let $response := httpclient:get($image-href, false(), ())
./src/main/xar-resources/data/util/TwitterUserFeed.xql:18     let $response := httpclient:get($uri, false(), ())

>>>  Replace the following instances of the module httpclient with EXPath HTTP Client.

./src/main/xar-resources/data/util/TwitterUserFeed.xql:7 import module namespace httpclient="http://exist-db.org/xquery/httpclient"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant