diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b14043c94b89..5ca99bfe89ee 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,7 +4,23 @@ name: Build # Run this Build for all pushes / PRs to current branch -on: [push, pull_request] +on: + push: + # Don't run if PR is only updating static documentation + paths-ignore: + - '.gitignore' + - 'LICENSE' + - 'LICENSES_THIRD_PARTY' + - 'NOTICE' + - '**/*.md' + pull_request: + # Don't run if PR is only updating static documentation + paths-ignore: + - '.gitignore' + - 'LICENSE' + - 'LICENSES_THIRD_PARTY' + - 'NOTICE' + - '**/*.md' permissions: contents: read # to fetch code (actions/checkout) @@ -45,11 +61,11 @@ jobs: steps: # https://github.com/actions/checkout - name: Checkout codebase - uses: actions/checkout@v6 + uses: actions/checkout@v7 # https://github.com/actions/setup-java - name: Install JDK ${{ matrix.java }} - uses: actions/setup-java@v5 + uses: actions/setup-java@v6 with: java-version: ${{ matrix.java }} distribution: 'temurin' @@ -84,10 +100,13 @@ jobs: codecov: # Must run after 'tests' job above needs: tests + # Only run on the upstream repository: forks do not have the CODECOV_TOKEN secret, + # and Codecov refuses to create a commit on a protected branch without a token. + if: github.repository == 'dspace/dspace' runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@v7 # Download artifacts from previous 'tests' job - name: Download coverage artifacts diff --git a/.github/workflows/codescan.yml b/.github/workflows/codescan.yml index 90d79f9bfd60..5db501b72d77 100644 --- a/.github/workflows/codescan.yml +++ b/.github/workflows/codescan.yml @@ -17,8 +17,11 @@ on: - 'dspace-**' # Don't run if PR is only updating static documentation paths-ignore: + - '.gitignore' + - 'LICENSE' + - 'LICENSES_THIRD_PARTY' + - 'NOTICE' - '**/*.md' - - '**/*.txt' schedule: - cron: "37 0 * * 1" @@ -35,11 +38,11 @@ jobs: steps: # https://github.com/actions/checkout - name: Checkout repository - uses: actions/checkout@v6 + uses: actions/checkout@v7 # https://github.com/actions/setup-java - name: Install JDK - uses: actions/setup-java@v5 + uses: actions/setup-java@v6 with: java-version: 17 distribution: 'temurin' diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 5732a22d8277..7e3722e2a352 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -11,7 +11,21 @@ on: - 'dspace-**' tags: - 'dspace-**' + # Don't run if PR is only updating static documentation + paths-ignore: + - '.gitignore' + - 'LICENSE' + - 'LICENSES_THIRD_PARTY' + - 'NOTICE' + - '**/*.md' pull_request: + # Don't run if PR is only updating static documentation + paths-ignore: + - '.gitignore' + - 'LICENSE' + - 'LICENSES_THIRD_PARTY' + - 'NOTICE' + - '**/*.md' permissions: contents: read # to fetch code (actions/checkout) @@ -183,7 +197,7 @@ jobs: steps: # Checkout our codebase (to get access to Docker Compose scripts) - name: Checkout codebase - uses: actions/checkout@v6 + uses: actions/checkout@v7 # Download Docker image artifacts (which were just built by reusable-docker-build.yml) - name: Download Docker image artifacts uses: actions/download-artifact@v8 diff --git a/.github/workflows/issue_opened.yml b/.github/workflows/issue_opened.yml index c8c421d98f47..99dd91c74e31 100644 --- a/.github/workflows/issue_opened.yml +++ b/.github/workflows/issue_opened.yml @@ -16,7 +16,7 @@ jobs: # Only add to project board if issue is flagged as "needs triage" or has no labels # NOTE: By default we flag new issues as "needs triage" in our issue template if: (contains(github.event.issue.labels.*.name, 'needs triage') || join(github.event.issue.labels.*.name) == '') - uses: actions/add-to-project@v1.0.2 + uses: actions/add-to-project@v2 # Note, the authentication token below is an ORG level Secret. # It must be created/recreated manually via a personal access token with admin:org, project, public_repo permissions # See: https://docs.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token#permissions-for-the-github_token diff --git a/.github/workflows/port_merged_pull_request.yml b/.github/workflows/port_merged_pull_request.yml index 676ad45ba263..1eb4e52b762c 100644 --- a/.github/workflows/port_merged_pull_request.yml +++ b/.github/workflows/port_merged_pull_request.yml @@ -18,16 +18,26 @@ permissions: jobs: port_pr: - runs-on: ubuntu-latest - # Don't run on closed *unmerged* pull requests - if: github.event.pull_request.merged + runs-on: ubuntu-slim + # Only run on MERGED pull requests, + # and only run if the merged PR has a label that starts with "port to" + if: > + github.event.pull_request.merged && + contains(toJSON(github.event.pull_request.labels.*.name), '"port to ') steps: # Checkout code - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 + with: + # When using 'pull_request_target' (see above), this 'checkout' step will always fail because it + # may make the codebase vulnerable to "pwn requests" via the user-created PR. + # See https://docs.github.com/en/actions/reference/security/securely-using-pull_request_target + # However, we are allowing this unsafe checkout because (1) it's required to backport the PR, and + # (2) this job only runs when a PR is MERGED, and merger only happens after a thorough review of the PR. + allow-unsafe-pr-checkout: true # Port PR to other branch (ONLY if labeled with "port to") # See https://github.com/korthout/backport-action - name: Create backport pull requests - uses: korthout/backport-action@v4 + uses: korthout/backport-action@v4.6.0 with: # Trigger based on a "port to [branch]" label on PR # (This label must specify the branch name to port to) diff --git a/.github/workflows/pull_request_opened.yml b/.github/workflows/pull_request_opened.yml index e2b6e8ba9c2c..1e17cedcd179 100644 --- a/.github/workflows/pull_request_opened.yml +++ b/.github/workflows/pull_request_opened.yml @@ -21,4 +21,4 @@ jobs: # Assign the PR to whomever created it. This is useful for visualizing assignments on project boards # See https://github.com/toshimaru/auto-author-assign - name: Assign PR to creator - uses: toshimaru/auto-author-assign@v3.0.1 + uses: toshimaru/auto-author-assign@v3.1.0 diff --git a/.github/workflows/reusable-docker-build.yml b/.github/workflows/reusable-docker-build.yml index 768adb8f1602..8099760edcd6 100644 --- a/.github/workflows/reusable-docker-build.yml +++ b/.github/workflows/reusable-docker-build.yml @@ -109,7 +109,7 @@ jobs: # https://github.com/actions/checkout - name: Checkout codebase - uses: actions/checkout@v6 + uses: actions/checkout@v7 # https://github.com/docker/login-action # NOTE: This login occurs for BOTH non-PRs or PRs. PRs *must* also login to access private images from GHCR diff --git a/LICENSES_THIRD_PARTY b/LICENSES_THIRD_PARTY index c65827035560..d023c05487d6 100644 --- a/LICENSES_THIRD_PARTY +++ b/LICENSES_THIRD_PARTY @@ -18,28 +18,32 @@ dependencies that are solely released under GPL terms. For more info see: https://wiki.lyrasis.org/display/DSPACE/Code+Contribution+Guidelines --------------------------------------------------- + Apache License version 2.0: + + * XML Resolver (org.xmlresolver:xmlresolver:5.3.3 - https://github.com/xmlresolver/xmlresolver) + Apache Software License, Version 2.0: * Ant-Contrib Tasks (ant-contrib:ant-contrib:1.0b3 - http://ant-contrib.sourceforge.net) * S3Mock - Testsupport - Testcontainers (com.adobe.testing:s3mock-testcontainers:4.12.4 - https://www.github.com/adobe/S3Mock/s3mock-testsupport-reactor/s3mock-testcontainers) * Titanium JSON-LD 1.1 (JRE11) (com.apicatalog:titanium-json-ld:1.3.2 - https://github.com/filip26/titanium-json-ld) * HPPC Collections (com.carrotsearch:hppc:0.8.1 - http://labs.carrotsearch.com/hppc.html/hppc) - * com.drewnoakes:metadata-extractor (com.drewnoakes:metadata-extractor:2.19.0 - https://drewnoakes.com/code/exif/) + * com.drewnoakes:metadata-extractor (com.drewnoakes:metadata-extractor:2.20.0 - https://drewnoakes.com/code/exif/) * parso (com.epam:parso:2.0.14 - https://github.com/epam/parso) * Internet Time Utility (com.ethlo.time:itu:1.7.0 - https://github.com/ethlo/itu) * ClassMate (com.fasterxml:classmate:1.7.3 - https://github.com/FasterXML/java-classmate) - * Jackson-annotations (com.fasterxml.jackson.core:jackson-annotations:2.21 - https://github.com/FasterXML/jackson) - * Jackson-core (com.fasterxml.jackson.core:jackson-core:2.21.3 - https://github.com/FasterXML/jackson-core) - * jackson-databind (com.fasterxml.jackson.core:jackson-databind:2.21.3 - https://github.com/FasterXML/jackson) + * Jackson-annotations (com.fasterxml.jackson.core:jackson-annotations:2.22 - https://github.com/FasterXML/jackson) + * Jackson-core (com.fasterxml.jackson.core:jackson-core:2.22.2 - https://github.com/FasterXML/jackson-core) + * jackson-databind (com.fasterxml.jackson.core:jackson-databind:2.22.2 - https://github.com/FasterXML/jackson) * Jackson dataformat: Smile (com.fasterxml.jackson.dataformat:jackson-dataformat-smile:2.15.2 - https://github.com/FasterXML/jackson-dataformats-binary) * Jackson-dataformat-TOML (com.fasterxml.jackson.dataformat:jackson-dataformat-toml:2.15.2 - https://github.com/FasterXML/jackson-dataformats-text) * Jackson-dataformat-YAML (com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.16.2 - https://github.com/FasterXML/jackson-dataformats-text) - * Jackson datatype: jdk8 (com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.21.2 - https://github.com/FasterXML/jackson-modules-java8/jackson-datatype-jdk8) - * Jackson datatype: JSR310 (com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.21.3 - https://github.com/FasterXML/jackson-modules-java8/jackson-datatype-jsr310) + * Jackson datatype: jdk8 (com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.21.4 - https://github.com/FasterXML/jackson-modules-java8/jackson-datatype-jdk8) + * Jackson datatype: JSR310 (com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.22.2 - https://github.com/FasterXML/jackson-modules-java8/jackson-datatype-jsr310) * Jackson Jakarta-RS: base (com.fasterxml.jackson.jakarta.rs:jackson-jakarta-rs-base:2.16.2 - https://github.com/FasterXML/jackson-jakarta-rs-providers/jackson-jakarta-rs-base) * Jackson Jakarta-RS: JSON (com.fasterxml.jackson.jakarta.rs:jackson-jakarta-rs-json-provider:2.16.2 - https://github.com/FasterXML/jackson-jakarta-rs-providers/jackson-jakarta-rs-json-provider) * Jackson module: Jakarta XML Bind Annotations (jakarta.xml.bind) (com.fasterxml.jackson.module:jackson-module-jakarta-xmlbind-annotations:2.16.2 - https://github.com/FasterXML/jackson-modules-base) - * Jackson-module-parameter-names (com.fasterxml.jackson.module:jackson-module-parameter-names:2.21.2 - https://github.com/FasterXML/jackson-modules-java8/jackson-module-parameter-names) + * Jackson-module-parameter-names (com.fasterxml.jackson.module:jackson-module-parameter-names:2.21.4 - https://github.com/FasterXML/jackson-modules-java8/jackson-module-parameter-names) * Java UUID Generator (com.fasterxml.uuid:java-uuid-generator:4.1.0 - https://github.com/cowtowncoder/java-uuid-generator) * Woodstox (com.fasterxml.woodstox:woodstox-core:6.5.1 - https://github.com/FasterXML/woodstox) * zjsonpatch (com.flipkart.zjsonpatch:zjsonpatch:0.4.16 - https://github.com/flipkart-incubator/zjsonpatch/) @@ -68,7 +72,7 @@ https://wiki.lyrasis.org/display/DSPACE/Code+Contribution+Guidelines * J2ObjC Annotations (com.google.j2objc:j2objc-annotations:1.3 - https://github.com/google/j2objc/) * J2ObjC Annotations (com.google.j2objc:j2objc-annotations:3.1 - https://github.com/google/j2objc/) * libphonenumber (com.googlecode.libphonenumber:libphonenumber:8.11.1 - https://github.com/google/libphonenumber/) - * Jackcess (com.healthmarketscience.jackcess:jackcess:4.0.10 - https://jackcess.sourceforge.io) + * Jackcess (com.healthmarketscience.jackcess:jackcess:4.0.11 - https://jackcess.sourceforge.io) * Jackcess Encrypt (com.healthmarketscience.jackcess:jackcess-encrypt:4.0.3 - http://jackcessencrypt.sf.net) * json-path (com.jayway.jsonpath:json-path:2.10.0 - https://github.com/jayway/JsonPath) * json-path-assert (com.jayway.jsonpath:json-path-assert:2.10.0 - https://github.com/jayway/JsonPath) @@ -92,13 +96,13 @@ https://wiki.lyrasis.org/display/DSPACE/Code+Contribution+Guidelines * SparseBitSet (com.zaxxer:SparseBitSet:1.3 - https://github.com/brettwooldridge/SparseBitSet) * Apache Commons BeanUtils (commons-beanutils:commons-beanutils:1.11.0 - https://commons.apache.org/proper/commons-beanutils) * Apache Commons CLI (commons-cli:commons-cli:1.11.0 - https://commons.apache.org/proper/commons-cli/) - * Apache Commons Codec (commons-codec:commons-codec:1.22.0 - https://commons.apache.org/proper/commons-codec/) + * Apache Commons Codec (commons-codec:commons-codec:1.22.1 - https://commons.apache.org/proper/commons-codec/) * Apache Commons Collections (commons-collections:commons-collections:3.2.2 - http://commons.apache.org/collections/) * Commons Digester (commons-digester:commons-digester:2.1 - http://commons.apache.org/digester/) * Apache Commons IO (commons-io:commons-io:2.22.0 - https://commons.apache.org/proper/commons-io/) * Commons Lang (commons-lang:commons-lang:2.6 - http://commons.apache.org/lang/) - * Apache Commons Logging (commons-logging:commons-logging:1.3.6 - https://commons.apache.org/proper/commons-logging/) - * Apache Commons Validator (commons-validator:commons-validator:1.10.1 - https://commons.apache.org/proper/commons-validator/) + * Apache Commons Logging (commons-logging:commons-logging:1.4.0 - https://commons.apache.org/proper/commons-logging/) + * Apache Commons Validator (commons-validator:commons-validator:1.11.0 - https://commons.apache.org/proper/commons-validator/) * GeoJson POJOs for Jackson (de.grundid.opendatalab:geojson-jackson:1.14 - https://github.com/opendatalab-de/geojson-jackson) * broker-client (eu.openaire:broker-client:1.1.2 - http://api.openaire.eu/broker/broker-client) * OpenAIRE Funders Model (eu.openaire:funders-model:2.0.0 - https://api.openaire.eu) @@ -108,10 +112,10 @@ https://wiki.lyrasis.org/display/DSPACE/Code+Contribution+Guidelines * Metrics Integration with JMX (io.dropwizard.metrics:metrics-jmx:4.1.5 - https://metrics.dropwizard.io/metrics-jmx) * JVM Integration for Metrics (io.dropwizard.metrics:metrics-jvm:4.1.5 - https://metrics.dropwizard.io/metrics-jvm) * SWORD v2 Common Server Library (forked) (io.gdcc:sword2-server:2.0.0 - https://github.com/gdcc/sword2-server) - * micrometer-commons (io.micrometer:micrometer-commons:1.15.11 - https://github.com/micrometer-metrics/micrometer) - * micrometer-core (io.micrometer:micrometer-core:1.15.11 - https://github.com/micrometer-metrics/micrometer) - * micrometer-jakarta9 (io.micrometer:micrometer-jakarta9:1.15.11 - https://github.com/micrometer-metrics/micrometer) - * micrometer-observation (io.micrometer:micrometer-observation:1.15.11 - https://github.com/micrometer-metrics/micrometer) + * micrometer-commons (io.micrometer:micrometer-commons:1.15.12 - https://github.com/micrometer-metrics/micrometer) + * micrometer-core (io.micrometer:micrometer-core:1.15.12 - https://github.com/micrometer-metrics/micrometer) + * micrometer-jakarta9 (io.micrometer:micrometer-jakarta9:1.15.12 - https://github.com/micrometer-metrics/micrometer) + * micrometer-observation (io.micrometer:micrometer-observation:1.15.12 - https://github.com/micrometer-metrics/micrometer) * Netty/Buffer (io.netty:netty-buffer:4.1.99.Final - https://netty.io/netty-buffer/) * Netty/Codec (io.netty:netty-codec:4.1.99.Final - https://netty.io/netty-codec/) * Netty/Codec/HTTP (io.netty:netty-codec-http:4.1.86.Final - https://netty.io/netty-codec-http/) @@ -166,7 +170,6 @@ https://wiki.lyrasis.org/display/DSPACE/Code+Contribution+Guidelines * eigenbase-properties (net.hydromatic:eigenbase-properties:1.1.5 - http://github.com/julianhyde/eigenbase-properties) * Java Native Access (net.java.dev.jna:jna:5.18.1 - https://github.com/java-native-access/jna) * json-unit-core (net.javacrumbs.json-unit:json-unit-core:2.36.0 - https://github.com/lukas-krecan/JsonUnit/json-unit-core) - * "Java Concurrency in Practice" book annotations (net.jcip:jcip-annotations:1.0 - http://jcip.net/) * ASM based accessors helper used by json-smart (net.minidev:accessors-smart:2.6.0 - https://urielch.github.io/) * JSON Small and Fast Parser (net.minidev:json-smart:2.6.0 - https://urielch.github.io/) * Abdera Core (org.apache.abdera:abdera-core:1.1.3 - http://abdera.apache.org/abdera-core) @@ -179,9 +182,9 @@ https://wiki.lyrasis.org/display/DSPACE/Code+Contribution+Guidelines * Calcite Linq4j (org.apache.calcite:calcite-linq4j:1.35.0 - https://calcite.apache.org) * Apache Calcite Avatica (org.apache.calcite.avatica:avatica-core:1.23.0 - https://calcite.apache.org/avatica) * Apache Calcite Avatica Metrics (org.apache.calcite.avatica:avatica-metrics:1.23.0 - https://calcite.apache.org/avatica) - * Apache Commons Collections (org.apache.commons:commons-collections4:4.5.0 - https://commons.apache.org/proper/commons-collections/) + * Apache Commons Collections (org.apache.commons:commons-collections4:4.6.0 - https://commons.apache.org/proper/commons-collections/) * Apache Commons Compress (org.apache.commons:commons-compress:1.28.0 - https://commons.apache.org/proper/commons-compress/) - * Apache Commons Configuration (org.apache.commons:commons-configuration2:2.15.0 - https://commons.apache.org/proper/commons-configuration/) + * Apache Commons Configuration (org.apache.commons:commons-configuration2:2.15.1 - https://commons.apache.org/proper/commons-configuration/) * Apache Commons CSV (org.apache.commons:commons-csv:1.14.1 - https://commons.apache.org/proper/commons-csv/) * Apache Commons DBCP (org.apache.commons:commons-dbcp2:2.14.0 - https://commons.apache.org/proper/commons-dbcp/) * Apache Commons Digester (org.apache.commons:commons-digester3:3.2 - http://commons.apache.org/digester/) @@ -204,13 +207,13 @@ https://wiki.lyrasis.org/display/DSPACE/Code+Contribution+Guidelines * Apache HttpCore (org.apache.httpcomponents:httpcore:4.4.16 - http://hc.apache.org/httpcomponents-core-ga) * Apache HttpClient Mime (org.apache.httpcomponents:httpmime:4.5.14 - http://hc.apache.org/httpcomponents-client-ga) * Apache HttpClient (org.apache.httpcomponents.client5:httpclient5:5.1.3 - https://hc.apache.org/httpcomponents-client-5.0.x/5.1.3/httpclient5/) - * Apache HttpClient (org.apache.httpcomponents.client5:httpclient5:5.6.1 - https://hc.apache.org/httpcomponents-client-5.5.x/5.6.1/httpclient5/) + * Apache HttpClient (org.apache.httpcomponents.client5:httpclient5:5.6.4 - https://hc.apache.org/httpcomponents-client-5.6.x/5.6.4/httpclient5/) * Apache HttpComponents Core HTTP/1.1 (org.apache.httpcomponents.core5:httpcore5:5.1.3 - https://hc.apache.org/httpcomponents-core-5.1.x/5.1.3/httpcore5/) - * Apache HttpComponents Core HTTP/1.1 (org.apache.httpcomponents.core5:httpcore5:5.4 - https://hc.apache.org/httpcomponents-core-5.4.x/5.4/httpcore5/) + * Apache HttpComponents Core HTTP/1.1 (org.apache.httpcomponents.core5:httpcore5:5.4.3 - https://hc.apache.org/httpcomponents-core-5.4.x/5.4.3/httpcore5/) * Apache HttpComponents Core HTTP/2 (org.apache.httpcomponents.core5:httpcore5-h2:5.1.3 - https://hc.apache.org/httpcomponents-core-5.1.x/5.1.3/httpcore5-h2/) - * Apache HttpComponents Core HTTP/2 (org.apache.httpcomponents.core5:httpcore5-h2:5.4 - https://hc.apache.org/httpcomponents-core-5.4.x/5.4/httpcore5-h2/) + * Apache HttpComponents Core HTTP/2 (org.apache.httpcomponents.core5:httpcore5-h2:5.4.3 - https://hc.apache.org/httpcomponents-core-5.4.x/5.4.3/httpcore5-h2/) * Apache James :: Mime4j :: Core (org.apache.james:apache-mime4j-core:0.8.14 - http://james.apache.org/mime4j/apache-mime4j-core) - * Apache James :: Mime4j :: DOM (org.apache.james:apache-mime4j-dom:0.8.13 - http://james.apache.org/mime4j/apache-mime4j-dom) + * Apache James :: Mime4j :: DOM (org.apache.james:apache-mime4j-dom:0.8.14 - http://james.apache.org/mime4j/apache-mime4j-dom) * Apache Jena - Libraries POM (org.apache.jena:apache-jena-libs:4.10.0 - https://jena.apache.org/apache-jena-libs/) * Apache Jena - ARQ (org.apache.jena:jena-arq:4.10.0 - https://jena.apache.org/jena-arq/) * Apache Jena - Base (org.apache.jena:jena-base:4.10.0 - https://jena.apache.org/jena-base/) @@ -232,12 +235,12 @@ https://wiki.lyrasis.org/display/DSPACE/Code+Contribution+Guidelines * Kerby ASN1 Project (org.apache.kerby:kerby-asn1:1.0.1 - http://directory.apache.org/kerby/kerby-common/kerby-asn1) * Kerby PKIX Project (org.apache.kerby:kerby-pkix:1.0.1 - http://directory.apache.org/kerby/kerby-pkix) * Apache Log4j 1.x Compatibility API (org.apache.logging.log4j:log4j-1.2-api:2.17.2 - https://logging.apache.org/log4j/2.x/log4j-1.2-api/) - * Apache Log4j API (org.apache.logging.log4j:log4j-api:2.25.4 - https://logging.apache.org/log4j/2.x/) - * Apache Log4j Core (org.apache.logging.log4j:log4j-core:2.25.4 - https://logging.apache.org/log4j/2.x/) + * Apache Log4j API (org.apache.logging.log4j:log4j-api:2.26.1 - https://logging.apache.org/log4j/2.x/) + * Apache Log4j Core (org.apache.logging.log4j:log4j-core:2.26.1 - https://logging.apache.org/log4j/2.x/) * Apache Log4j JUL Adapter (org.apache.logging.log4j:log4j-jul:2.24.3 - https://logging.apache.org/log4j/2.x/log4j/log4j-jul/) * Apache Log4j Layout for JSON template (org.apache.logging.log4j:log4j-layout-template-json:2.17.2 - https://logging.apache.org/log4j/2.x/log4j-layout-template-json/) * Apache Log4j SLF4J Binding (org.apache.logging.log4j:log4j-slf4j-impl:2.17.2 - https://logging.apache.org/log4j/2.x/log4j-slf4j-impl/) - * SLF4J 2 Provider for Log4j API (org.apache.logging.log4j:log4j-slf4j2-impl:2.25.4 - https://logging.apache.org/log4j/2.x/) + * SLF4J 2 Provider for Log4j API (org.apache.logging.log4j:log4j-slf4j2-impl:2.26.1 - https://logging.apache.org/log4j/2.x/) * Apache Log4j Web (org.apache.logging.log4j:log4j-web:2.17.2 - https://logging.apache.org/log4j/2.x/log4j-web/) * Lucene Common Analyzers (org.apache.lucene:lucene-analyzers-common:8.11.4 - https://lucene.apache.org/lucene-parent/lucene-analyzers-common) * Lucene ICU Analysis Components (org.apache.lucene:lucene-analyzers-icu:8.11.4 - https://lucene.apache.org/lucene-parent/lucene-analyzers-icu) @@ -262,13 +265,13 @@ https://wiki.lyrasis.org/display/DSPACE/Code+Contribution+Guidelines * Lucene Spatial Extras (org.apache.lucene:lucene-spatial-extras:8.11.4 - https://lucene.apache.org/lucene-parent/lucene-spatial-extras) * Lucene Spatial 3D (org.apache.lucene:lucene-spatial3d:8.11.4 - https://lucene.apache.org/lucene-parent/lucene-spatial3d) * Lucene Suggest (org.apache.lucene:lucene-suggest:8.11.4 - https://lucene.apache.org/lucene-parent/lucene-suggest) - * Apache FontBox (org.apache.pdfbox:fontbox:3.0.7 - http://pdfbox.apache.org/) - * PDFBox JBIG2 ImageIO plugin (org.apache.pdfbox:jbig2-imageio:3.0.4 - https://www.apache.org/jbig2-imageio/) + * Apache FontBox (org.apache.pdfbox:fontbox:3.0.8 - http://pdfbox.apache.org/) + * PDFBox JBIG2 ImageIO plugin (org.apache.pdfbox:jbig2-imageio:3.0.5 - https://www.apache.org/jbig2-imageio/) * Apache JempBox (org.apache.pdfbox:jempbox:1.8.17 - http://www.apache.org/pdfbox-parent/jempbox/) - * Apache PDFBox (org.apache.pdfbox:pdfbox:3.0.7 - https://www.apache.org/pdfbox-parent/pdfbox/) - * Apache PDFBox io (org.apache.pdfbox:pdfbox-io:3.0.7 - https://www.apache.org/pdfbox-parent/pdfbox-io/) - * Apache PDFBox tools (org.apache.pdfbox:pdfbox-tools:3.0.7 - https://www.apache.org/pdfbox-parent/pdfbox-tools/) - * Apache XmpBox (org.apache.pdfbox:xmpbox:3.0.7 - https://www.apache.org/pdfbox-parent/xmpbox/) + * Apache PDFBox (org.apache.pdfbox:pdfbox:3.0.8 - https://www.apache.org/pdfbox-parent/pdfbox/) + * Apache PDFBox io (org.apache.pdfbox:pdfbox-io:3.0.8 - https://www.apache.org/pdfbox-parent/pdfbox-io/) + * Apache PDFBox tools (org.apache.pdfbox:pdfbox-tools:3.0.8 - https://www.apache.org/pdfbox-parent/pdfbox-tools/) + * Apache XmpBox (org.apache.pdfbox:xmpbox:3.0.8 - https://www.apache.org/pdfbox-parent/xmpbox/) * Apache POI - Common (org.apache.poi:poi:5.5.1 - https://poi.apache.org/) * Apache POI - API based on OPC and OOXML schemas (org.apache.poi:poi-ooxml:5.5.1 - https://poi.apache.org/) * Apache POI - OOXML schemas (full) (org.apache.poi:poi-ooxml-full:5.5.1 - https://poi.apache.org/) @@ -278,33 +281,33 @@ https://wiki.lyrasis.org/display/DSPACE/Code+Contribution+Guidelines * Apache Standard Taglib Implementation (org.apache.taglibs:taglibs-standard-impl:1.2.5 - http://tomcat.apache.org/taglibs/standard-1.2.5/taglibs-standard-impl) * Apache Standard Taglib Specification API (org.apache.taglibs:taglibs-standard-spec:1.2.5 - http://tomcat.apache.org/taglibs/standard-1.2.5/taglibs-standard-spec) * Apache Thrift (org.apache.thrift:libthrift:0.19.0 - http://thrift.apache.org) - * Apache Tika core (org.apache.tika:tika-core:3.3.0 - https://tika.apache.org/) - * Apache Tika Apple parser module (org.apache.tika:tika-parser-apple-module:3.3.0 - https://tika.apache.org/tika-parser-apple-module/) - * Apache Tika audiovideo parser module (org.apache.tika:tika-parser-audiovideo-module:3.3.0 - https://tika.apache.org/tika-parser-audiovideo-module/) - * Apache Tika cad parser module (org.apache.tika:tika-parser-cad-module:3.3.0 - https://tika.apache.org/tika-parser-cad-module/) - * Apache Tika code parser module (org.apache.tika:tika-parser-code-module:3.3.0 - https://tika.apache.org/tika-parser-code-module/) - * Apache Tika crypto parser module (org.apache.tika:tika-parser-crypto-module:3.3.0 - https://tika.apache.org/tika-parser-crypto-module/) - * Apache Tika digest commons (org.apache.tika:tika-parser-digest-commons:3.3.0 - https://tika.apache.org/tika-parser-digest-commons/) - * Apache Tika font parser module (org.apache.tika:tika-parser-font-module:3.3.0 - https://tika.apache.org/tika-parser-font-module/) - * Apache Tika html parser module (org.apache.tika:tika-parser-html-module:3.3.0 - https://tika.apache.org/tika-parser-html-module/) - * Apache Tika image parser module (org.apache.tika:tika-parser-image-module:3.3.0 - https://tika.apache.org/tika-parser-image-module/) - * Apache Tika mail commons (org.apache.tika:tika-parser-mail-commons:3.3.0 - https://tika.apache.org/tika-parser-mail-commons/) - * Apache Tika mail parser module (org.apache.tika:tika-parser-mail-module:3.3.0 - https://tika.apache.org/tika-parser-mail-module/) - * Apache Tika Microsoft parser module (org.apache.tika:tika-parser-microsoft-module:3.3.0 - https://tika.apache.org/tika-parser-microsoft-module/) - * Apache Tika miscellaneous office format parser module (org.apache.tika:tika-parser-miscoffice-module:3.3.0 - https://tika.apache.org/tika-parser-miscoffice-module/) - * Apache Tika news parser module (org.apache.tika:tika-parser-news-module:3.3.0 - https://tika.apache.org/tika-parser-news-module/) - * Apache Tika OCR parser module (org.apache.tika:tika-parser-ocr-module:3.3.0 - https://tika.apache.org/tika-parser-ocr-module/) - * Apache Tika PDF parser module (org.apache.tika:tika-parser-pdf-module:3.3.0 - https://tika.apache.org/tika-parser-pdf-module/) - * Apache Tika package parser module (org.apache.tika:tika-parser-pkg-module:3.3.0 - https://tika.apache.org/tika-parser-pkg-module/) - * Apache Tika text parser module (org.apache.tika:tika-parser-text-module:3.3.0 - https://tika.apache.org/tika-parser-text-module/) - * Apache Tika WARC parser module (org.apache.tika:tika-parser-webarchive-module:3.3.0 - https://tika.apache.org/tika-parser-webarchive-module/) - * Apache Tika XML parser module (org.apache.tika:tika-parser-xml-module:3.3.0 - https://tika.apache.org/tika-parser-xml-module/) - * Apache Tika XMP commons (org.apache.tika:tika-parser-xmp-commons:3.3.0 - https://tika.apache.org/tika-parser-xmp-commons/) - * Apache Tika ZIP commons (org.apache.tika:tika-parser-zip-commons:3.3.0 - https://tika.apache.org/tika-parser-zip-commons/) - * Apache Tika standard parser package (org.apache.tika:tika-parsers-standard-package:3.3.0 - https://tika.apache.org/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/) - * tomcat-embed-core (org.apache.tomcat.embed:tomcat-embed-core:10.1.54 - https://tomcat.apache.org/) - * tomcat-embed-el (org.apache.tomcat.embed:tomcat-embed-el:10.1.54 - https://tomcat.apache.org/) - * tomcat-embed-websocket (org.apache.tomcat.embed:tomcat-embed-websocket:10.1.54 - https://tomcat.apache.org/) + * Apache Tika core (org.apache.tika:tika-core:3.3.2 - https://tika.apache.org/) + * Apache Tika Apple parser module (org.apache.tika:tika-parser-apple-module:3.3.2 - https://tika.apache.org/tika-parser-apple-module/) + * Apache Tika audiovideo parser module (org.apache.tika:tika-parser-audiovideo-module:3.3.2 - https://tika.apache.org/tika-parser-audiovideo-module/) + * Apache Tika cad parser module (org.apache.tika:tika-parser-cad-module:3.3.2 - https://tika.apache.org/tika-parser-cad-module/) + * Apache Tika code parser module (org.apache.tika:tika-parser-code-module:3.3.2 - https://tika.apache.org/tika-parser-code-module/) + * Apache Tika crypto parser module (org.apache.tika:tika-parser-crypto-module:3.3.2 - https://tika.apache.org/tika-parser-crypto-module/) + * Apache Tika digest commons (org.apache.tika:tika-parser-digest-commons:3.3.2 - https://tika.apache.org/tika-parser-digest-commons/) + * Apache Tika font parser module (org.apache.tika:tika-parser-font-module:3.3.2 - https://tika.apache.org/tika-parser-font-module/) + * Apache Tika html parser module (org.apache.tika:tika-parser-html-module:3.3.2 - https://tika.apache.org/tika-parser-html-module/) + * Apache Tika image parser module (org.apache.tika:tika-parser-image-module:3.3.2 - https://tika.apache.org/tika-parser-image-module/) + * Apache Tika mail commons (org.apache.tika:tika-parser-mail-commons:3.3.2 - https://tika.apache.org/tika-parser-mail-commons/) + * Apache Tika mail parser module (org.apache.tika:tika-parser-mail-module:3.3.2 - https://tika.apache.org/tika-parser-mail-module/) + * Apache Tika Microsoft parser module (org.apache.tika:tika-parser-microsoft-module:3.3.2 - https://tika.apache.org/tika-parser-microsoft-module/) + * Apache Tika miscellaneous office format parser module (org.apache.tika:tika-parser-miscoffice-module:3.3.2 - https://tika.apache.org/tika-parser-miscoffice-module/) + * Apache Tika news parser module (org.apache.tika:tika-parser-news-module:3.3.2 - https://tika.apache.org/tika-parser-news-module/) + * Apache Tika OCR parser module (org.apache.tika:tika-parser-ocr-module:3.3.2 - https://tika.apache.org/tika-parser-ocr-module/) + * Apache Tika PDF parser module (org.apache.tika:tika-parser-pdf-module:3.3.2 - https://tika.apache.org/tika-parser-pdf-module/) + * Apache Tika package parser module (org.apache.tika:tika-parser-pkg-module:3.3.2 - https://tika.apache.org/tika-parser-pkg-module/) + * Apache Tika text parser module (org.apache.tika:tika-parser-text-module:3.3.2 - https://tika.apache.org/tika-parser-text-module/) + * Apache Tika WARC parser module (org.apache.tika:tika-parser-webarchive-module:3.3.2 - https://tika.apache.org/tika-parser-webarchive-module/) + * Apache Tika XML parser module (org.apache.tika:tika-parser-xml-module:3.3.2 - https://tika.apache.org/tika-parser-xml-module/) + * Apache Tika XMP commons (org.apache.tika:tika-parser-xmp-commons:3.3.2 - https://tika.apache.org/tika-parser-xmp-commons/) + * Apache Tika ZIP commons (org.apache.tika:tika-parser-zip-commons:3.3.2 - https://tika.apache.org/tika-parser-zip-commons/) + * Apache Tika standard parser package (org.apache.tika:tika-parsers-standard-package:3.3.2 - https://tika.apache.org/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/) + * tomcat-embed-core (org.apache.tomcat.embed:tomcat-embed-core:10.1.55 - https://tomcat.apache.org/) + * tomcat-embed-el (org.apache.tomcat.embed:tomcat-embed-el:10.1.55 - https://tomcat.apache.org/) + * tomcat-embed-websocket (org.apache.tomcat.embed:tomcat-embed-websocket:10.1.55 - https://tomcat.apache.org/) * Apache Velocity - Engine (org.apache.velocity:velocity-engine-core:2.4.1 - http://velocity.apache.org/engine/devel/velocity-engine-core/) * Apache Velocity - JSR 223 Scripting (org.apache.velocity:velocity-engine-scripting:2.3 - http://velocity.apache.org/engine/devel/velocity-engine-scripting/) * Apache Velocity Tools - Generic tools (org.apache.velocity.tools:velocity-tools-generic:3.1 - https://velocity.apache.org/tools/devel/velocity-tools-generic/) @@ -365,12 +368,12 @@ https://wiki.lyrasis.org/display/DSPACE/Code+Contribution+Guidelines * flyway-database-postgresql (org.flywaydb:flyway-database-postgresql:10.22.0 - https://flywaydb.org/flyway-database-postgresql) * Ogg and Vorbis for Java, Core (org.gagravarr:vorbis-java-core:0.8 - https://github.com/Gagravarr/VorbisJava) * Apache Tika plugin for Ogg, Vorbis and FLAC (org.gagravarr:vorbis-java-tika:0.8 - https://github.com/Gagravarr/VorbisJava) - * jersey-core-client (org.glassfish.jersey.core:jersey-client:3.1.11 - https://projects.eclipse.org/projects/ee4j.jersey/jersey-client) - * jersey-core-common (org.glassfish.jersey.core:jersey-common:3.1.11 - https://projects.eclipse.org/projects/ee4j.jersey/jersey-common) - * jersey-inject-hk2 (org.glassfish.jersey.inject:jersey-hk2:3.1.11 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-hk2) + * jersey-core-client (org.glassfish.jersey.core:jersey-client:3.1.12 - https://projects.eclipse.org/projects/ee4j.jersey/jersey-client) + * jersey-core-common (org.glassfish.jersey.core:jersey-common:3.1.12 - https://projects.eclipse.org/projects/ee4j.jersey/jersey-common) + * jersey-inject-hk2 (org.glassfish.jersey.inject:jersey-hk2:3.1.12 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-hk2) * jersey-media-multipart (org.glassfish.jersey.media:jersey-media-multipart:3.1.3 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-media-multipart) - * Hibernate Validator Engine (org.hibernate.validator:hibernate-validator:8.0.3.Final - https://hibernate.org/validator) - * Hibernate Validator Portable Extension (org.hibernate.validator:hibernate-validator-cdi:8.0.3.Final - https://hibernate.org/validator) + * Hibernate Validator Engine (org.hibernate.validator:hibernate-validator:8.0.5.Final - https://hibernate.org/validator) + * Hibernate Validator Portable Extension (org.hibernate.validator:hibernate-validator-cdi:8.0.5.Final - https://hibernate.org/validator) * org.immutables.value-annotations (org.immutables:value-annotations:2.9.2 - http://immutables.org/value-annotations) * Javassist (org.javassist:javassist:3.30.2-GA - https://www.javassist.org/) * JBoss Logging 3 (org.jboss.logging:jboss-logging:3.5.0.Final - http://www.jboss.org) @@ -387,97 +390,92 @@ https://wiki.lyrasis.org/display/DSPACE/Code+Contribution+Guidelines * MockServer Core (org.mock-server:mockserver-core:5.15.0 - https://www.mock-server.com) * MockServer JUnit 4 Integration (org.mock-server:mockserver-junit-rule:5.15.0 - https://www.mock-server.com) * MockServer & Proxy Netty (org.mock-server:mockserver-netty:5.15.0 - https://www.mock-server.com) - * jwarc (org.netpreserve:jwarc:0.35.0 - https://github.com/iipc/jwarc) + * jwarc (org.netpreserve:jwarc:0.36.0 - https://github.com/iipc/jwarc) * Objenesis (org.objenesis:objenesis:3.2 - http://objenesis.org/objenesis) * org.roaringbitmap:RoaringBitmap (org.roaringbitmap:RoaringBitmap:1.0.0 - https://github.com/RoaringBitmap/RoaringBitmap) * RRD4J (org.rrd4j:rrd4j:3.5 - https://github.com/rrd4j/rrd4j/) * JSONassert (org.skyscreamer:jsonassert:1.5.3 - https://github.com/skyscreamer/JSONassert) - * JCL 1.2 implemented over SLF4J (org.slf4j:jcl-over-slf4j:2.0.17 - http://www.slf4j.org) - * Spring AOP (org.springframework:spring-aop:6.2.18 - https://github.com/spring-projects/spring-framework) - * Spring Beans (org.springframework:spring-beans:6.2.18 - https://github.com/spring-projects/spring-framework) - * Spring Context (org.springframework:spring-context:6.2.18 - https://github.com/spring-projects/spring-framework) - * Spring Context Support (org.springframework:spring-context-support:6.2.18 - https://github.com/spring-projects/spring-framework) - * Spring Core (org.springframework:spring-core:6.2.18 - https://github.com/spring-projects/spring-framework) - * Spring Expression Language (SpEL) (org.springframework:spring-expression:6.2.18 - https://github.com/spring-projects/spring-framework) - * Spring JDBC (org.springframework:spring-jdbc:6.2.18 - https://github.com/spring-projects/spring-framework) - * Spring Object/Relational Mapping (org.springframework:spring-orm:6.2.18 - https://github.com/spring-projects/spring-framework) - * Spring TestContext Framework (org.springframework:spring-test:6.2.18 - https://github.com/spring-projects/spring-framework) - * Spring Transaction (org.springframework:spring-tx:6.2.18 - https://github.com/spring-projects/spring-framework) - * Spring Web (org.springframework:spring-web:6.2.18 - https://github.com/spring-projects/spring-framework) - * Spring Web MVC (org.springframework:spring-webmvc:6.2.18 - https://github.com/spring-projects/spring-framework) - * spring-boot (org.springframework.boot:spring-boot:3.5.14 - https://spring.io/projects/spring-boot) - * spring-boot-actuator (org.springframework.boot:spring-boot-actuator:3.5.14 - https://spring.io/projects/spring-boot) - * spring-boot-actuator-autoconfigure (org.springframework.boot:spring-boot-actuator-autoconfigure:3.5.14 - https://spring.io/projects/spring-boot) - * spring-boot-autoconfigure (org.springframework.boot:spring-boot-autoconfigure:3.5.14 - https://spring.io/projects/spring-boot) - * spring-boot-starter (org.springframework.boot:spring-boot-starter:3.5.14 - https://spring.io/projects/spring-boot) - * spring-boot-starter-actuator (org.springframework.boot:spring-boot-starter-actuator:3.5.14 - https://spring.io/projects/spring-boot) - * spring-boot-starter-aop (org.springframework.boot:spring-boot-starter-aop:3.5.14 - https://spring.io/projects/spring-boot) - * spring-boot-starter-cache (org.springframework.boot:spring-boot-starter-cache:3.5.14 - https://spring.io/projects/spring-boot) - * spring-boot-starter-data-rest (org.springframework.boot:spring-boot-starter-data-rest:3.5.14 - https://spring.io/projects/spring-boot) - * spring-boot-starter-json (org.springframework.boot:spring-boot-starter-json:3.5.14 - https://spring.io/projects/spring-boot) - * spring-boot-starter-log4j2 (org.springframework.boot:spring-boot-starter-log4j2:3.5.14 - https://spring.io/projects/spring-boot) - * spring-boot-starter-security (org.springframework.boot:spring-boot-starter-security:3.5.14 - https://spring.io/projects/spring-boot) - * spring-boot-starter-test (org.springframework.boot:spring-boot-starter-test:3.5.14 - https://spring.io/projects/spring-boot) - * spring-boot-starter-thymeleaf (org.springframework.boot:spring-boot-starter-thymeleaf:3.5.14 - https://spring.io/projects/spring-boot) - * spring-boot-starter-tomcat (org.springframework.boot:spring-boot-starter-tomcat:3.5.14 - https://spring.io/projects/spring-boot) - * spring-boot-starter-web (org.springframework.boot:spring-boot-starter-web:3.5.14 - https://spring.io/projects/spring-boot) - * spring-boot-test (org.springframework.boot:spring-boot-test:3.5.14 - https://spring.io/projects/spring-boot) - * spring-boot-test-autoconfigure (org.springframework.boot:spring-boot-test-autoconfigure:3.5.14 - https://spring.io/projects/spring-boot) - * Spring Data Core (org.springframework.data:spring-data-commons:3.5.11 - https://spring.io/projects/spring-data) - * Spring Data REST - Core (org.springframework.data:spring-data-rest-core:4.5.11 - https://www.spring.io/spring-data/spring-data-rest-parent/spring-data-rest-core) - * Spring Data REST - WebMVC (org.springframework.data:spring-data-rest-webmvc:4.5.11 - https://www.spring.io/spring-data/spring-data-rest-parent/spring-data-rest-webmvc) - * Spring HATEOAS (org.springframework.hateoas:spring-hateoas:2.5.2 - https://github.com/spring-projects/spring-hateoas) - * spring-ldap-core (org.springframework.ldap:spring-ldap-core:3.3.7 - https://spring.io/projects/spring-ldap) + * JCL 1.2 implemented over SLF4J (org.slf4j:jcl-over-slf4j:2.0.18 - http://www.slf4j.org) + * Spring AOP (org.springframework:spring-aop:6.2.19 - https://github.com/spring-projects/spring-framework) + * Spring Beans (org.springframework:spring-beans:6.2.19 - https://github.com/spring-projects/spring-framework) + * Spring Context (org.springframework:spring-context:6.2.19 - https://github.com/spring-projects/spring-framework) + * Spring Context Support (org.springframework:spring-context-support:6.2.19 - https://github.com/spring-projects/spring-framework) + * Spring Core (org.springframework:spring-core:6.2.19 - https://github.com/spring-projects/spring-framework) + * Spring Expression Language (SpEL) (org.springframework:spring-expression:6.2.19 - https://github.com/spring-projects/spring-framework) + * Spring JDBC (org.springframework:spring-jdbc:6.2.19 - https://github.com/spring-projects/spring-framework) + * Spring Object/Relational Mapping (org.springframework:spring-orm:6.2.19 - https://github.com/spring-projects/spring-framework) + * Spring TestContext Framework (org.springframework:spring-test:6.2.19 - https://github.com/spring-projects/spring-framework) + * Spring Transaction (org.springframework:spring-tx:6.2.19 - https://github.com/spring-projects/spring-framework) + * Spring Web (org.springframework:spring-web:6.2.19 - https://github.com/spring-projects/spring-framework) + * Spring Web MVC (org.springframework:spring-webmvc:6.2.19 - https://github.com/spring-projects/spring-framework) + * spring-boot (org.springframework.boot:spring-boot:3.5.16 - https://spring.io/projects/spring-boot) + * spring-boot-actuator (org.springframework.boot:spring-boot-actuator:3.5.16 - https://spring.io/projects/spring-boot) + * spring-boot-actuator-autoconfigure (org.springframework.boot:spring-boot-actuator-autoconfigure:3.5.16 - https://spring.io/projects/spring-boot) + * spring-boot-autoconfigure (org.springframework.boot:spring-boot-autoconfigure:3.5.16 - https://spring.io/projects/spring-boot) + * spring-boot-starter (org.springframework.boot:spring-boot-starter:3.5.16 - https://spring.io/projects/spring-boot) + * spring-boot-starter-actuator (org.springframework.boot:spring-boot-starter-actuator:3.5.16 - https://spring.io/projects/spring-boot) + * spring-boot-starter-aop (org.springframework.boot:spring-boot-starter-aop:3.5.16 - https://spring.io/projects/spring-boot) + * spring-boot-starter-cache (org.springframework.boot:spring-boot-starter-cache:3.5.16 - https://spring.io/projects/spring-boot) + * spring-boot-starter-data-rest (org.springframework.boot:spring-boot-starter-data-rest:3.5.16 - https://spring.io/projects/spring-boot) + * spring-boot-starter-json (org.springframework.boot:spring-boot-starter-json:3.5.16 - https://spring.io/projects/spring-boot) + * spring-boot-starter-log4j2 (org.springframework.boot:spring-boot-starter-log4j2:3.5.16 - https://spring.io/projects/spring-boot) + * spring-boot-starter-security (org.springframework.boot:spring-boot-starter-security:3.5.16 - https://spring.io/projects/spring-boot) + * spring-boot-starter-test (org.springframework.boot:spring-boot-starter-test:3.5.16 - https://spring.io/projects/spring-boot) + * spring-boot-starter-thymeleaf (org.springframework.boot:spring-boot-starter-thymeleaf:3.5.16 - https://spring.io/projects/spring-boot) + * spring-boot-starter-tomcat (org.springframework.boot:spring-boot-starter-tomcat:3.5.16 - https://spring.io/projects/spring-boot) + * spring-boot-starter-web (org.springframework.boot:spring-boot-starter-web:3.5.16 - https://spring.io/projects/spring-boot) + * spring-boot-test (org.springframework.boot:spring-boot-test:3.5.16 - https://spring.io/projects/spring-boot) + * spring-boot-test-autoconfigure (org.springframework.boot:spring-boot-test-autoconfigure:3.5.16 - https://spring.io/projects/spring-boot) + * Spring Data Core (org.springframework.data:spring-data-commons:3.5.13 - https://spring.io/projects/spring-data) + * Spring Data REST - Core (org.springframework.data:spring-data-rest-core:4.5.13 - https://www.spring.io/spring-data/spring-data-rest-parent/spring-data-rest-core) + * Spring Data REST - WebMVC (org.springframework.data:spring-data-rest-webmvc:4.5.13 - https://www.spring.io/spring-data/spring-data-rest-parent/spring-data-rest-webmvc) + * Spring HATEOAS (org.springframework.hateoas:spring-hateoas:2.5.3 - https://github.com/spring-projects/spring-hateoas) + * spring-ldap-core (org.springframework.ldap:spring-ldap-core:3.3.8 - https://spring.io/projects/spring-ldap) * Spring Plugin - Core (org.springframework.plugin:spring-plugin-core:3.0.0 - https://github.com/spring-projects/spring-plugin/spring-plugin-core) - * spring-security-config (org.springframework.security:spring-security-config:6.5.10 - https://spring.io/projects/spring-security) - * spring-security-core (org.springframework.security:spring-security-core:6.5.10 - https://spring.io/projects/spring-security) - * spring-security-crypto (org.springframework.security:spring-security-crypto:6.5.10 - https://spring.io/projects/spring-security) - * spring-security-test (org.springframework.security:spring-security-test:6.5.10 - https://spring.io/projects/spring-security) - * spring-security-web (org.springframework.security:spring-security-web:6.5.10 - https://spring.io/projects/spring-security) + * spring-security-config (org.springframework.security:spring-security-config:6.5.11 - https://spring.io/projects/spring-security) + * spring-security-core (org.springframework.security:spring-security-core:6.5.11 - https://spring.io/projects/spring-security) + * spring-security-crypto (org.springframework.security:spring-security-crypto:6.5.11 - https://spring.io/projects/spring-security) + * spring-security-test (org.springframework.security:spring-security-test:6.5.11 - https://spring.io/projects/spring-security) + * spring-security-web (org.springframework.security:spring-security-web:6.5.11 - https://spring.io/projects/spring-security) * thymeleaf (org.thymeleaf:thymeleaf:3.1.5.RELEASE - http://www.thymeleaf.org/thymeleaf-lib/thymeleaf) * thymeleaf-spring6 (org.thymeleaf:thymeleaf-spring6:3.1.5.RELEASE - http://www.thymeleaf.org/thymeleaf-lib/thymeleaf-spring6) * unbescape (org.unbescape:unbescape:1.1.6.RELEASE - http://www.unbescape.org) * snappy-java (org.xerial.snappy:snappy-java:1.1.10.1 - https://github.com/xerial/snappy-java) * xml-matchers (org.xmlmatchers:xml-matchers:0.10 - http://code.google.com/p/xml-matchers/) * org.xmlunit:xmlunit-core (org.xmlunit:xmlunit-core:2.10.4 - https://www.xmlunit.org/) - * org.xmlunit:xmlunit-core (org.xmlunit:xmlunit-core:2.11.0 - https://www.xmlunit.org/) + * org.xmlunit:xmlunit-core (org.xmlunit:xmlunit-core:2.13.0 - https://www.xmlunit.org/) * org.xmlunit:xmlunit-placeholders (org.xmlunit:xmlunit-placeholders:2.9.1 - https://www.xmlunit.org/xmlunit-placeholders/) * SnakeYAML (org.yaml:snakeyaml:2.4 - https://bitbucket.org/snakeyaml/snakeyaml) - * AWS Java SDK :: Annotations (software.amazon.awssdk:annotations:2.43.2 - https://aws.amazon.com/sdkforjava/core/annotations) - * AWS Java SDK :: Arns (software.amazon.awssdk:arns:2.43.2 - https://aws.amazon.com/sdkforjava) - * AWS Java SDK :: Auth (software.amazon.awssdk:auth:2.43.2 - https://aws.amazon.com/sdkforjava) - * AWS Java SDK :: AWS Core (software.amazon.awssdk:aws-core:2.43.2 - https://aws.amazon.com/sdkforjava) - * AWS Java SDK :: Core :: Protocols :: AWS Query Protocol (software.amazon.awssdk:aws-query-protocol:2.43.2 - https://aws.amazon.com/sdkforjava) - * AWS Java SDK :: Core :: Protocols :: AWS Xml Protocol (software.amazon.awssdk:aws-xml-protocol:2.43.2 - https://aws.amazon.com/sdkforjava) - * AWS Java SDK :: Checksums (software.amazon.awssdk:checksums:2.43.2 - https://aws.amazon.com/sdkforjava) - * AWS Java SDK :: Checksums SPI (software.amazon.awssdk:checksums-spi:2.43.2 - https://aws.amazon.com/sdkforjava) - * AWS Java SDK :: AWS CRT Core (software.amazon.awssdk:crt-core:2.43.2 - https://aws.amazon.com/sdkforjava) - * AWS Java SDK :: Endpoints SPI (software.amazon.awssdk:endpoints-spi:2.43.2 - https://aws.amazon.com/sdkforjava/core/endpoints-spi) - * AWS Java SDK :: HTTP Auth (software.amazon.awssdk:http-auth:2.43.2 - https://aws.amazon.com/sdkforjava) - * AWS Java SDK :: HTTP Auth AWS (software.amazon.awssdk:http-auth-aws:2.43.2 - https://aws.amazon.com/sdkforjava) - * AWS Java SDK :: HTTP Auth Event Stream (software.amazon.awssdk:http-auth-aws-eventstream:2.43.2 - https://aws.amazon.com/sdkforjava) - * AWS Java SDK :: HTTP Auth SPI (software.amazon.awssdk:http-auth-spi:2.43.2 - https://aws.amazon.com/sdkforjava) - * AWS Java SDK :: HTTP Client Interface (software.amazon.awssdk:http-client-spi:2.43.2 - https://aws.amazon.com/sdkforjava/http-client-spi) - * AWS Java SDK :: Identity SPI (software.amazon.awssdk:identity-spi:2.43.2 - https://aws.amazon.com/sdkforjava) - * AWS Java SDK :: Core :: Protocols :: Json Utils (software.amazon.awssdk:json-utils:2.43.2 - https://aws.amazon.com/sdkforjava) - * AWS Java SDK :: Metrics SPI (software.amazon.awssdk:metrics-spi:2.43.2 - https://aws.amazon.com/sdkforjava/core/metrics-spi) - * AWS Java SDK :: Profiles (software.amazon.awssdk:profiles:2.43.2 - https://aws.amazon.com/sdkforjava) - * AWS Java SDK :: Core :: Protocols :: Protocol Core (software.amazon.awssdk:protocol-core:2.43.2 - https://aws.amazon.com/sdkforjava) - * AWS Java SDK :: Regions (software.amazon.awssdk:regions:2.43.2 - https://aws.amazon.com/sdkforjava/core/regions) - * AWS Java SDK :: Retries (software.amazon.awssdk:retries:2.43.2 - https://aws.amazon.com/sdkforjava/core/retries) - * AWS Java SDK :: Retries API (software.amazon.awssdk:retries-spi:2.43.2 - https://aws.amazon.com/sdkforjava/core/retries-spi) - * AWS Java SDK :: Services :: Amazon S3 (software.amazon.awssdk:s3:2.43.2 - https://aws.amazon.com/sdkforjava) - * AWS Java SDK :: SDK Core (software.amazon.awssdk:sdk-core:2.43.2 - https://aws.amazon.com/sdkforjava) - * AWS Java SDK :: Third Party :: Jackson-core (software.amazon.awssdk:third-party-jackson-core:2.43.2 - https://aws.amazon.com/sdkforjava) - * AWS Java SDK :: Utilities (software.amazon.awssdk:utils:2.43.2 - https://aws.amazon.com/sdkforjava/utils) - * AWS Java SDK :: Utils Lite (software.amazon.awssdk:utils-lite:2.43.2 - https://aws.amazon.com/sdkforjava) - * software.amazon.awssdk.crt:aws-crt (software.amazon.awssdk.crt:aws-crt:0.45.2 - https://github.com/awslabs/aws-crt-java) + * AWS Java SDK :: Annotations (software.amazon.awssdk:annotations:2.49.4 - https://aws.amazon.com/sdkforjava/core/annotations) + * AWS Java SDK :: Arns (software.amazon.awssdk:arns:2.49.4 - https://aws.amazon.com/sdkforjava) + * AWS Java SDK :: Auth (software.amazon.awssdk:auth:2.49.4 - https://aws.amazon.com/sdkforjava) + * AWS Java SDK :: AWS Core (software.amazon.awssdk:aws-core:2.49.4 - https://aws.amazon.com/sdkforjava) + * AWS Java SDK :: Core :: Protocols :: AWS Query Protocol (software.amazon.awssdk:aws-query-protocol:2.49.4 - https://aws.amazon.com/sdkforjava) + * AWS Java SDK :: Core :: Protocols :: AWS Xml Protocol (software.amazon.awssdk:aws-xml-protocol:2.49.4 - https://aws.amazon.com/sdkforjava) + * AWS Java SDK :: Checksums (software.amazon.awssdk:checksums:2.49.4 - https://aws.amazon.com/sdkforjava) + * AWS Java SDK :: Checksums SPI (software.amazon.awssdk:checksums-spi:2.49.4 - https://aws.amazon.com/sdkforjava) + * AWS Java SDK :: AWS CRT Core (software.amazon.awssdk:crt-core:2.49.4 - https://aws.amazon.com/sdkforjava) + * AWS Java SDK :: Endpoints SPI (software.amazon.awssdk:endpoints-spi:2.49.4 - https://aws.amazon.com/sdkforjava/core/endpoints-spi) + * AWS Java SDK :: HTTP Auth (software.amazon.awssdk:http-auth:2.49.4 - https://aws.amazon.com/sdkforjava) + * AWS Java SDK :: HTTP Auth AWS (software.amazon.awssdk:http-auth-aws:2.49.4 - https://aws.amazon.com/sdkforjava) + * AWS Java SDK :: HTTP Auth Event Stream (software.amazon.awssdk:http-auth-aws-eventstream:2.49.4 - https://aws.amazon.com/sdkforjava) + * AWS Java SDK :: HTTP Auth SPI (software.amazon.awssdk:http-auth-spi:2.49.4 - https://aws.amazon.com/sdkforjava) + * AWS Java SDK :: HTTP Client Interface (software.amazon.awssdk:http-client-spi:2.49.4 - https://aws.amazon.com/sdkforjava/http-client-spi) + * AWS Java SDK :: Identity SPI (software.amazon.awssdk:identity-spi:2.49.4 - https://aws.amazon.com/sdkforjava) + * AWS Java SDK :: Core :: Protocols :: Json Utils (software.amazon.awssdk:json-utils:2.49.4 - https://aws.amazon.com/sdkforjava) + * AWS Java SDK :: Metrics SPI (software.amazon.awssdk:metrics-spi:2.49.4 - https://aws.amazon.com/sdkforjava/core/metrics-spi) + * AWS Java SDK :: Profiles (software.amazon.awssdk:profiles:2.49.4 - https://aws.amazon.com/sdkforjava) + * AWS Java SDK :: Core :: Protocols :: Protocol Core (software.amazon.awssdk:protocol-core:2.49.4 - https://aws.amazon.com/sdkforjava) + * AWS Java SDK :: Regions (software.amazon.awssdk:regions:2.49.4 - https://aws.amazon.com/sdkforjava/core/regions) + * AWS Java SDK :: Retries (software.amazon.awssdk:retries:2.49.4 - https://aws.amazon.com/sdkforjava/core/retries) + * AWS Java SDK :: Retries API (software.amazon.awssdk:retries-spi:2.49.4 - https://aws.amazon.com/sdkforjava/core/retries-spi) + * AWS Java SDK :: Services :: Amazon S3 (software.amazon.awssdk:s3:2.49.4 - https://aws.amazon.com/sdkforjava) + * AWS Java SDK :: SDK Core (software.amazon.awssdk:sdk-core:2.49.4 - https://aws.amazon.com/sdkforjava) + * AWS Java SDK :: Third Party :: Jackson-core (software.amazon.awssdk:third-party-jackson-core:2.49.4 - https://aws.amazon.com/sdkforjava) + * AWS Java SDK :: Utilities (software.amazon.awssdk:utils:2.49.4 - https://aws.amazon.com/sdkforjava/utils) + * AWS Java SDK :: Utils Lite (software.amazon.awssdk:utils-lite:2.49.4 - https://aws.amazon.com/sdkforjava) + * software.amazon.awssdk.crt:aws-crt (software.amazon.awssdk.crt:aws-crt:0.48.1 - https://github.com/awslabs/aws-crt-java) * AWS Event Stream (software.amazon.eventstream:eventstream:1.0.1 - https://github.com/awslabs/aws-eventstream-java) - * Xerces2-j (xerces:xercesImpl:2.12.2 - https://xerces.apache.org/xerces2-j/) - - BSD 2-Clause License: - - * zstd-jni (com.github.luben:zstd-jni:1.5.7-4 - https://github.com/luben/zstd-jni) BSD License: @@ -490,15 +488,15 @@ https://wiki.lyrasis.org/display/DSPACE/Code+Contribution+Guidelines * Protocol Buffers [Core] (com.google.protobuf:protobuf-java:3.24.3 - https://developers.google.com/protocol-buffers/protobuf-java/) * JZlib (com.jcraft:jzlib:1.1.3 - http://www.jcraft.com/jzlib/) * jmustache (com.samskivert:jmustache:1.15 - http://github.com/samskivert/jmustache) - * dnsjava (dnsjava:dnsjava:3.6.4 - https://github.com/dnsjava/dnsjava) - * jaxen (jaxen:jaxen:2.0.1 - https://jaxen-xpath.github.io/jaxen/jaxen/) + * dnsjava (dnsjava:dnsjava:3.6.5 - https://github.com/dnsjava/dnsjava) + * jaxen (jaxen:jaxen:2.0.6 - https://jaxen-xpath.github.io/jaxen/jaxen/) * ANTLR 4 Runtime (org.antlr:antlr4-runtime:4.13.2 - https://www.antlr.org/antlr4-runtime/) * commons-compiler (org.codehaus.janino:commons-compiler:3.1.8 - http://janino-compiler.github.io/commons-compiler/) * janino (org.codehaus.janino:janino:3.1.8 - http://janino-compiler.github.io/janino/) * Stax2 API (org.codehaus.woodstox:stax2-api:4.2.1 - http://github.com/FasterXML/stax2-api) * Hamcrest Date (org.exparity:hamcrest-date:2.0.8 - https://github.com/exparity/hamcrest-date) - * jersey-core-client (org.glassfish.jersey.core:jersey-client:3.1.11 - https://projects.eclipse.org/projects/ee4j.jersey/jersey-client) - * jersey-inject-hk2 (org.glassfish.jersey.inject:jersey-hk2:3.1.11 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-hk2) + * jersey-core-client (org.glassfish.jersey.core:jersey-client:3.1.12 - https://projects.eclipse.org/projects/ee4j.jersey/jersey-client) + * jersey-inject-hk2 (org.glassfish.jersey.inject:jersey-hk2:3.1.12 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-hk2) * jersey-media-multipart (org.glassfish.jersey.media:jersey-media-multipart:3.1.3 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-media-multipart) * Hamcrest (org.hamcrest:hamcrest:2.2 - http://hamcrest.org/JavaHamcrest/) * Hamcrest Core (org.hamcrest:hamcrest-core:2.2 - http://hamcrest.org/JavaHamcrest/) @@ -508,7 +506,7 @@ https://wiki.lyrasis.org/display/DSPACE/Code+Contribution+Guidelines * asm-analysis (org.ow2.asm:asm-analysis:8.0.1 - http://asm.ow2.io/) * asm-commons (org.ow2.asm:asm-commons:8.0.1 - http://asm.ow2.io/) * asm-tree (org.ow2.asm:asm-tree:8.0.1 - http://asm.ow2.io/) - * PostgreSQL JDBC Driver (org.postgresql:postgresql:42.7.11 - https://jdbc.postgresql.org) + * PostgreSQL JDBC Driver (org.postgresql:postgresql:42.7.13 - https://jdbc.postgresql.org) * Reflections (org.reflections:reflections:0.9.12 - http://github.com/ronmamo/reflections) * JMatIO (org.tallison:jmatio:1.5 - https://github.com/tballison/jmatio) * XZ for Java (org.tukaani:xz:1.12 - https://tukaani.org/xz/java.html) @@ -534,8 +532,8 @@ https://wiki.lyrasis.org/display/DSPACE/Code+Contribution+Guidelines * HK2 Implementation Utilities (org.glassfish.hk2:hk2-utils:3.0.6 - https://github.com/eclipse-ee4j/glassfish-hk2/hk2-utils) * OSGi resource locator (org.glassfish.hk2:osgi-resource-locator:1.0.3 - https://projects.eclipse.org/projects/ee4j/osgi-resource-locator) * aopalliance version 1.0 repackaged as a module (org.glassfish.hk2.external:aopalliance-repackaged:3.0.6 - https://github.com/eclipse-ee4j/glassfish-hk2/external/aopalliance-repackaged) - * jersey-core-client (org.glassfish.jersey.core:jersey-client:3.1.11 - https://projects.eclipse.org/projects/ee4j.jersey/jersey-client) - * jersey-inject-hk2 (org.glassfish.jersey.inject:jersey-hk2:3.1.11 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-hk2) + * jersey-core-client (org.glassfish.jersey.core:jersey-client:3.1.12 - https://projects.eclipse.org/projects/ee4j.jersey/jersey-client) + * jersey-inject-hk2 (org.glassfish.jersey.inject:jersey-hk2:3.1.12 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-hk2) * jersey-media-multipart (org.glassfish.jersey.media:jersey-media-multipart:3.1.3 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-media-multipart) Cordra (Version 2) License Agreement: @@ -556,11 +554,11 @@ https://wiki.lyrasis.org/display/DSPACE/Code+Contribution+Guidelines * Jakarta XML Binding API (jakarta.xml.bind:jakarta.xml.bind-api:4.0.5 - https://github.com/jakartaee/jaxb-api/jakarta.xml.bind-api) * Angus Activation Registries (org.eclipse.angus:angus-activation:2.0.3 - https://github.com/eclipse-ee4j/angus-activation/angus-activation) * Angus Mail default provider (org.eclipse.angus:jakarta.mail:2.0.5 - http://eclipse-ee4j.github.io/angus-mail/jakarta.mail) - * JAXB Core (org.glassfish.jaxb:jaxb-core:4.0.8 - https://eclipse-ee4j.github.io/jaxb-ri/) - * JAXB Runtime (org.glassfish.jaxb:jaxb-runtime:4.0.8 - https://eclipse-ee4j.github.io/jaxb-ri/) - * TXW2 Runtime (org.glassfish.jaxb:txw2:4.0.8 - https://eclipse-ee4j.github.io/jaxb-ri/) - * jersey-core-client (org.glassfish.jersey.core:jersey-client:3.1.11 - https://projects.eclipse.org/projects/ee4j.jersey/jersey-client) - * jersey-inject-hk2 (org.glassfish.jersey.inject:jersey-hk2:3.1.11 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-hk2) + * JAXB Core (org.glassfish.jaxb:jaxb-core:4.0.9 - https://eclipse-ee4j.github.io/jaxb-ri/) + * JAXB Runtime (org.glassfish.jaxb:jaxb-runtime:4.0.9 - https://eclipse-ee4j.github.io/jaxb-ri/) + * TXW2 Runtime (org.glassfish.jaxb:txw2:4.0.9 - https://eclipse-ee4j.github.io/jaxb-ri/) + * jersey-core-client (org.glassfish.jersey.core:jersey-client:3.1.12 - https://projects.eclipse.org/projects/ee4j.jersey/jersey-client) + * jersey-inject-hk2 (org.glassfish.jersey.inject:jersey-hk2:3.1.12 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-hk2) * jersey-media-multipart (org.glassfish.jersey.media:jersey-media-multipart:3.1.3 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-media-multipart) * MIME streaming extension (org.jvnet.mimepull:mimepull:1.9.15 - https://github.com/eclipse-ee4j/metro-mimepull) * org.locationtech.jts:jts-core (org.locationtech.jts:jts-core:1.19.0 - https://www.locationtech.org/projects/technology.jts/jts-modules/jts-core) @@ -623,9 +621,9 @@ https://wiki.lyrasis.org/display/DSPACE/Code+Contribution+Guidelines * HK2 Implementation Utilities (org.glassfish.hk2:hk2-utils:3.0.6 - https://github.com/eclipse-ee4j/glassfish-hk2/hk2-utils) * OSGi resource locator (org.glassfish.hk2:osgi-resource-locator:1.0.3 - https://projects.eclipse.org/projects/ee4j/osgi-resource-locator) * aopalliance version 1.0 repackaged as a module (org.glassfish.hk2.external:aopalliance-repackaged:3.0.6 - https://github.com/eclipse-ee4j/glassfish-hk2/external/aopalliance-repackaged) - * jersey-core-client (org.glassfish.jersey.core:jersey-client:3.1.11 - https://projects.eclipse.org/projects/ee4j.jersey/jersey-client) - * jersey-core-common (org.glassfish.jersey.core:jersey-common:3.1.11 - https://projects.eclipse.org/projects/ee4j.jersey/jersey-common) - * jersey-inject-hk2 (org.glassfish.jersey.inject:jersey-hk2:3.1.11 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-hk2) + * jersey-core-client (org.glassfish.jersey.core:jersey-client:3.1.12 - https://projects.eclipse.org/projects/ee4j.jersey/jersey-client) + * jersey-core-common (org.glassfish.jersey.core:jersey-common:3.1.12 - https://projects.eclipse.org/projects/ee4j.jersey/jersey-common) + * jersey-inject-hk2 (org.glassfish.jersey.inject:jersey-hk2:3.1.12 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-hk2) * jersey-media-multipart (org.glassfish.jersey.media:jersey-media-multipart:3.1.3 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-media-multipart) * org.locationtech.jts:jts-core (org.locationtech.jts:jts-core:1.19.0 - https://www.locationtech.org/projects/technology.jts/jts-modules/jts-core) * org.locationtech.jts.io:jts-io-common (org.locationtech.jts.io:jts-io-common:1.19.0 - https://www.locationtech.org/projects/technology.jts/jts-modules/jts-io/jts-io-common) @@ -648,7 +646,6 @@ https://wiki.lyrasis.org/display/DSPACE/Code+Contribution+Guidelines * json-schema-validator (com.github.java-json-tools:json-schema-validator:2.2.14 - https://github.com/java-json-tools/json-schema-validator) * msg-simple (com.github.java-json-tools:msg-simple:1.2 - https://github.com/java-json-tools/msg-simple) * uri-template (com.github.java-json-tools:uri-template:0.10 - https://github.com/java-json-tools/uri-template) - * FindBugs-Annotations (com.google.code.findbugs:annotations:3.0.1u2 - http://findbugs.sourceforge.net/) * JHighlight (org.codelibs:jhighlight:1.1.1 - https://github.com/codelibs/jhighlight) * Hibernate Commons Annotations (org.hibernate.common:hibernate-commons-annotations:6.0.6.Final - http://hibernate.org) * Hibernate ORM - hibernate-core (org.hibernate.orm:hibernate-core:6.4.10.Final - https://hibernate.org/orm) @@ -656,7 +653,7 @@ https://wiki.lyrasis.org/display/DSPACE/Code+Contribution+Guidelines * Hibernate ORM - hibernate-jpamodelgen (org.hibernate.orm:hibernate-jpamodelgen:6.4.10.Final - https://hibernate.org/orm) * im4java (org.im4java:im4java:1.4.0 - http://sourceforge.net/projects/im4java/) * Javassist (org.javassist:javassist:3.30.2-GA - https://www.javassist.org/) - * XOM (xom:xom:1.4.1 - https://xom.nu) + * XOM (xom:xom:1.4.6 - https://xom.nu) Go License: @@ -682,21 +679,21 @@ https://wiki.lyrasis.org/display/DSPACE/Code+Contribution+Guidelines * DigitalCollections: IIIF API Library (de.digitalcollections.iiif:iiif-apis:0.3.11 - https://github.com/dbmdz/iiif-apis) * ClassGraph (io.github.classgraph:classgraph:4.8.165 - https://github.com/classgraph/classgraph) * JOpt Simple (net.sf.jopt-simple:jopt-simple:5.0.4 - http://jopt-simple.github.io/jopt-simple) - * Bouncy Castle JavaMail Jakarta S/MIME APIs (org.bouncycastle:bcjmail-jdk18on:1.83 - https://www.bouncycastle.org/download/bouncy-castle-java/) + * Bouncy Castle JavaMail Jakarta S/MIME APIs (org.bouncycastle:bcjmail-jdk18on:1.85 - https://www.bouncycastle.org/download/bouncy-castle-java/) * Bouncy Castle PKIX, CMS, EAC, TSP, PKCS, OCSP, CMP, and CRMF APIs (org.bouncycastle:bcpkix-jdk18on:1.81 - https://www.bouncycastle.org/download/bouncy-castle-java/) * Bouncy Castle Provider (org.bouncycastle:bcprov-jdk18on:1.81 - https://www.bouncycastle.org/download/bouncy-castle-java/) * Bouncy Castle ASN.1 Extension and Utility APIs (org.bouncycastle:bcutil-jdk18on:1.81 - https://www.bouncycastle.org/download/bouncy-castle-java/) * org.brotli:dec (org.brotli:dec:0.1.2 - http://brotli.org/dec) * Checker Qual (org.checkerframework:checker-qual:3.23.0 - https://checkerframework.org) - * Checker Qual (org.checkerframework:checker-qual:3.37.0 - https://checkerframework.org/) - * jersey-core-client (org.glassfish.jersey.core:jersey-client:3.1.11 - https://projects.eclipse.org/projects/ee4j.jersey/jersey-client) - * jersey-inject-hk2 (org.glassfish.jersey.inject:jersey-hk2:3.1.11 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-hk2) + * Checker Qual (org.checkerframework:checker-qual:3.55.1 - https://checkerframework.org/) + * jersey-core-client (org.glassfish.jersey.core:jersey-client:3.1.12 - https://projects.eclipse.org/projects/ee4j.jersey/jersey-client) + * jersey-inject-hk2 (org.glassfish.jersey.inject:jersey-hk2:3.1.12 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-hk2) * jersey-media-multipart (org.glassfish.jersey.media:jersey-media-multipart:3.1.3 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-media-multipart) - * jsoup Java HTML Parser (org.jsoup:jsoup:1.22.1 - https://jsoup.org/) + * jsoup Java HTML Parser (org.jsoup:jsoup:1.22.2 - https://jsoup.org/) * mockito-core (org.mockito:mockito-core:3.12.4 - https://github.com/mockito/mockito) * mockito-inline (org.mockito:mockito-inline:3.12.4 - https://github.com/mockito/mockito) * Duct Tape (org.rnorth.duct-tape:duct-tape:1.0.8 - https://github.com/rnorth/duct-tape) - * SLF4J API Module (org.slf4j:slf4j-api:2.0.17 - http://www.slf4j.org) + * SLF4J API Module (org.slf4j:slf4j-api:2.0.18 - http://www.slf4j.org) * Testcontainers Core (org.testcontainers:testcontainers:2.0.5 - https://java.testcontainers.org) * HAL Browser (org.webjars:hal-browser:ad9b865 - http://webjars.org) * toastr (org.webjars.bowergithub.codeseven:toastr:2.1.4 - http://webjars.org) @@ -716,15 +713,15 @@ https://wiki.lyrasis.org/display/DSPACE/Code+Contribution+Guidelines * juniversalchardet (com.github.albfernandez:juniversalchardet:2.5.0 - https://github.com/albfernandez/juniversalchardet) * H2 Database Engine (com.h2database:h2:2.4.240 - https://h2database.com) - * Saxon-HE (net.sf.saxon:Saxon-HE:9.9.1-8 - http://www.saxonica.com/) + * Saxon-HE (net.sf.saxon:Saxon-HE:12.9 - http://www.saxonica.com/) * Javassist (org.javassist:javassist:3.30.2-GA - https://www.javassist.org/) * Mozilla Rhino (org.mozilla:rhino:1.7.7.2 - https://developer.mozilla.org/en/Rhino) Public Domain: - * jersey-core-client (org.glassfish.jersey.core:jersey-client:3.1.11 - https://projects.eclipse.org/projects/ee4j.jersey/jersey-client) - * jersey-core-common (org.glassfish.jersey.core:jersey-common:3.1.11 - https://projects.eclipse.org/projects/ee4j.jersey/jersey-common) - * jersey-inject-hk2 (org.glassfish.jersey.inject:jersey-hk2:3.1.11 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-hk2) + * jersey-core-client (org.glassfish.jersey.core:jersey-client:3.1.12 - https://projects.eclipse.org/projects/ee4j.jersey/jersey-client) + * jersey-core-common (org.glassfish.jersey.core:jersey-common:3.1.12 - https://projects.eclipse.org/projects/ee4j.jersey/jersey-common) + * jersey-inject-hk2 (org.glassfish.jersey.inject:jersey-hk2:3.1.12 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-hk2) * jersey-media-multipart (org.glassfish.jersey.media:jersey-media-multipart:3.1.3 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-media-multipart) * HdrHistogram (org.hdrhistogram:HdrHistogram:2.2.2 - http://hdrhistogram.github.io/HdrHistogram/) * JSON in Java (org.json:json:20231013 - https://github.com/douglascrockford/JSON-java) @@ -737,7 +734,7 @@ https://wiki.lyrasis.org/display/DSPACE/Code+Contribution+Guidelines UnRar License: - * Java Unrar (com.github.junrar:junrar:7.5.8 - https://github.com/junrar/junrar) + * Java Unrar (com.github.junrar:junrar:7.6.0 - https://github.com/junrar/junrar) Unicode/ICU License: @@ -745,12 +742,12 @@ https://wiki.lyrasis.org/display/DSPACE/Code+Contribution+Guidelines W3C license: - * jersey-core-client (org.glassfish.jersey.core:jersey-client:3.1.11 - https://projects.eclipse.org/projects/ee4j.jersey/jersey-client) - * jersey-inject-hk2 (org.glassfish.jersey.inject:jersey-hk2:3.1.11 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-hk2) + * jersey-core-client (org.glassfish.jersey.core:jersey-client:3.1.12 - https://projects.eclipse.org/projects/ee4j.jersey/jersey-client) + * jersey-inject-hk2 (org.glassfish.jersey.inject:jersey-hk2:3.1.12 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-hk2) * jersey-media-multipart (org.glassfish.jersey.media:jersey-media-multipart:3.1.3 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-media-multipart) jQuery license: - * jersey-core-client (org.glassfish.jersey.core:jersey-client:3.1.11 - https://projects.eclipse.org/projects/ee4j.jersey/jersey-client) - * jersey-inject-hk2 (org.glassfish.jersey.inject:jersey-hk2:3.1.11 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-hk2) + * jersey-core-client (org.glassfish.jersey.core:jersey-client:3.1.12 - https://projects.eclipse.org/projects/ee4j.jersey/jersey-client) + * jersey-inject-hk2 (org.glassfish.jersey.inject:jersey-hk2:3.1.12 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-hk2) * jersey-media-multipart (org.glassfish.jersey.media:jersey-media-multipart:3.1.3 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-media-multipart) diff --git a/checkstyle.xml b/checkstyle.xml index 36d2b15bd89e..8cf9605662d8 100644 --- a/checkstyle.xml +++ b/checkstyle.xml @@ -152,6 +152,41 @@ For more information on CheckStyle configurations below, see: http://checkstyle. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dspace-api/pom.xml b/dspace-api/pom.xml index 261926c0e76c..b6d3254ed72d 100644 --- a/dspace-api/pom.xml +++ b/dspace-api/pom.xml @@ -12,7 +12,7 @@ org.dspace dspace-parent - 8.4 + 8.5 .. @@ -353,7 +353,7 @@ ${ehcache.version} + Caching dependencies for Open Policy Finder service. --> org.springframework.boot spring-boot-starter-cache @@ -436,6 +436,13 @@ org.apache.jena apache-jena-libs pom + + + + org.checkerframework + checker-qual + + commons-cli @@ -632,7 +639,7 @@ dnsjava dnsjava - 3.6.4 + 3.6.5 @@ -677,16 +684,6 @@ ${flyway.version} - - - com.google.code.findbugs - jsr305 - - - com.google.code.findbugs - annotations - - jakarta.inject jakarta.inject-api @@ -720,7 +717,7 @@ software.amazon.awssdk s3 - 2.43.2 + 2.49.4 software.amazon.awssdk @@ -730,13 +727,21 @@ software.amazon.awssdk apache-client + + + software.amazon.awssdk + apache5-client + software.amazon.awssdk.crt aws-crt - 0.45.2 + 0.48.1 - + + - - - + + + - + - + dc.identifier.issn - - + diff --git a/dspace-api/src/test/data/dspaceFolder/config/spring/api/external-services.xml b/dspace-api/src/test/data/dspaceFolder/config/spring/api/external-services.xml index 83d45b38cc76..d6e7e7c2e515 100644 --- a/dspace-api/src/test/data/dspaceFolder/config/spring/api/external-services.xml +++ b/dspace-api/src/test/data/dspaceFolder/config/spring/api/external-services.xml @@ -12,28 +12,28 @@ - - - - + + + + Journal - - - + + + Journal - - - + + + OrgUnit diff --git a/dspace-api/src/test/data/dspaceFolder/config/spring/api/sherpa.xml b/dspace-api/src/test/data/dspaceFolder/config/spring/api/openpolicyfinder.xml similarity index 50% rename from dspace-api/src/test/data/dspaceFolder/config/spring/api/sherpa.xml rename to dspace-api/src/test/data/dspaceFolder/config/spring/api/openpolicyfinder.xml index 206326f3db70..f44cee6fb769 100644 --- a/dspace-api/src/test/data/dspaceFolder/config/spring/api/sherpa.xml +++ b/dspace-api/src/test/data/dspaceFolder/config/spring/api/openpolicyfinder.xml @@ -10,19 +10,19 @@ - + - + dc.identifier.issn - - - + + + - - - + + + diff --git a/dspace-api/src/test/java/org/dspace/administer/ProcessCleanerIT.java b/dspace-api/src/test/java/org/dspace/administer/ProcessCleanerIT.java index 4676236cfee4..550bb72904ee 100644 --- a/dspace-api/src/test/java/org/dspace/administer/ProcessCleanerIT.java +++ b/dspace-api/src/test/java/org/dspace/administer/ProcessCleanerIT.java @@ -27,11 +27,14 @@ import org.dspace.app.scripts.handler.impl.TestDSpaceRunnableHandler; import org.dspace.builder.ProcessBuilder; import org.dspace.content.ProcessStatus; +import org.dspace.eperson.EPerson; import org.dspace.scripts.Process; import org.dspace.scripts.factory.ScriptServiceFactory; import org.dspace.scripts.service.ProcessService; import org.dspace.services.ConfigurationService; import org.dspace.services.factory.DSpaceServicesFactory; +import org.junit.After; +import org.junit.Before; import org.junit.Test; /** @@ -46,6 +49,21 @@ public class ProcessCleanerIT extends AbstractIntegrationTestWithDatabase { private ProcessService processService = ScriptServiceFactory.getInstance().getProcessService(); + private EPerson prevUser = null; + + @Before + public void setUser() { + // buildProcess creates all processes with the 'admin' owner user so we should set that + // as the current context user in tests which expect to find created processes + prevUser = context.getCurrentUser(); + context.setCurrentUser(admin); + } + + @After + public void restoreUser() { + context.setCurrentUser(prevUser); + } + @Test public void testWithoutProcessToDelete() throws Exception { @@ -69,10 +87,15 @@ public void testWithoutProcessToDelete() throws Exception { assertThat(messages, hasItem("Found 0 processes to be deleted")); assertThat(messages, hasItem("Process cleanup completed")); + EPerson prevUser = context.getCurrentUser(); + context.setCurrentUser(admin); + assertThat(processService.find(context, process_1.getID()), notNullValue()); assertThat(processService.find(context, process_2.getID()), notNullValue()); assertThat(processService.find(context, process_3.getID()), notNullValue()); + context.setCurrentUser(prevUser); + } @Test diff --git a/dspace-api/src/test/java/org/dspace/app/itemexport/ItemExportCLIIT.java b/dspace-api/src/test/java/org/dspace/app/itemexport/ItemExportCLIIT.java index af12cfd5538a..bc46e97f0b1a 100644 --- a/dspace-api/src/test/java/org/dspace/app/itemexport/ItemExportCLIIT.java +++ b/dspace-api/src/test/java/org/dspace/app/itemexport/ItemExportCLIIT.java @@ -8,7 +8,9 @@ package org.dspace.app.itemexport; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; import java.io.File; @@ -78,6 +80,9 @@ public void setUp() throws Exception { Files.createDirectory(Path.of(file.getAbsolutePath())); } workDir = Path.of(file.getAbsolutePath()); + + configurationService.setProperty("org.dspace.app.itemexport.allowed.dir", + new String[] { tempDir.toString(), workDir.toString() }); } @After @@ -85,7 +90,7 @@ public void setUp() throws Exception { public void destroy() throws Exception { PathUtils.deleteOnExit(tempDir); for (Path path : Files.list(workDir).collect(Collectors.toList())) { - PathUtils.deleteOnExit(path); + PathUtils.delete(path); } super.destroy(); } @@ -319,6 +324,92 @@ public void migrateItemWithAnotherMetadataSchema() throws Exception { checkItemMigration(item); } + @Test + public void exportItemWithPathTraversalBitstreamName() throws Exception { + Path notAllowed = Files.createTempDirectory("notSafExportDir"); + String traversalName = "../../../../../../../" + + notAllowed.getFileName().toString() + "/test.txt"; + + context.turnOffAuthorisationSystem(); + Item item = ItemBuilder.createItem(context, collection) + .withTitle(title) + .withMetadata("dc", "date", "issued", dateIssued) + .build(); + String bitstreamContent = "some arbitrary content"; + try (InputStream is = IOUtils.toInputStream(bitstreamContent, CharEncoding.UTF_8)) { + BitstreamBuilder.createBitstream(context, item, is) + .withName(traversalName) + .withMimeType("text/plain") + .build(); + } + context.restoreAuthSystemState(); + + String[] args = new String[] { "export", "-t", "ITEM", + "-i", item.getHandle(), "-d", tempDir.toString(), "-n", "1" }; + + // Exception should be thrown at validation + Exception thrown = assertThrows(Exception.class, () -> perfomExportScript(args)); + assertTrue(thrown.getMessage().contains("Illegal file path attempted for I/O (itemexport)")); + + // File should never have been written + assertFalse(Files.exists(notAllowed.resolve("test.txt"))); + PathUtils.deleteOnExit(notAllowed); + } + + @Test + public void exportRejectedWhenDestDirOutsideAllowedBase() throws Exception { + configurationService.setProperty( + "org.dspace.app.itemexport.allowed.dir", workDir.toString()); + + Path notAllowed = Files.createTempDirectory("notSafExportDir"); + + context.turnOffAuthorisationSystem(); + Item item = ItemBuilder.createItem(context, collection) + .withTitle(title) + .withMetadata("dc", "date", "issued", dateIssued) + .build(); + context.restoreAuthSystemState(); + + String[] args = new String[] { "export", "-t", "ITEM", + "-i", item.getHandle(), "-d", notAllowed.toString(), "-n", "1" }; + + // Exception should be thrown at validation + Exception thrown = assertThrows(Exception.class, () -> perfomExportScript(args)); + assertTrue(thrown.getMessage().contains("Illegal file path attempted for I/O (itemexport)")); + + // File should never have been written + assertFalse(Files.list(notAllowed).findAny().isPresent()); + PathUtils.deleteOnExit(notAllowed); + } + + @Test + public void allowedDirDefaultsToExportWorkDir() throws Exception { + // default array property is workDir, used on null or empty value set + configurationService.setProperty( + "org.dspace.app.itemexport.allowed.dir", new String[]{}); + + context.turnOffAuthorisationSystem(); + Item item = ItemBuilder.createItem(context, collection) + .withTitle(title) + .withMetadata("dc", "date", "issued", dateIssued) + .build(); + context.restoreAuthSystemState(); + + // Work dir should be allowed + String[] args = new String[] { "export", "-t", "ITEM", + "-i", item.getHandle(), "-d", workDir.toString(), "-n", "1" }; + perfomExportScript(args); + assertTrue(Files.list(workDir).findAny().isPresent()); + + String[] args2 = new String[] { "export", "-t", "ITEM", + "-i", item.getHandle(), "-d", tempDir.toString(), "-n", "1" }; + // Exception should be thrown at validation + Exception thrown = assertThrows(Exception.class, () -> perfomExportScript(args2)); + assertTrue(thrown.getMessage().contains("Illegal file path attempted for I/O (itemexport)")); + // File should never have been written + assertFalse(Files.list(tempDir).findAny().isPresent()); + } + /** * Check created export directory * @throws Exception diff --git a/dspace-api/src/test/java/org/dspace/app/sherpa/MockSHERPAService.java b/dspace-api/src/test/java/org/dspace/app/openpolicyfinder/MockOpenPolicyFinderService.java similarity index 57% rename from dspace-api/src/test/java/org/dspace/app/sherpa/MockSHERPAService.java rename to dspace-api/src/test/java/org/dspace/app/openpolicyfinder/MockOpenPolicyFinderService.java index 239d2864bfb1..bceefc916ffe 100644 --- a/dspace-api/src/test/java/org/dspace/app/sherpa/MockSHERPAService.java +++ b/dspace-api/src/test/java/org/dspace/app/openpolicyfinder/MockOpenPolicyFinderService.java @@ -5,7 +5,7 @@ * * http://www.dspace.org/license/ */ -package org.dspace.app.sherpa; +package org.dspace.app.openpolicyfinder; import java.io.IOException; import java.io.InputStream; @@ -13,35 +13,38 @@ import java.net.URISyntaxException; import java.util.Objects; -import org.dspace.app.sherpa.v2.SHERPAPublisherResponse; -import org.dspace.app.sherpa.v2.SHERPAResponse; +import org.dspace.app.openpolicyfinder.v2.OpenPolicyFinderPublisherResponse; +import org.dspace.app.openpolicyfinder.v2.OpenPolicyFinderResponse; /** - * Mock implementation for SHERPA API service (used by SHERPA submit service to check + * Mock implementation for Open Policy Finder API service (used by Open Policy Finder submit service to check * journal policies). - * This class will return mock SHERPA responses so they can be parsed and turned + * This class will return mock Open Policy Finder responses so they can be parsed and turned * into external data objects downstream. * * @author Kim Shepherd */ -public class MockSHERPAService extends SHERPAService { +public class MockOpenPolicyFinderService extends OpenPolicyFinderService { /** * Simple overridden performRequest so that we do attempt to build the URI but rather than make - * an actual HTTP call, return parsed SHERPAResponse for The Lancet based on known-good JSON stored with our + * an actual HTTP call, return parsed OpenPolicyFinderResponse for The Lancet based on known-good JSON stored with + * our * test resources. - * If URI creation, parsing, or IO fails along the way, a SHERPAResponse with an error message set will be + * If URI creation, parsing, or IO fails along the way, a OpenPolicyFinderResponse with an error message set will be * returned. * @param value a journal / publication name, or ID, etc. - * @return SHERPAResponse + * @return OpenPolicyFinderResponse */ @Override - public SHERPAResponse performRequest(String type, String field, String predicate, String value, + public OpenPolicyFinderResponse performRequest(String type, String field, String predicate, String value, int start, int limit) { try { - String endpoint = configurationService.getProperty("sherpa.romeo.url", - "https://v2.sherpa.ac.uk/cgi/retrieve"); - String apiKey = configurationService.getProperty("sherpa.romeo.apikey"); + String endpoint = configurationService.getProperty("openpolicyfinder.url", + configurationService.getProperty("sherpa.romeo.url", + "https://api.openpolicyfinder.jisc.ac.uk/retrieve")); + String apiKey = configurationService.getProperty("openpolicyfinder.apikey", + configurationService.getProperty("sherpa.romeo.apikey")); // Rather than search, we will simply attempt to build the URI using the real pepare method // so that any errors there are caught, and will return a valid response for The Lancet @@ -51,7 +54,7 @@ public SHERPAResponse performRequest(String type, String field, String predicate // in case a syntax exception is thrown URI uri = prepareQuery(value, endpoint, apiKey); if (uri == null) { - return new SHERPAResponse("Error building URI"); + return new OpenPolicyFinderResponse("Error building URI"); } // Get mock JSON @@ -62,11 +65,11 @@ public SHERPAResponse performRequest(String type, String field, String predicate } // Parse JSON input stream and return response for later evaluation - return new SHERPAResponse(content, SHERPAResponse.SHERPAFormat.JSON); + return new OpenPolicyFinderResponse(content, OpenPolicyFinderResponse.ResponseFormat.JSON); } catch (URISyntaxException e) { // This object will be marked as having an error for later evaluation - return new SHERPAResponse(e.getMessage()); + return new OpenPolicyFinderResponse(e.getMessage()); } finally { // Close input stream if (content != null) { @@ -75,7 +78,7 @@ public SHERPAResponse performRequest(String type, String field, String predicate } } catch (IOException e) { // This object will be marked as having an error for later evaluation - return new SHERPAResponse(e.getMessage()); + return new OpenPolicyFinderResponse(e.getMessage()); } } @@ -85,20 +88,23 @@ private InputStream getContent(String fileName) { /** * Simple overridden performPublisherRequest so that we do attempt to build the URI but rather than make - * an actual HTTP call, return parsed SHERPAPublisherResponse for PLOS based on known-good JSON stored with our - * test resources. - * If URI creation, parsing, or IO fails along the way, a SHERPAPublisherResponse with an error message set will be - * returned. + * an actual HTTP call, return parsed OpenPolicyFinderPublisherResponse for PLOS based on known-good JSON stored + * with our test resources. + * If URI creation, parsing, or IO fails along the way, a OpenPolicyFinderPublisherResponse with an error message + * set will be returned. * @param value a journal / publication name, or ID, etc. - * @return SHERPAResponse + * @return OpenPolicyFinderResponse */ @Override - public SHERPAPublisherResponse performPublisherRequest(String type, String field, String predicate, String value, - int start, int limit) { + public OpenPolicyFinderPublisherResponse performPublisherRequest(String type, String field, + String predicate, String value, + int start, int limit) { try { - String endpoint = configurationService.getProperty("sherpa.romeo.url", - "https://v2.sherpa.ac.uk/cgi/retrieve"); - String apiKey = configurationService.getProperty("sherpa.romeo.apikey"); + String endpoint = configurationService.getProperty("openpolicyfinder.url", + configurationService.getProperty("sherpa.romeo.url", + "https://api.openpolicyfinder.jisc.ac.uk/retrieve")); + String apiKey = configurationService.getProperty("openpolicyfinder.apikey", + configurationService.getProperty("sherpa.romeo.apikey")); // Rather than search, we will simply attempt to build the URI using the real pepare method // so that any errors there are caught, and will return a valid response for The Lancet @@ -112,11 +118,12 @@ public SHERPAPublisherResponse performPublisherRequest(String type, String field content = getClass().getResourceAsStream("plos.json"); // Parse JSON input stream and return response for later evaluation - return new SHERPAPublisherResponse(content, SHERPAPublisherResponse.SHERPAFormat.JSON); + return new OpenPolicyFinderPublisherResponse(content, + OpenPolicyFinderPublisherResponse.ResponseFormat.JSON); } catch (URISyntaxException e) { // This object will be marked as having an error for later evaluation - return new SHERPAPublisherResponse(e.getMessage()); + return new OpenPolicyFinderPublisherResponse(e.getMessage()); } finally { // Close input stream if (content != null) { @@ -125,7 +132,7 @@ public SHERPAPublisherResponse performPublisherRequest(String type, String field } } catch (IOException e) { // This object will be marked as having an error for later evaluation - return new SHERPAPublisherResponse(e.getMessage()); + return new OpenPolicyFinderPublisherResponse(e.getMessage()); } } diff --git a/dspace-api/src/test/java/org/dspace/app/sherpa/SHERPADataProviderTest.java b/dspace-api/src/test/java/org/dspace/app/openpolicyfinder/OpenPolicyFinderDataProviderTest.java similarity index 83% rename from dspace-api/src/test/java/org/dspace/app/sherpa/SHERPADataProviderTest.java rename to dspace-api/src/test/java/org/dspace/app/openpolicyfinder/OpenPolicyFinderDataProviderTest.java index f37d9469d12d..a063295810d1 100644 --- a/dspace-api/src/test/java/org/dspace/app/sherpa/SHERPADataProviderTest.java +++ b/dspace-api/src/test/java/org/dspace/app/openpolicyfinder/OpenPolicyFinderDataProviderTest.java @@ -5,7 +5,7 @@ * * http://www.dspace.org/license/ */ -package org.dspace.app.sherpa; +package org.dspace.app.openpolicyfinder; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; @@ -31,17 +31,17 @@ /** * */ -public class SHERPADataProviderTest extends AbstractDSpaceTest { +public class OpenPolicyFinderDataProviderTest extends AbstractDSpaceTest { ExternalDataService externalDataService; - ExternalDataProvider sherpaJournalProvider; - ExternalDataProvider sherpaPublisherProvider; - ExternalDataProvider sherpaJournalIssnProvider; + ExternalDataProvider opfJournalProvider; + ExternalDataProvider opfPublisherProvider; + ExternalDataProvider opfJournalIssnProvider; private static final MetadataFieldRef TITLE_FIELD = new MetadataFieldRef("dc", "title", null); private static final MetadataFieldRef ISSN_FIELD = new MetadataFieldRef("creativeworkseries", "issn", null); - private static final MetadataFieldRef SHERPA_PUBLISHER_FIELD = - new MetadataFieldRef("dc", "identifier", "sherpaPublisher"); + private static final MetadataFieldRef OPF_PUBLISHER_FIELD = + new MetadataFieldRef("dc", "identifier", "opfPublisher"); private static final MetadataFieldRef OTHER_FIELD = new MetadataFieldRef("dc", "identifier", "other"); @BeforeClass @@ -56,10 +56,10 @@ public static void tearDownClass() { public void setUp() { // Set up External Service Factory and set data providers externalDataService = ExternalServiceFactory.getInstance().getExternalDataService(); - sherpaJournalProvider = externalDataService.getExternalDataProvider("sherpaJournal"); - sherpaPublisherProvider = externalDataService.getExternalDataProvider("sherpaPublisher"); - sherpaJournalIssnProvider = - externalDataService.getExternalDataProvider("sherpaJournalIssn"); + opfJournalProvider = externalDataService.getExternalDataProvider("opfJournal"); + opfPublisherProvider = externalDataService.getExternalDataProvider("opfPublisher"); + opfJournalIssnProvider = + externalDataService.getExternalDataProvider("opfJournalIssn"); } @After @@ -67,8 +67,8 @@ public void tearDown() { } /** - * Test searching the SHERPAv2JournalISSNProvider for an ISSN and inspect the returned data object - * The provider is configured to use the Mock SHERPAService. + * Test searching the OpenPolicyFinderJournalISSNDataProvider for an ISSN and inspect the returned data object + * The provider is configured to use the Mock OpenPolicyFinderService. */ @Test public void testGetJournalISSNExternalObject() { @@ -81,7 +81,7 @@ public void testGetJournalISSNExternalObject() { String validIssn = "0140-6736"; String validName = "The Lancet"; - Optional externalDataObject = sherpaJournalIssnProvider.getExternalDataObject(validIssn); + Optional externalDataObject = opfJournalIssnProvider.getExternalDataObject(validIssn); // If data object isn't here, throw a resource not found exception ExternalDataObject dataObject = externalDataObject.orElseThrow( () -> new ResourceNotFoundException("Couldn't find a data object for ISSN " + validIssn)); @@ -105,8 +105,8 @@ public void testGetJournalISSNExternalObject() { } /** - * Test searching the SHERPAv2JournalISSNProvider for an ISSN and inspect the returned data object - * The provider is configured to use the Mock SHERPAService. + * Test searching the OpenPolicyFinderJournalISSNDataProvider for an ISSN and inspect the returned data object + * The provider is configured to use the Mock OpenPolicyFinderService. */ @Test public void testSearchJournalISSNExternalObjects() { @@ -120,7 +120,7 @@ public void testSearchJournalISSNExternalObjects() { String validIssn = "0140-6736"; String validName = "The Lancet"; List externalDataObjects = - sherpaJournalIssnProvider.searchExternalDataObjects(validIssn, 0, 1); + opfJournalIssnProvider.searchExternalDataObjects(validIssn, 0, 1); // Assert that the response is valid and not empty assertTrue("Couldn't find a data object for publication name " + validName, @@ -151,8 +151,8 @@ public void testSearchJournalISSNExternalObjects() { } /** - * Test searching the SHERPAv2JournalProvider for a journal and inspect the returned data object - * The provider is configured to use the Mock SHERPAService. + * Test searching the OpenPolicyFinderJournalDataProvider for a journal and inspect the returned data object + * The provider is configured to use the Mock OpenPolicyFinderService. */ @Test public void testGetJournalExternalObject() { @@ -165,7 +165,7 @@ public void testGetJournalExternalObject() { String validIssn = "0140-6736"; String validName = "The Lancet"; - Optional externalDataObject = sherpaJournalProvider.getExternalDataObject(validName); + Optional externalDataObject = opfJournalProvider.getExternalDataObject(validName); // If data object isn't here, throw a resource not found exception ExternalDataObject dataObject = externalDataObject.orElseThrow( () -> new ResourceNotFoundException("Couldn't find a data object for publication name " + validName)); @@ -189,8 +189,8 @@ public void testGetJournalExternalObject() { } /** - * Test searching the SHERPAv2JournalProvider for a journal and inspect the returned data object - * The provider is configured to use the Mock SHERPAService. + * Test searching the OpenPolicyFinderJournalDataProvider for a journal and inspect the returned data object + * The provider is configured to use the Mock OpenPolicyFinderService. */ @Test public void testSearchJournalObjects() { @@ -205,7 +205,7 @@ public void testSearchJournalObjects() { String validIssn = "0140-6736"; String validName = "The Lancet"; List externalDataObjects = - sherpaJournalProvider.searchExternalDataObjects(validName, 0, 1); + opfJournalProvider.searchExternalDataObjects(validName, 0, 1); // Assert that the response is valid and not empty assertTrue("Couldn't find a data object for publication name " + validName, @@ -236,8 +236,8 @@ public void testSearchJournalObjects() { } /** - * Test searching the SHERPAv2JournalProvider for a journal and inspect the returned data object - * The provider is configured to use the Mock SHERPAService. + * Test searching the OpenPolicyFinderJournalDataProvider for a journal and inspect the returned data object + * The provider is configured to use the Mock OpenPolicyFinderService. */ @Test public void testGetPublisherExternalObject() { @@ -245,7 +245,7 @@ public void testGetPublisherExternalObject() { // thelancet.json stored response in test resources // We expect to see the following values set correctly: // dc.title = Public Library of Science - // dc.identifier.sherpaPublisher 112 + // dc.identifier.opfPublisher 112 // dc.identifier.other http://www.plos.org/ // Set expected values @@ -254,7 +254,7 @@ public void testGetPublisherExternalObject() { String validUrl = "http://www.plos.org/"; // Retrieve the dataobject(s) from the data provider - Optional externalDataObject = sherpaPublisherProvider.getExternalDataObject(validName); + Optional externalDataObject = opfPublisherProvider.getExternalDataObject(validName); // If data object isn't here, throw a resource not found exception ExternalDataObject dataObject = externalDataObject.orElseThrow( () -> new ResourceNotFoundException("Couldn't find a data object for publication name " + validName)); @@ -266,7 +266,7 @@ public void testGetPublisherExternalObject() { for (MetadataValueDTO metadataValue : dataObject.getMetadata()) { if (TITLE_FIELD.matches(metadataValue)) { title = metadataValue.getValue(); - } else if (SHERPA_PUBLISHER_FIELD.matches(metadataValue)) { + } else if (OPF_PUBLISHER_FIELD.matches(metadataValue)) { identifier = metadataValue.getValue(); } else if (OTHER_FIELD.matches(metadataValue)) { url = metadataValue.getValue(); @@ -276,7 +276,7 @@ public void testGetPublisherExternalObject() { // Does dc.title match the expected value? assertEquals("Title metadata must equal '" + validName + "' ", validName, title); - // Does dc.identifier.sherpaPublisher match the expected value? + // Does dc.identifier.opfPublisher match the expected value? assertEquals("Publisher ID must equal " + validIdentifier, validIdentifier, identifier); // Does dc.identifier.other match the expected value? @@ -284,8 +284,8 @@ public void testGetPublisherExternalObject() { } /** - * Test searching the SHERPAv2JournalProvider for a journal and inspect the returned data object - * The provider is configured to use the Mock SHERPAService. + * Test searching the OpenPolicyFinderJournalDataProvider for a journal and inspect the returned data object + * The provider is configured to use the Mock OpenPolicyFinderService. */ @Test public void testSearchPublisherExternalObjects() { @@ -293,7 +293,7 @@ public void testSearchPublisherExternalObjects() { // thelancet.json stored response in test resources // We expect to see the following values set correctly: // dc.title = Public Library of Science - // dc.identifier.sherpaPublisher 112 + // dc.identifier.opfPublisher 112 // dc.identifier.other http://www.plos.org/ // Set expected values @@ -303,7 +303,7 @@ public void testSearchPublisherExternalObjects() { // Retrieve the dataobject(s) from the data provider List externalDataObjects = - sherpaPublisherProvider.searchExternalDataObjects(validName, 0, 1); + opfPublisherProvider.searchExternalDataObjects(validName, 0, 1); // Assert that the response is valid and not empty assertTrue("Couldn't find a data object for publication name " + validName, @@ -321,7 +321,7 @@ public void testSearchPublisherExternalObjects() { for (MetadataValueDTO metadataValue : dataObject.getMetadata()) { if (TITLE_FIELD.matches(metadataValue)) { title = metadataValue.getValue(); - } else if (SHERPA_PUBLISHER_FIELD.matches(metadataValue)) { + } else if (OPF_PUBLISHER_FIELD.matches(metadataValue)) { identifier = metadataValue.getValue(); } else if (OTHER_FIELD.matches(metadataValue)) { url = metadataValue.getValue(); @@ -331,7 +331,7 @@ public void testSearchPublisherExternalObjects() { // Does dc.title match the expected value? assertEquals("Title metadata must equal '" + validName + "' ", validName, title); - // Does dc.identifier.sherpaPublisher match the expected value? + // Does dc.identifier.opfPublisher match the expected value? assertEquals("Publisher ID must equal " + validIdentifier, validIdentifier, identifier); // Does dc.identifier.other match the expected value? @@ -342,7 +342,7 @@ public void testSearchPublisherExternalObjects() { * Perform the same essential test as prior, but making sure the new comparator and equals methods * in MetadataValueDTO and ExternalDataObject properly compare objects (even when DTO values are not strictly * in the same order) - * The provider is configured to use the Mock SHERPAService. + * The provider is configured to use the Mock OpenPolicyFinderService. */ @Test public void testComparePublisherExternalObjects() { @@ -350,7 +350,7 @@ public void testComparePublisherExternalObjects() { // thelancet.json stored response in test resources // We expect to see the following values set correctly: // dc.title = Public Library of Science - // dc.identifier.sherpaPublisher 112 + // dc.identifier.opfPublisher 112 // dc.identifier.other http://www.plos.org/ // Set expected values @@ -360,39 +360,39 @@ public void testComparePublisherExternalObjects() { // First exemplar object should be identical ExternalDataObject exemplarDataObject = new ExternalDataObject(); - exemplarDataObject.setSource("sherpaPublisher"); + exemplarDataObject.setSource("opfPublisher"); exemplarDataObject.setId(validIdentifier); exemplarDataObject.setValue(validName); exemplarDataObject.setDisplayValue(validName); exemplarDataObject.addMetadata(TITLE_FIELD.toMetadata(validName)); - exemplarDataObject.addMetadata(SHERPA_PUBLISHER_FIELD.toMetadata(validIdentifier)); + exemplarDataObject.addMetadata(OPF_PUBLISHER_FIELD.toMetadata(validIdentifier)); exemplarDataObject.addMetadata(OTHER_FIELD.toMetadata(validUrl)); // Exemplar object 2 has a different order of metadata values // (we still expect it to be 'equal' when comparing since there is no concept of place for DTOs) ExternalDataObject exemplarDataObject2 = new ExternalDataObject(); - exemplarDataObject2.setSource("sherpaPublisher"); + exemplarDataObject2.setSource("opfPublisher"); exemplarDataObject2.setId(validIdentifier); exemplarDataObject2.setValue(validName); exemplarDataObject2.setDisplayValue(validName); exemplarDataObject2.addMetadata(OTHER_FIELD.toMetadata(validUrl)); exemplarDataObject2.addMetadata(TITLE_FIELD.toMetadata(validName)); - exemplarDataObject2.addMetadata(SHERPA_PUBLISHER_FIELD.toMetadata(validIdentifier)); + exemplarDataObject2.addMetadata(OPF_PUBLISHER_FIELD.toMetadata(validIdentifier)); // Nonequal object should NOT evaluate as equal to our data ExternalDataObject nonEqualObject = new ExternalDataObject(); - nonEqualObject.setSource("sherpaPublisher"); + nonEqualObject.setSource("opfPublisher"); nonEqualObject.setId(validIdentifier); nonEqualObject.setValue(validName); nonEqualObject.setDisplayValue(validName); nonEqualObject.addMetadata(TITLE_FIELD.toMetadata("Private Library of Science")); - nonEqualObject.addMetadata(SHERPA_PUBLISHER_FIELD.toMetadata(validIdentifier)); + nonEqualObject.addMetadata(OPF_PUBLISHER_FIELD.toMetadata(validIdentifier)); nonEqualObject.addMetadata(OTHER_FIELD.toMetadata(validUrl)); // Retrieve the dataobject(s) from the data provider List externalDataObjects = - sherpaPublisherProvider.searchExternalDataObjects(validName, 0, 1); + opfPublisherProvider.searchExternalDataObjects(validName, 0, 1); // Assert that the response is valid and not empty assertTrue("Couldn't find a data object for publication name " + validName, diff --git a/dspace-api/src/test/java/org/dspace/app/sherpa/SHERPAServiceTest.java b/dspace-api/src/test/java/org/dspace/app/openpolicyfinder/OpenPolicyFinderServiceTest.java similarity index 73% rename from dspace-api/src/test/java/org/dspace/app/sherpa/SHERPAServiceTest.java rename to dspace-api/src/test/java/org/dspace/app/openpolicyfinder/OpenPolicyFinderServiceTest.java index e6c3f4d07302..dce78044cea3 100644 --- a/dspace-api/src/test/java/org/dspace/app/sherpa/SHERPAServiceTest.java +++ b/dspace-api/src/test/java/org/dspace/app/openpolicyfinder/OpenPolicyFinderServiceTest.java @@ -5,7 +5,7 @@ * * http://www.dspace.org/license/ */ -package org.dspace.app.sherpa; +package org.dspace.app.openpolicyfinder; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -17,12 +17,11 @@ import java.nio.charset.StandardCharsets; import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.StringUtils; import org.apache.http.client.utils.URIBuilder; import org.dspace.AbstractDSpaceTest; -import org.dspace.app.sherpa.v2.SHERPAPublisherResponse; -import org.dspace.app.sherpa.v2.SHERPAResponse; -import org.dspace.app.sherpa.v2.SHERPAUtils; +import org.dspace.app.openpolicyfinder.v2.OpenPolicyFinderPublisherResponse; +import org.dspace.app.openpolicyfinder.v2.OpenPolicyFinderResponse; +import org.dspace.app.openpolicyfinder.v2.OpenPolicyFinderUtils; import org.dspace.services.ConfigurationService; import org.dspace.services.factory.DSpaceServicesFactory; import org.junit.After; @@ -32,21 +31,23 @@ import org.junit.Test; /** - * Integration tests for SHERPA service + * Integration tests for Open Policy Finder service * @author Kim Shepherd - * @see MockSHERPAService + * @see MockOpenPolicyFinderService */ -public class SHERPAServiceTest extends AbstractDSpaceTest { +public class OpenPolicyFinderServiceTest extends AbstractDSpaceTest { protected ConfigurationService configurationService = DSpaceServicesFactory.getInstance().getConfigurationService(); - // Spring SHERPA service. For testing purposes, this will use a mock service + // Spring Open Policy Finder service. For testing purposes, this will use a mock service // that doesn't perform actual HTTP queries but does construct URIs // and returns a valid response (The Lancet) if no other errors are encountered - protected SHERPAService sherpaService = DSpaceServicesFactory.getInstance().getServiceManager() - .getServiceByName("org.dspace.app.sherpa.MockSHERPAService", MockSHERPAService.class); + protected OpenPolicyFinderService openPolicyFinderService = DSpaceServicesFactory.getInstance() + .getServiceManager().getServiceByName( + "org.dspace.app.openpolicyfinder.MockOpenPolicyFinderService", + MockOpenPolicyFinderService.class); - public SHERPAServiceTest() { + public OpenPolicyFinderServiceTest() { } @@ -67,36 +68,36 @@ public void tearDown() { } /** - * Test searching by Journal ISSN directly against SHERPA service + * Test searching by Journal ISSN directly against Open Policy Finder service */ @Test public void testSearchByJournalISSN() { // Get a response with a single valid ISSN, using the mock service which will return a response based on // thelancet.json stored response in test resources String validISSN = "0140-6736"; - SHERPAResponse sherpaResponse = sherpaService.searchByJournalISSN(validISSN); + OpenPolicyFinderResponse opfResponse = openPolicyFinderService.searchByJournalISSN(validISSN); // This response should NOT contain an error (isError() should be false) - assertFalse("Response contained an error flag / message: " + sherpaResponse.getMessage(), - sherpaResponse.isError()); + assertFalse("Response contained an error flag / message: " + opfResponse.getMessage(), + opfResponse.isError()); // This response should contain a single journal called The Lancet String expectedTitle = "The Lancet"; assertTrue("Response did not contain a journal with the expected title '" + expectedTitle + '"', - expectedTitle.equals(sherpaResponse.getJournals().get(0).getTitles().get(0))); + expectedTitle.equals(opfResponse.getJournals().get(0).getTitles().get(0))); } /** * Test that the URIBuilder and sanitation procedures are producing expected URLs, comparing the results - * to manually compiled strings + * to manually compiled strings. Note: the API key is now sent as an HTTP header, not as a query parameter. * @throws URISyntaxException */ @Test public void testUriConstruction() throws URISyntaxException, UnsupportedEncodingException { - // Get values for base URL and api key parameter - String endpoint = configurationService.getProperty("sherpa.romeo.url", - "https://v2.sherpa.ac.uk/cgi/retrieve"); - String apiKey = configurationService.getProperty("sherpa.romeo.apikey", null); + // Get values for base URL (API key is now a header, not in the URL) + String endpoint = configurationService.getProperty("openpolicyfinder.url", + configurationService.getProperty("sherpa.romeo.url", + "https://api.openpolicyfinder.jisc.ac.uk/retrieve")); // Compare expected outputs // Valid ISSN (The Lancet) @@ -106,44 +107,44 @@ public void testUriConstruction() throws URISyntaxException, UnsupportedEncoding // Characters like { and } that conflict with JSON should be stripped from the filter query assertEquals("JSON filter query sanitisation not stripping special characters", - "TEST", SHERPAUtils.sanitiseQuery(invalidISSN)); + "TEST", OpenPolicyFinderUtils.sanitiseQuery(invalidISSN)); // The valid string should look like this (assuming default configuration) - // https://v2.sherpa.ac.uk/cgi/retrieve?item-type=publication&filter=[["issn","equals","0140-6736"]]&format=Json - String validUrl = new URIBuilder(buildUrlString(validISSN, endpoint, apiKey)).toString(); + // https://api.openpolicyfinder.jisc.ac.uk/retrieve?item-type=publication&...&format=Json + String validUrl = new URIBuilder(buildUrlString(validISSN, endpoint)).toString(); assertEquals("Built and expected valid URLs differ", validUrl, - sherpaService.constructHttpGet("publication", "issn", "equals", validISSN) + openPolicyFinderService.constructHttpGet("publication", "issn", "equals", validISSN) .getURI().toASCIIString()); // The invalid string should look like this (assuming default configuration) - // https://v2.sherpa.ac.uk/cgi/retrieve?item-type=publication&filter=[["issn","equals","TEST"]]&format=Json + // https://api.openpolicyfinder.jisc.ac.uk/retrieve?item-type=publication&...&format=Json // Note - it should return 0 results from the API, but these services are not intended to validate the ISSN // query, though they do sanitise it for the JSON input type, hence expecting the braces to be stripped - String invalidUrl = new URIBuilder(buildUrlString(invalidISSN, endpoint, apiKey)).toString(); + String invalidUrl = new URIBuilder(buildUrlString(invalidISSN, endpoint)).toString(); assertEquals("Built and expected invalid URLs differ", invalidUrl, - sherpaService.constructHttpGet("publication", "issn", "equals", invalidISSN) + openPolicyFinderService.constructHttpGet("publication", "issn", "equals", invalidISSN) .getURI().toASCIIString()); // The null query string should look like this (assuming default configuration) - // https://v2.sherpa.ac.uk/cgi/retrieve?item-type=publication&filter=[["issn","equals",""]]&format=Json + // https://api.openpolicyfinder.jisc.ac.uk/retrieve?item-type=publication&...&format=Json // Note - it should return 0 results from the API, but all we do is log a warning, this is not considered // a fatal URI syntax exception (the remote call does work, and returns 0 items as valid JSON) - String nullUrl = new URIBuilder(buildUrlString(null, endpoint, apiKey)).toString(); + String nullUrl = new URIBuilder(buildUrlString(null, endpoint)).toString(); assertEquals("Built and expected invalid URLs differ", nullUrl, - sherpaService.constructHttpGet("publication", "issn", "equals", null) + openPolicyFinderService.constructHttpGet("publication", "issn", "equals", null) .getURI().toASCIIString()); } /** - * Thorough test of returned SHERPAResponse object to ensure all expected fields are there and valid + * Thorough test of returned OpenPolicyFinderResponse object to ensure all expected fields are there and valid */ @Test public void testJournalResponse() { // Valid ISSN (The Lancet) String validISSN = "0140-6736"; - SHERPAResponse response = sherpaService.searchByJournalISSN(validISSN); + OpenPolicyFinderResponse response = openPolicyFinderService.searchByJournalISSN(validISSN); // Assert response is not error, or fail with message assertFalse("Response was flagged as 'isError'", response.isError()); @@ -159,7 +160,7 @@ public void testJournalResponse() { && expectedTitle.equals(response.getJournals().get(0).getTitles().get(0))); // Assert response has expected publication (metadata) URI - String expectedSystemMetadataUri = "http://v2.sherpa.ac.uk/id/publication/23803"; + String expectedSystemMetadataUri = "https://openpolicyfinder.jisc.ac.uk/id/publication/23803"; assertTrue("Response metadata URI did not match expected '" + expectedSystemMetadataUri + "' value", expectedSystemMetadataUri.equals(response.getMetadata().getUri())); @@ -182,13 +183,14 @@ public void testJournalResponse() { } /** - * Thorough test of returned SHERPAPublisherResponse object to ensure all expected fields are there and valid + * Thorough test of returned OpenPolicyFinderPublisherResponse object to ensure all expected fields are there + * and valid */ @Test public void testPublisherResponse() { // Set up basic query and query the (mock) service String publisherName = "Public Library of Science"; - SHERPAPublisherResponse response = sherpaService.performPublisherRequest( + OpenPolicyFinderPublisherResponse response = openPolicyFinderService.performPublisherRequest( "publisher", "name", "equals", publisherName, 0, 1); // Assert response is not error, or fail with message @@ -215,22 +217,19 @@ public void testPublisherResponse() { } /** - * Build URL manually with string builder to compare to URIBuilder usage in actual service + * Build URL manually with string builder to compare to URIBuilder usage in actual service. + * Note: the API key is now sent as an HTTP header, not as a query parameter. * @param query * @param endpoint - * @param apiKey * @return */ - public static String buildUrlString(String query, String endpoint, String apiKey) { - query = SHERPAUtils.sanitiseQuery(query); + public static String buildUrlString(String query, String endpoint) { + query = OpenPolicyFinderUtils.sanitiseQuery(query); StringBuilder expected = new StringBuilder(); String filter = "[[\"issn\",\"equals\",\"" + query + "\"]]"; expected.append(endpoint).append("?") .append("item-type=publication&filter=").append(URLEncoder.encode(filter, StandardCharsets.UTF_8)) .append("&format=Json&offset=0&limit=1"); - if (StringUtils.isNotBlank(apiKey)) { - expected.append("&api-key=").append(apiKey); - } return expected.toString(); } diff --git a/dspace-api/src/test/java/org/dspace/app/sherpa/submit/SHERPASubmitServiceTest.java b/dspace-api/src/test/java/org/dspace/app/openpolicyfinder/submit/OpenPolicyFinderSubmitServiceTest.java similarity index 82% rename from dspace-api/src/test/java/org/dspace/app/sherpa/submit/SHERPASubmitServiceTest.java rename to dspace-api/src/test/java/org/dspace/app/openpolicyfinder/submit/OpenPolicyFinderSubmitServiceTest.java index 438d754aa5f2..e5ebdf485cd5 100644 --- a/dspace-api/src/test/java/org/dspace/app/sherpa/submit/SHERPASubmitServiceTest.java +++ b/dspace-api/src/test/java/org/dspace/app/openpolicyfinder/submit/OpenPolicyFinderSubmitServiceTest.java @@ -5,7 +5,7 @@ * * http://www.dspace.org/license/ */ -package org.dspace.app.sherpa.submit; +package org.dspace.app.openpolicyfinder.submit; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -13,7 +13,7 @@ import java.sql.SQLException; import org.dspace.AbstractUnitTest; -import org.dspace.app.sherpa.v2.SHERPAResponse; +import org.dspace.app.openpolicyfinder.v2.OpenPolicyFinderResponse; import org.dspace.authorize.AuthorizeException; import org.dspace.content.Collection; import org.dspace.content.Community; @@ -38,10 +38,10 @@ import org.junit.Test; /** - * SHERPASubmitServiceTest creates a dummy item with an ISSN in its metadata, and makes sure - * that the ISSN is detected and passed to SHERPAService for a mock query + * OpenPolicyFinderSubmitServiceTest creates a dummy item with an ISSN in its metadata, and makes sure + * that the ISSN is detected and passed to OpenPolicyFinderService for a mock query */ -public class SHERPASubmitServiceTest extends AbstractUnitTest { +public class OpenPolicyFinderSubmitServiceTest extends AbstractUnitTest { // Set up services protected ItemService itemService = ContentServiceFactory.getInstance().getItemService(); @@ -51,8 +51,9 @@ public class SHERPASubmitServiceTest extends AbstractUnitTest { protected CollectionService collectionService = ContentServiceFactory.getInstance().getCollectionService(); protected MetadataFieldService metadataFieldService = ContentServiceFactory.getInstance().getMetadataFieldService(); protected MetadataValueService metadataValueService = ContentServiceFactory.getInstance().getMetadataValueService(); - SHERPASubmitService sherpaSubmitService = DSpaceServicesFactory.getInstance().getServiceManager() - .getServiceByName("org.dspace.app.sherpa.submit.SHERPASubmitService", SHERPASubmitService.class); + OpenPolicyFinderSubmitService opfSubmitService = DSpaceServicesFactory.getInstance().getServiceManager() + .getServiceByName("org.dspace.app.openpolicyfinder.submit.OpenPolicyFinderSubmitService", + OpenPolicyFinderSubmitService.class); Collection testCollection = null; Community testCommunity = null; @@ -106,9 +107,9 @@ public void testGetISSNs() throws AuthorizeException, SQLException { MetadataValue metadataValue = metadataValueService.create(context, testItem, issnField); metadataValue.setValue(validISSN); - // Get responses from SHERPA submit service, which should inspect item ISSNs and perform search - // on the mock SHERPA service - SHERPAResponse response = sherpaSubmitService.searchRelatedJournals(context, testItem); + // Get responses from Open Policy Finder submit service, which should inspect item ISSNs and perform search + // on the mock Open Policy Finder service + OpenPolicyFinderResponse response = opfSubmitService.searchRelatedJournals(context, testItem); // Make sure response is not null or empty assertTrue("Response should not be null", response != null); @@ -119,7 +120,7 @@ public void testGetISSNs() throws AuthorizeException, SQLException { // Assert response is not error, or fail with message assertFalse("Response was flagged as 'isError'", response.isError()); - // Skip remainder of parsing tests - these are already done in SHERPAServiceTEst + // Skip remainder of parsing tests - these are already done in OpenPolicyFinderServiceTEst } } diff --git a/dspace-api/src/test/java/org/dspace/app/util/XMLUtils_PathRestrictedEntityResolverTest.java b/dspace-api/src/test/java/org/dspace/app/util/XMLUtils_PathRestrictedEntityResolverTest.java new file mode 100644 index 000000000000..60f3a46f71c5 --- /dev/null +++ b/dspace-api/src/test/java/org/dspace/app/util/XMLUtils_PathRestrictedEntityResolverTest.java @@ -0,0 +1,160 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.util; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThrows; +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.nio.file.Path; + +import org.dspace.app.util.XMLUtils.PathRestrictedEntityResolver; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TemporaryFolder; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +/** + * Unit tests for {@link XMLUtils.PathRestrictedEntityResolver}. + * + * These unit tests exercise the resolver in isolation without the full application. + * Therefore, this PURPOSEFULLY doesn't extend AbstractUnitTest because it doesn't need a database setup. + */ +public class XMLUtils_PathRestrictedEntityResolverTest { + + @Rule + public TemporaryFolder allowedFolder = new TemporaryFolder(); + + @Rule + public TemporaryFolder disallowedFolder = new TemporaryFolder(); + + private Path allowedDir; + private Path allowedFile; + + @Before + public void setUp() throws IOException { + allowedDir = allowedFolder.getRoot().toPath(); + allowedFile = allowedFolder.newFile("allowed.dtd").toPath(); + } + + @Test + public void nullSystemId_returnsNull() throws Exception { + PathRestrictedEntityResolver resolver = new PathRestrictedEntityResolver(allowedDir.toString()); + assertNull(resolver.resolveEntity("somePublicId", null)); + } + + @Test + public void plainFilePath_withinAllowedDir_isResolved() throws Exception { + PathRestrictedEntityResolver resolver = new PathRestrictedEntityResolver(allowedDir.toString()); + + // systemId is a raw filesystem path (NOT a "file://" URI) + String systemId = allowedFile.toString(); + assertFalse(systemId.startsWith("file://")); + + InputSource result = resolver.resolveEntity(null, systemId); + // resolved successfully! + assertNotNull(result); + } + + @Test + public void fileURI_withinAllowedDir_isResolved() throws Exception { + PathRestrictedEntityResolver resolver = new PathRestrictedEntityResolver(allowedDir.toString()); + + // systemId using "file://" prefix, e.g. file:///path/to/allowed.dtd + String systemId = allowedFile.toUri().toString(); + assertTrue(systemId.startsWith("file://")); + + InputSource result = resolver.resolveEntity(null, systemId); + // resolved successfully! + assertNotNull(result); + } + + @Test + public void externalSystemId_isRejected() { + PathRestrictedEntityResolver resolver = new PathRestrictedEntityResolver(allowedDir.toString()); + + // systemId is an HTTP link + SAXException ex = assertThrows(SAXException.class, + () -> resolver.resolveEntity(null, "http://example.com/evil.dtd")); + assertTrue(ex.getMessage().contains("External resources not allowed")); + + // systemId is an FTP link + SAXException ex2 = assertThrows(SAXException.class, + () -> resolver.resolveEntity(null, "ftp://example.com/evil.dtd")); + assertTrue(ex2.getMessage().contains("External resources not allowed")); + + // systemId is an HTTPS link + SAXException ex3 = assertThrows(SAXException.class, + () -> resolver.resolveEntity(null, "https://example.com/evil.dtd")); + assertTrue(ex3.getMessage().contains("External resources not allowed")); + } + + @Test + public void pathOutsideAllowedDir_isDenied() throws IOException { + PathRestrictedEntityResolver resolver = new PathRestrictedEntityResolver(allowedDir.toString()); + + Path outsideFile = disallowedFolder.newFile("disallowed.dtd").toPath(); + + // systemId points at an existing file in a disallowed directory + SAXException ex = assertThrows(SAXException.class, + () -> resolver.resolveEntity(null, outsideFile.toString())); + assertTrue(ex.getMessage().contains("Access denied")); + } + + @Test + public void pathTraversalOutOfAllowedDir_isDenied() { + PathRestrictedEntityResolver resolver = new PathRestrictedEntityResolver(allowedDir.toString()); + + // systemId is an attempt at directory traversal attack starting from allowed directory + String traversalAttempt = allowedDir.resolve("../../../etc/passwd").toString(); + + SAXException ex = assertThrows(SAXException.class, + () -> resolver.resolveEntity(null, traversalAttempt)); + assertTrue(ex.getMessage().contains("Access denied")); + } + + @Test + public void noAllowedPaths_deniesEverything() { + // No allowedBasePaths provided means that nothing will resolve + PathRestrictedEntityResolver resolver = new PathRestrictedEntityResolver(); + + SAXException ex = assertThrows(SAXException.class, + () -> resolver.resolveEntity(null, allowedFile.toString())); + assertTrue(ex.getMessage().contains("Access denied")); + } + + @Test + public void multipleAllowedPaths_isResolvedForSecondPath() throws Exception { + // Provide multiple allowedBatPaths + PathRestrictedEntityResolver resolver = new PathRestrictedEntityResolver( + disallowedFolder.getRoot().toString(), allowedDir.toString()); + + // Ensure something in the *second* path will resolve correctly + InputSource result = resolver.resolveEntity(null, allowedFile.toString()); + // resolved successfully! + assertNotNull(result); + } + + @Test + public void withinAllowedDir_butFileDoesNotExist() { + PathRestrictedEntityResolver resolver = new PathRestrictedEntityResolver(allowedDir.toString()); + + // Specify a file that doesn't exist in an allowed directory + Path missing = allowedDir.resolve("does-not-exist.dtd"); + + // Resolve should throw a file not found error, even though it was requested from an allowed directory. + SAXException ex = assertThrows(SAXException.class, + () -> resolver.resolveEntity(null, missing.toString())); + assertTrue(ex.getMessage().contains("File not found")); + } +} diff --git a/dspace-api/src/test/java/org/dspace/app/util/XMLUtils_PathRestrictedURIResolverTest.java b/dspace-api/src/test/java/org/dspace/app/util/XMLUtils_PathRestrictedURIResolverTest.java new file mode 100644 index 000000000000..a4dc3f0a5e79 --- /dev/null +++ b/dspace-api/src/test/java/org/dspace/app/util/XMLUtils_PathRestrictedURIResolverTest.java @@ -0,0 +1,163 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.util; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThrows; +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.nio.file.Path; +import javax.xml.transform.Source; +import javax.xml.transform.TransformerException; + +import org.dspace.app.util.XMLUtils.PathRestrictedURIResolver; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TemporaryFolder; + +/** + * Unit tests for {@link XMLUtils.PathRestrictedURIResolver}. + * + * These unit tests exercise the resolver in isolation without the full application. + * Therefore, this PURPOSEFULLY doesn't extend AbstractUnitTest because it doesn't need a database setup. + */ +public class XMLUtils_PathRestrictedURIResolverTest { + + @Rule + public TemporaryFolder allowedFolder = new TemporaryFolder(); + + @Rule + public TemporaryFolder disallowedFolder = new TemporaryFolder(); + + private Path allowedDir; + private Path allowedFile; + private final String allowedFileName = "allowed.xsl"; + + @Before + public void setUp() throws IOException { + allowedDir = allowedFolder.getRoot().toPath(); + allowedFile = allowedFolder.newFile(allowedFileName).toPath(); + } + + @Test + public void absoluteFileHref_withinAllowedDir_isResolved() throws Exception { + PathRestrictedURIResolver resolver = new PathRestrictedURIResolver(allowedDir.toString()); + + // href is an absolute path via a file:// URI + String href = allowedFile.toUri().toString(); + + Source source = resolver.resolve(href, null); + // resolved successfully! + assertNotNull(source); + + // Also ensure an empty base works properly + source = resolver.resolve(href, ""); + // resolved successfully! + assertNotNull(source); + } + + @Test + public void relativeHref_resolvedAgainstBase_withinAllowedDir_isResolved() throws Exception { + PathRestrictedURIResolver resolver = new PathRestrictedURIResolver(allowedDir.toString()); + + // base points at the allowed directory + String base = allowedDir.toUri().toString(); + // href is a relative URL to file based on the "base" path + String href = allowedFileName; + + Source source = resolver.resolve(href, base); + // resolved successfully! + assertNotNull(source); + } + + @Test + public void externalResource_isRejected() { + PathRestrictedURIResolver resolver = new PathRestrictedURIResolver(allowedDir.toString()); + + // href is an HTTP URL + TransformerException ex = assertThrows(TransformerException.class, + () -> resolver.resolve("http://example.com/evil.xsl", null)); + assertTrue(ex.getMessage().contains("External resources not allowed")); + + // href is an HTTPS URL + TransformerException ex2 = assertThrows(TransformerException.class, + () -> resolver.resolve("https://example.com/evil.xsl", null)); + assertTrue(ex2.getMessage().contains("External resources not allowed")); + + // href is an FTP URL + TransformerException ex3 = assertThrows(TransformerException.class, + () -> resolver.resolve("ftp://example.com/evil.xsl", null)); + assertTrue(ex3.getMessage().contains("External resources not allowed")); + } + + @Test + public void hrefOutsideAllowedDir_isDenied() throws IOException { + PathRestrictedURIResolver resolver = new PathRestrictedURIResolver(allowedDir.toString()); + + // href points to an existing file in a disallowed folder + Path outsideFile = disallowedFolder.newFile("disallowed.xsl").toPath(); + String href = outsideFile.toUri().toString(); + + TransformerException ex = assertThrows(TransformerException.class, + () -> resolver.resolve(href, null)); + assertTrue(ex.getMessage().contains("Access denied")); + } + + @Test + public void relativeHref_traversingOutOfBase_isDenied() { + PathRestrictedURIResolver resolver = new PathRestrictedURIResolver(allowedDir.toString()); + + // href is an attempt at a directory traversal attack starting from allowed directory + String base = allowedDir.toUri().toString(); + String href = "../../../../etc/passwd"; + + TransformerException ex = assertThrows(TransformerException.class, + () -> resolver.resolve(href, base)); + assertTrue(ex.getMessage().contains("Access denied")); + } + + @Test + public void noAllowedPaths_deniesEverything() { + // No allowedBasePaths provided means that nothing will resolve + PathRestrictedURIResolver resolver = new PathRestrictedURIResolver(); + + String href = allowedFile.toUri().toString(); + + TransformerException ex = assertThrows(TransformerException.class, + () -> resolver.resolve(href, null)); + assertTrue(ex.getMessage().contains("Access denied")); + } + + @Test + public void multipleAllowedPaths_isResolvedForSecondPath() throws Exception { + // Provide multiple allowedBatPaths + PathRestrictedURIResolver resolver = new PathRestrictedURIResolver( + disallowedFolder.getRoot().toString(), allowedDir.toString()); + + // Ensure something in the *second* path will resolve correctly + String href = allowedFile.toUri().toString(); + + Source source = resolver.resolve(href, null); + assertNotNull(source); + } + + @Test + public void withinAllowedDir_butFileDoesNotExist() { + PathRestrictedURIResolver resolver = new PathRestrictedURIResolver(allowedDir.toString()); + + // Specify a file that doesn't exist in an allowed directory + String href = allowedDir.resolve("does-not-exist.xsl").toUri().toString(); + + // Resolve should throw a file not found error, even though it was requested from an allowed directory. + TransformerException ex = assertThrows(TransformerException.class, + () -> resolver.resolve(href, null)); + assertTrue(ex.getMessage().contains("File not found")); + } +} diff --git a/dspace-api/src/test/java/org/dspace/content/crosswalk/OREIngestionCrosswalkTest.java b/dspace-api/src/test/java/org/dspace/content/crosswalk/OREIngestionCrosswalkTest.java new file mode 100644 index 000000000000..c4662805ac06 --- /dev/null +++ b/dspace-api/src/test/java/org/dspace/content/crosswalk/OREIngestionCrosswalkTest.java @@ -0,0 +1,239 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.content.crosswalk; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.List; + +import org.apache.http.HttpEntity; +import org.apache.http.StatusLine; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.CloseableHttpClient; +import org.dspace.AbstractIntegrationTestWithDatabase; +import org.dspace.app.client.DSpaceHttpClientFactory; +import org.dspace.builder.BundleBuilder; +import org.dspace.builder.CollectionBuilder; +import org.dspace.builder.CommunityBuilder; +import org.dspace.builder.ItemBuilder; +import org.dspace.content.Bundle; +import org.dspace.content.Collection; +import org.dspace.content.Item; +import org.dspace.content.factory.ContentServiceFactory; +import org.dspace.content.service.ItemService; +import org.dspace.eperson.EPerson; +import org.jdom2.Element; +import org.jdom2.Namespace; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.mockito.MockedStatic; +import org.mockito.Mockito; + +/** + * Test class for OREIngestionCrosswalk + * + * @author Kim Shepherd + */ +public class OREIngestionCrosswalkTest extends AbstractIntegrationTestWithDatabase { + + private Bundle bundle; + private OREIngestionCrosswalk crosswalk; + private Item item; + private ItemService itemService; + private EPerson prevUser; + + private static final Namespace ATOM_NS = Namespace.getNamespace("atom", "http://www.w3.org/2005/Atom"); + private static final Namespace ORE_NS = Namespace.getNamespace("ore", "http://www.openarchives.org/ore/terms/"); + + @Before + @Override + public void setUp() throws Exception { + super.setUp(); + crosswalk = new OREIngestionCrosswalk(); + itemService = ContentServiceFactory.getInstance().getItemService(); + + context.turnOffAuthorisationSystem(); + parentCommunity = CommunityBuilder.createCommunity(context).build(); + Collection collection = CollectionBuilder.createCollection(context, parentCommunity).build(); + item = ItemBuilder.createItem(context, collection).withTitle("Test ORE Object").build(); + bundle = BundleBuilder.createBundle(context, item).withName("ORIGINAL").build(); + context.restoreAuthSystemState(); + prevUser = context.getCurrentUser(); + context.setCurrentUser(admin); + } + + @After + public void tearDown() throws Exception { + context.setCurrentUser(prevUser); + } + + @Test + public void testIngestNullRoot() throws Exception { + // should just return without exception + crosswalk.ingest(context, item, (Element) null, false); + } + + @Test + public void testIngestEmptyResources() throws Exception { + Element entry = createOREEntryWithoutResources(); + crosswalk.ingest(context, item, entry, false); + + List bundles = itemService.getBundles(item, "ORIGINAL"); + assertTrue("Should have no bundles or empty bundle", + bundles.isEmpty() || bundles.get(0).getBitstreams().isEmpty()); + } + + @Test(expected = CrosswalkException.class) + public void testIngestInvalidURISyntaxThrowsException() throws Exception { + Element entry = createOREEntryWithInvalidURI(); + crosswalk.ingest(context, item, entry, false); + } + + @Test + public void testHostValidation() { + // localhost = forbidden + boolean result = crosswalk.validResourceUri("http://localhost:8080/resource"); + assertFalse("localhost should be forbidden", result); + + // 127.0.0.1 = forbidden + result = crosswalk.validResourceUri("http://127.0.0.1:8080/resource"); + assertFalse("127.0.0.1 should be forbidden", result); + + // allowed.example.com = not forbidden + result = crosswalk.validResourceUri("http://allowed.example.com/resource"); + assertTrue("External host should be allowed", result); + } + + @Test + public void testSchemeValidation() throws Exception { + boolean result = crosswalk.validResourceUri("file:///etc/passwd"); + assertFalse("file:// scheme should be forbidden", result); + + result = crosswalk.validResourceUri("ftp://example.com/resource"); + assertFalse("ftp:// scheme should be forbidden", result); + + result = crosswalk.validResourceUri("https://example.com/resource"); + assertTrue("https:// scheme should be allowed", result); + } + + @Test + public void testSuccessfulBitstreamIngest() throws Exception { + // fully mocked response + try (MockedStatic mockedFactory = + mockHttpClient(200, "Test bitstream content")) { + + Element entry = createValidOREEntry(); + crosswalk.ingest(context, item, entry, false); + + List bundles = itemService.getBundles(item, "ORIGINAL"); + assertFalse("Should have created bundle", bundles.isEmpty()); + assertFalse("Bundle should have bitstream", bundles.get(0).getBitstreams().isEmpty()); + } + } + + @Test + public void testIngestStreamAsBitstream() throws Exception { + String testContent = "Test bitstream content"; + InputStream inputStream = new ByteArrayInputStream(testContent.getBytes()); + + Element resource = new Element("link", ATOM_NS); + resource.setAttribute("href", "http://example.com/test.pdf"); + resource.setAttribute("title", "Test Document"); + resource.setAttribute("type", "application/pdf"); + + crosswalk.ingestStreamAsBitstream(context, inputStream, bundle, resource, "test-entry"); + + assertFalse("Bundle should have bitstream", bundle.getBitstreams().isEmpty()); + assertEquals("Bitstream should have correct name", "Test Document", + bundle.getBitstreams().get(0).getName()); + } + + @Test(expected = IOException.class) + public void testIngestStreamAsBitstreamNullStreamThrowsException() throws Exception { + Element resource = new Element("link", ATOM_NS); + resource.setAttribute("href", "http://example.com/test.pdf"); + + crosswalk.ingestStreamAsBitstream(context, null, bundle, resource, "test-entry"); + } + + private Element createValidOREEntry() { + Element entry = new Element("entry", ATOM_NS); + Element altLink = new Element("link", ATOM_NS); + altLink.setAttribute("rel", "alternate"); + altLink.setAttribute("href", "http://example.com/entry/123"); + entry.addContent(altLink); + Element resLink = new Element("link", ATOM_NS); + resLink.setAttribute("rel", ORE_NS.getURI() + "aggregates"); + resLink.setAttribute("href", "http://example.com/resource.pdf"); + resLink.setAttribute("title", "Test Resource"); + resLink.setAttribute("type", "application/pdf"); + entry.addContent(resLink); + return entry; + } + + private Element createOREEntryWithoutResources() { + Element entry = new Element("entry", ATOM_NS); + Element altLink = new Element("link", ATOM_NS); + altLink.setAttribute("rel", "alternate"); + altLink.setAttribute("href", "http://example.com/entry/123"); + entry.addContent(altLink); + return entry; + } + + + private Element createOREEntryWithInvalidURI() { + Element entry = new Element("entry", ATOM_NS); + Element altLink = new Element("link", ATOM_NS); + altLink.setAttribute("rel", "alternate"); + altLink.setAttribute("href", "http://example.com/entry/123"); + entry.addContent(altLink); + Element resLink = new Element("link", ATOM_NS); + resLink.setAttribute("rel", ORE_NS.getURI() + "aggregates"); + resLink.setAttribute("href", "hello, i am an invalid URI"); + entry.addContent(resLink); + return entry; + } + + private MockedStatic mockHttpClient(int statusCode, String content) throws IOException { + MockedStatic mockedFactory = Mockito.mockStatic(DSpaceHttpClientFactory.class); + + CloseableHttpClient mockClient = mock(CloseableHttpClient.class); + DSpaceHttpClientFactory mockFactoryInstance = mock(DSpaceHttpClientFactory.class); + CloseableHttpResponse mockResponse = mockHttpResponse(statusCode, content); + + when(mockFactoryInstance.buildWithRequestConfig(any())).thenReturn(mockClient); + when(mockClient.execute(any(HttpGet.class))).thenReturn(mockResponse); + mockedFactory.when(DSpaceHttpClientFactory::getInstance).thenReturn(mockFactoryInstance); + + return mockedFactory; + } + + private CloseableHttpResponse mockHttpResponse(int statusCode, String content) throws IOException { + CloseableHttpResponse mockResponse = mock(CloseableHttpResponse.class); + HttpEntity mockEntity = mock(HttpEntity.class); + StatusLine mockStatus = mock(StatusLine.class); + + when(mockStatus.getStatusCode()).thenReturn(statusCode); + when(mockEntity.getContent()).thenReturn(new ByteArrayInputStream(content.getBytes())); + when(mockResponse.getStatusLine()).thenReturn(mockStatus); + when(mockResponse.getEntity()).thenReturn(mockEntity); + + return mockResponse; + } + +} diff --git a/dspace-api/src/test/java/org/dspace/discovery/FacetYearRangeTest.java b/dspace-api/src/test/java/org/dspace/discovery/FacetYearRangeTest.java new file mode 100644 index 000000000000..3c8aac71d912 --- /dev/null +++ b/dspace-api/src/test/java/org/dspace/discovery/FacetYearRangeTest.java @@ -0,0 +1,91 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.discovery; + +import static org.junit.Assert.assertEquals; + +import java.util.Arrays; + +import org.dspace.discovery.configuration.DiscoverySearchFilterFacet; +import org.junit.Test; + +/** + * Tests for the year range that {@link FacetYearRange} recovers from previously selected filter + * queries. + * + * @author Bram Luyten (bram at atmire.com) + */ +public class FacetYearRangeTest { + + private static final String FACET = "dateIssued"; + + /** + * Resolve the range from the given filter queries. Every case below finds its range or its + * single year in the filter queries themselves, so the search index is never consulted and + * the context, scope, search service and parent query are never dereferenced. + * + * @param filterQueries the filter queries to resolve + * @return the resolved range + * @throws SearchServiceException never, since the search index is not consulted + */ + private FacetYearRange rangeOf(String... filterQueries) throws SearchServiceException { + DiscoverySearchFilterFacet facet = new DiscoverySearchFilterFacet(); + facet.setIndexFieldName(FACET); + FacetYearRange range = new FacetYearRange(facet); + range.calculateRange(null, Arrays.asList(filterQueries), null, null, null); + return range; + } + + @Test + public void resolvesRange() throws Exception { + FacetYearRange range = rangeOf(FACET + ".year:[2000 TO 2010]"); + assertEquals(2000, range.getOldestYear()); + assertEquals(2010, range.getNewestYear()); + } + + @Test + public void resolvesRangePaddedWithSpaces() throws Exception { + FacetYearRange range = rangeOf(FACET + ".year:[ 2000 TO 2010 ]"); + assertEquals(2000, range.getOldestYear()); + assertEquals(2010, range.getNewestYear()); + } + + @Test + public void resolvesRangeWithRepeatedSpaces() throws Exception { + FacetYearRange range = rangeOf(FACET + ".year:[2000 TO 2010]"); + assertEquals(2000, range.getOldestYear()); + assertEquals(2010, range.getNewestYear()); + } + + @Test + public void resolvesRangeWithNegativeYears() throws Exception { + FacetYearRange range = rangeOf(FACET + ".year:[-500 TO -100]"); + assertEquals(-500, range.getOldestYear()); + assertEquals(-100, range.getNewestYear()); + } + + @Test + public void resolvesSingleYear() throws Exception { + FacetYearRange range = rangeOf(FACET + ".year:2005 OR " + FACET + ".year:2006"); + assertEquals(2005, range.getOldestYear()); + assertEquals(2005, range.getNewestYear()); + } + + /** + * A filter query that opens a range and never closes it has to be rejected promptly. The + * wildcard pattern used previously needed time quadratic in the length of the value, where + * recognising it as "not a range" is now linear. The bound is therefore a very wide margin + * and is not sensitive to a slow CI machine. + */ + @Test(timeout = 5000) + public void rejectsUnclosedRangeWithoutBacktracking() throws Exception { + FacetYearRange range = rangeOf(FACET + ".year:2005 OR [" + " TO ".repeat(60000) + "x"); + assertEquals(2005, range.getOldestYear()); + assertEquals(2005, range.getNewestYear()); + } +} diff --git a/dspace-api/src/test/java/org/dspace/discovery/SolrServiceRangeQueryTest.java b/dspace-api/src/test/java/org/dspace/discovery/SolrServiceRangeQueryTest.java new file mode 100644 index 000000000000..41096e8e5cc8 --- /dev/null +++ b/dspace-api/src/test/java/org/dspace/discovery/SolrServiceRangeQueryTest.java @@ -0,0 +1,72 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.discovery; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +/** + * Tests for {@link SolrServiceImpl#isRangeQuery(String)}, which decides whether a filter value is + * passed to Solr unescaped. + * + * @author Bram Luyten (bram at atmire.com) + */ +public class SolrServiceRangeQueryTest { + + @Test + public void acceptsRangeQueries() { + assertTrue(SolrServiceImpl.isRangeQuery("[2000 TO 2010]")); + assertTrue(SolrServiceImpl.isRangeQuery("[* TO *]")); + assertTrue(SolrServiceImpl.isRangeQuery("[2000-01-01T00:00:00Z TO NOW]")); + assertTrue(SolrServiceImpl.isRangeQuery("[TO]")); + } + + @Test + public void rejectsValuesThatAreNotRangeQueries() { + assertFalse(SolrServiceImpl.isRangeQuery("")); + assertFalse(SolrServiceImpl.isRangeQuery("[]")); + assertFalse(SolrServiceImpl.isRangeQuery("2000 TO 2010")); + assertFalse(SolrServiceImpl.isRangeQuery("[2000 TO 2010")); + assertFalse(SolrServiceImpl.isRangeQuery("2000 TO 2010]")); + } + + /** + * "TO" is matched case sensitively, as it was by the pattern this replaced. + */ + @Test + public void rejectsLowerCaseTo() { + assertFalse(SolrServiceImpl.isRangeQuery("[2000 to 2010]")); + } + + /** + * "." never matched a line terminator, so a value containing one was escaped rather than + * passed through as a range. That is preserved: loosening it would let a value skip escaping + * that did not skip it before. + */ + @Test + public void rejectsValuesContainingALineTerminator() { + assertFalse(SolrServiceImpl.isRangeQuery("[2000 \nTO 2010]")); + assertFalse(SolrServiceImpl.isRangeQuery("[2000 \rTO 2010]")); + assertFalse(SolrServiceImpl.isRangeQuery("[2000 " + (char) 0x0085 + "TO 2010]")); + assertFalse(SolrServiceImpl.isRangeQuery("[2000 " + (char) 0x2028 + "TO 2010]")); + assertFalse(SolrServiceImpl.isRangeQuery("[2000 " + (char) 0x2029 + "TO 2010]")); + } + + /** + * A value that opens a range and never closes it has to be rejected promptly. The pattern + * used previously needed time quadratic in the length of the value, where the checks that + * replaced it are linear. The bound is therefore a very wide margin and is not sensitive to + * a slow CI machine. + */ + @Test(timeout = 5000) + public void rejectsUnclosedRangeWithoutBacktracking() { + assertFalse(SolrServiceImpl.isRangeQuery("[" + "TO".repeat(60000) + "X")); + } +} diff --git a/dspace-api/src/test/java/org/dspace/handle/HandleServiceTest.java b/dspace-api/src/test/java/org/dspace/handle/HandleServiceTest.java index 5232d5864d02..80697d35289c 100644 --- a/dspace-api/src/test/java/org/dspace/handle/HandleServiceTest.java +++ b/dspace-api/src/test/java/org/dspace/handle/HandleServiceTest.java @@ -54,6 +54,18 @@ public void testParseHandleByCanonicalPrefix() { assertEquals("111222333/111", handleService.parseHandle("https://fake.canonical.prefix/111222333/111")); } + /** + * A URL that can never yield a handle has to be rejected promptly. The greedy ".+" in the + * replaced pattern retried every "/handle/" segment in turn, needing time quadratic in the + * length of the identifier, where rejecting it is now linear. The bound is therefore a very + * wide margin and is not sensitive to a slow CI machine. + */ + @Test(timeout = 10000) + public void testParseHandleRejectsLongUrlWithoutBacktracking() { + // a line terminator is what made the URL unmatchable, since "." never matched one + assertNull(handleService.parseHandle("http://a/handle/" + "a/handle/a".repeat(40000) + "\n")); + } + @Test public void testParseHandleByAdditionalPrefix() { // note: handle pattern after prefix is not checked @@ -69,5 +81,10 @@ public void testParseHandleByPattern() { assertEquals("111222333/111", handleService.parseHandle("http://hdl.handle.net/111222333/111")); assertEquals("111222333/111", handleService.parseHandle("https://whatever/handle/111222333/111")); assertEquals("111222333/111", handleService.parseHandle("http://whatever/handle/111222333/111")); + // a repository deployed under a context path + assertEquals("111222333/111", handleService.parseHandle("https://whatever/jspui/handle/111222333/111")); + // the replaced pattern was greedy, so a nested "/handle/" resolved to the last one + assertEquals("111222333/111", + handleService.parseHandle("https://whatever/handle/x/handle/111222333/111")); } } diff --git a/dspace-api/src/test/java/org/dspace/util/DoiCheckTest.java b/dspace-api/src/test/java/org/dspace/util/DoiCheckTest.java index 17e21779d4fe..3f817b81ecd3 100644 --- a/dspace-api/src/test/java/org/dspace/util/DoiCheckTest.java +++ b/dspace-api/src/test/java/org/dspace/util/DoiCheckTest.java @@ -52,6 +52,17 @@ private List DOIsToTest() { ); } + /** + * A value that starts like a DOI but cannot be one has to be rejected promptly. Three + * adjacent unbounded digit runs in the pattern needed time cubic in the length of the value, + * where rejecting it is now linear. The bound is therefore a very wide margin and is not + * sensitive to a slow CI machine. + */ + @Test(timeout = 5000) + public void rejectsLongDigitRunWithoutBacktracking() { + assertFalse(DoiCheck.isDoi("10.1234/1-" + "00".repeat(2000) + "!")); + } + private List wrongDOIsToTest() { return Arrays.asList( StringUtils.EMPTY, diff --git a/dspace-api/src/test/resources/org/dspace/app/sherpa/0000-0000.json b/dspace-api/src/test/resources/org/dspace/app/openpolicyfinder/0000-0000.json similarity index 100% rename from dspace-api/src/test/resources/org/dspace/app/sherpa/0000-0000.json rename to dspace-api/src/test/resources/org/dspace/app/openpolicyfinder/0000-0000.json diff --git a/dspace-api/src/test/resources/org/dspace/app/sherpa/2731-0582.json b/dspace-api/src/test/resources/org/dspace/app/openpolicyfinder/2731-0582.json similarity index 97% rename from dspace-api/src/test/resources/org/dspace/app/sherpa/2731-0582.json rename to dspace-api/src/test/resources/org/dspace/app/openpolicyfinder/2731-0582.json index 2e5c7e2db9ca..9c3d6ff052f4 100644 --- a/dspace-api/src/test/resources/org/dspace/app/sherpa/2731-0582.json +++ b/dspace-api/src/test/resources/org/dspace/app/openpolicyfinder/2731-0582.json @@ -3,7 +3,7 @@ { "system_metadata": { "id": 40863, - "uri": "https://v2.sherpa.ac.uk/id/publication/40863", + "uri": "https://openpolicyfinder.jisc.ac.uk/id/publication/40863", "date_modified": "2022-03-25 14:08:29", "publicly_visible": "yes", "publicly_visible_phrases": [ @@ -78,7 +78,7 @@ } ], "publication_count": 87, - "uri": "https://v2.sherpa.ac.uk/id/publisher/3286", + "uri": "https://openpolicyfinder.jisc.ac.uk/id/publisher/3286", "url": "https://www.nature.com/" } } @@ -121,7 +121,7 @@ "language": "en" } ], - "uri": "https://v2.sherpa.ac.uk/id/publisher_policy/3286", + "uri": "https://openpolicyfinder.jisc.ac.uk/id/publisher_policy/3286", "permitted_oa": [ { "prerequisites": { @@ -429,13 +429,13 @@ }, "system_metadata": { "id": 908, - "uri": "https://v2.sherpa.ac.uk/id/repository/908" + "uri": "https://openpolicyfinder.jisc.ac.uk/id/repository/908" } }, { "system_metadata": { "id": 267, - "uri": "https://v2.sherpa.ac.uk/id/repository/267" + "uri": "https://openpolicyfinder.jisc.ac.uk/id/repository/267" }, "repository_metadata": { "type_phrases": [ @@ -473,7 +473,7 @@ ] } ], - "uri": "https://v2.sherpa.ac.uk/id/publisher_policy/4410" + "uri": "https://openpolicyfinder.jisc.ac.uk/id/publisher_policy/4410" } ], "title": [ diff --git a/dspace-api/src/test/resources/org/dspace/app/sherpa/plos.json b/dspace-api/src/test/resources/org/dspace/app/openpolicyfinder/plos.json similarity index 95% rename from dspace-api/src/test/resources/org/dspace/app/sherpa/plos.json rename to dspace-api/src/test/resources/org/dspace/app/openpolicyfinder/plos.json index d5c85fe5b7ef..c2cbf6120e9b 100644 --- a/dspace-api/src/test/resources/org/dspace/app/sherpa/plos.json +++ b/dspace-api/src/test/resources/org/dspace/app/openpolicyfinder/plos.json @@ -36,7 +36,7 @@ "system_metadata" : { "id" : 112, "publicly_visible" : "yes", - "uri" : "http://v2.sherpa.ac.uk/id/publisher/112", + "uri" : "https://openpolicyfinder.jisc.ac.uk/id/publisher/112", "date_created" : "2005-02-07 00:00:00", "publicly_visible_phrases" : [ { @@ -62,7 +62,7 @@ ] } ], - "uri" : "http://v2.sherpa.ac.uk/id/publication/17601", + "uri" : "https://openpolicyfinder.jisc.ac.uk/id/publication/17601", "id" : 17601, "type" : "journal", "issns" : [ @@ -112,7 +112,7 @@ } ], "id" : 17595, - "uri" : "http://v2.sherpa.ac.uk/id/publication/17595", + "uri" : "https://openpolicyfinder.jisc.ac.uk/id/publication/17595", "type" : "journal", "issns" : [ { @@ -192,11 +192,11 @@ } ], "id" : 17596, - "uri" : "http://v2.sherpa.ac.uk/id/publication/17596", + "uri" : "https://openpolicyfinder.jisc.ac.uk/id/publication/17596", "type" : "journal" }, { - "uri" : "http://v2.sherpa.ac.uk/id/publication/17597", + "uri" : "https://openpolicyfinder.jisc.ac.uk/id/publication/17597", "id" : 17597, "title" : [ { @@ -260,7 +260,7 @@ } ], "id" : 17598, - "uri" : "http://v2.sherpa.ac.uk/id/publication/17598", + "uri" : "https://openpolicyfinder.jisc.ac.uk/id/publication/17598", "type" : "journal", "issns" : [ { @@ -304,7 +304,7 @@ "phrase" : "Journal" } ], - "uri" : "http://v2.sherpa.ac.uk/id/publication/17599", + "uri" : "https://openpolicyfinder.jisc.ac.uk/id/publication/17599", "id" : 17599, "title" : [ { @@ -367,7 +367,7 @@ "language" : "en" } ], - "uri" : "http://v2.sherpa.ac.uk/id/publication/17600", + "uri" : "https://openpolicyfinder.jisc.ac.uk/id/publication/17600", "type" : "journal" } ], @@ -382,7 +382,7 @@ ], "internal_moniker" : "Default policy", "id" : 112, - "uri" : "http://v2.sherpa.ac.uk/id/publisher_policy/112", + "uri" : "https://openpolicyfinder.jisc.ac.uk/id/publisher_policy/112", "open_access_prohibited" : "no", "permitted_oa" : [ { @@ -540,7 +540,7 @@ }, "system_metadata" : { "id" : 267, - "uri" : "http://v2.sherpa.ac.uk/id/repository/267" + "uri" : "https://openpolicyfinder.jisc.ac.uk/id/repository/267" } } ], diff --git a/dspace-api/src/test/resources/org/dspace/app/sherpa/thelancet.json b/dspace-api/src/test/resources/org/dspace/app/openpolicyfinder/thelancet.json similarity index 98% rename from dspace-api/src/test/resources/org/dspace/app/sherpa/thelancet.json rename to dspace-api/src/test/resources/org/dspace/app/openpolicyfinder/thelancet.json index 6ff3440a44cd..9fb79a6fa319 100644 --- a/dspace-api/src/test/resources/org/dspace/app/sherpa/thelancet.json +++ b/dspace-api/src/test/resources/org/dspace/app/openpolicyfinder/thelancet.json @@ -59,7 +59,7 @@ "language" : "en" } ], - "uri" : "http://v2.sherpa.ac.uk/id/publisher/30", + "uri" : "https://openpolicyfinder.jisc.ac.uk/id/publisher/30", "id" : 30, "name" : [ { @@ -99,7 +99,7 @@ "value" : "yes" } ], - "uri" : "http://v2.sherpa.ac.uk/id/publication/23803", + "uri" : "https://openpolicyfinder.jisc.ac.uk/id/publication/23803", "date_modified" : "2020-03-06 11:25:54", "date_created" : "2012-11-20 14:51:52", "publicly_visible" : "yes" @@ -356,7 +356,7 @@ }, "system_metadata" : { "id" : 9, - "uri" : "http://v2.sherpa.ac.uk/id/funder/9" + "uri" : "https://openpolicyfinder.jisc.ac.uk/id/funder/9" } } ] @@ -400,7 +400,7 @@ ] } ], - "uri" : "http://v2.sherpa.ac.uk/id/publisher_policy/1274", + "uri" : "https://openpolicyfinder.jisc.ac.uk/id/publisher_policy/1274", "urls" : [ { "description" : "Guidelines for Authors", @@ -594,7 +594,7 @@ "url" : "https://www.elsevier.com/about/policies/open-access-licenses" } ], - "uri" : "http://v2.sherpa.ac.uk/id/publisher_policy/3323", + "uri" : "https://openpolicyfinder.jisc.ac.uk/id/publisher_policy/3323", "id" : 3323, "publication_count" : 2102 } diff --git a/dspace-iiif/pom.xml b/dspace-iiif/pom.xml index 15f509f778ba..64e56f25b28d 100644 --- a/dspace-iiif/pom.xml +++ b/dspace-iiif/pom.xml @@ -15,7 +15,7 @@ org.dspace dspace-parent - 8.4 + 8.5 .. diff --git a/dspace-iiif/src/main/java/org/dspace/app/iiif/service/WordHighlightSolrSearch.java b/dspace-iiif/src/main/java/org/dspace/app/iiif/service/WordHighlightSolrSearch.java index 9e6022548dbe..4a65e88e7c3c 100644 --- a/dspace-iiif/src/main/java/org/dspace/app/iiif/service/WordHighlightSolrSearch.java +++ b/dspace-iiif/src/main/java/org/dspace/app/iiif/service/WordHighlightSolrSearch.java @@ -24,6 +24,7 @@ import org.apache.solr.client.solrj.impl.HttpSolrClient; import org.apache.solr.client.solrj.impl.NoOpResponseParser; import org.apache.solr.client.solrj.request.QueryRequest; +import org.apache.solr.client.solrj.util.ClientUtils; import org.apache.solr.common.params.CommonParams; import org.apache.solr.common.util.NamedList; import org.dspace.app.iiif.model.generator.AnnotationGenerator; @@ -126,8 +127,10 @@ private String adjustQuery(String query) { * @return solr query */ private SolrQuery getSolrQuery(String query, String manifestId) { + String safeQuery = ClientUtils.escapeQueryChars(query); + String safeManifestId = ClientUtils.escapeQueryChars(manifestId); SolrQuery solrQuery = new SolrQuery(); - solrQuery.set("q", "ocr_text:" + query + " AND manifest_url:\"" + manifestId + "\""); + solrQuery.set("q", "ocr_text:" + safeQuery + " AND manifest_url:\"" + safeManifestId + "\""); solrQuery.set(CommonParams.WT, "json"); solrQuery.set("hl", "true"); solrQuery.set("hl.ocr.fl", "ocr_text"); diff --git a/dspace-oai/pom.xml b/dspace-oai/pom.xml index 262249bc145c..86941e2c5b23 100644 --- a/dspace-oai/pom.xml +++ b/dspace-oai/pom.xml @@ -8,14 +8,14 @@ dspace-parent org.dspace - 8.4 + 8.5 .. ${basedir}/.. - 3.4.1 + 3.4.2 diff --git a/dspace-oai/src/main/java/org/dspace/xoai/controller/DSpaceOAIDataProvider.java b/dspace-oai/src/main/java/org/dspace/xoai/controller/DSpaceOAIDataProvider.java index e070725de7be..26620af0780e 100644 --- a/dspace-oai/src/main/java/org/dspace/xoai/controller/DSpaceOAIDataProvider.java +++ b/dspace-oai/src/main/java/org/dspace/xoai/controller/DSpaceOAIDataProvider.java @@ -39,6 +39,7 @@ import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import org.apache.logging.log4j.Logger; +import org.dspace.app.util.XMLUtils; import org.dspace.core.Context; import org.dspace.services.ConfigurationService; import org.dspace.xoai.services.api.cache.XOAICacheService; @@ -101,7 +102,7 @@ public void setUpHTMLTransformerFactory() { String styleSheetPath = manager.getStyleSheet(); Resource styleSheetResource = resourceLoader.getResource("classpath:" + styleSheetPath); htmlTransformerSource = styleSheetResource.getContentAsByteArray(); - htmlTransformerFactory = TransformerFactory.newInstance(); + htmlTransformerFactory = XMLUtils.getTransformerFactory(); // run for potential exceptions only as a sanity check on the XSLT: htmlTransformerFactory.newTransformer( new StreamSource(new ByteArrayInputStream(htmlTransformerSource))); diff --git a/dspace-oai/src/main/java/org/dspace/xoai/services/impl/resources/DSpaceResourceResolver.java b/dspace-oai/src/main/java/org/dspace/xoai/services/impl/resources/DSpaceResourceResolver.java index 83c4486f7134..4c03fe4bee9b 100644 --- a/dspace-oai/src/main/java/org/dspace/xoai/services/impl/resources/DSpaceResourceResolver.java +++ b/dspace-oai/src/main/java/org/dspace/xoai/services/impl/resources/DSpaceResourceResolver.java @@ -18,20 +18,25 @@ import javax.xml.transform.stream.StreamSource; import com.lyncode.xoai.dataprovider.services.api.ResourceResolver; +import org.dspace.app.util.XMLUtils; import org.dspace.services.ConfigurationService; import org.dspace.services.factory.DSpaceServicesFactory; public class DSpaceResourceResolver implements ResourceResolver { - // Requires usage of Saxon as OAI-PMH uses some XSLT 2 functions - private static final TransformerFactory transformerFactory = TransformerFactory - .newInstance("net.sf.saxon.TransformerFactoryImpl", null); - private final String basePath; + private final String crosswalksPath; public DSpaceResourceResolver() { ConfigurationService configurationService = DSpaceServicesFactory.getInstance().getConfigurationService(); + // base path for resolving XSLT templates basePath = configurationService.getProperty("oai.config.dir"); + // additional path for crosswalks which may be used by XSLT templates + crosswalksPath = configurationService.getProperty("dspace.dir") + + File.separator + + "config" + + File.separator + + "crosswalks"; } @Override @@ -48,6 +53,13 @@ public Templates getTemplates(String path) throws IOException, TransformerConfig // XSLT-files (like ) String systemId = basePath + "/" + path; mySrc.setSystemId(systemId); + + // Requires usage of Saxon as OAI-PMH uses some XSLT 2 functions. Only trust stylesheets stored under + // the given path(s). + TransformerFactory transformerFactory = + XMLUtils.getTrustedTransformerFactory("net.sf.saxon.TransformerFactoryImpl", + new String[] {basePath, crosswalksPath}); + return transformerFactory.newTemplates(mySrc); } } diff --git a/dspace-oai/src/main/java/org/dspace/xoai/util/ItemUtils.java b/dspace-oai/src/main/java/org/dspace/xoai/util/ItemUtils.java index 78c98533e0b4..5eb794e19288 100644 --- a/dspace-oai/src/main/java/org/dspace/xoai/util/ItemUtils.java +++ b/dspace-oai/src/main/java/org/dspace/xoai/util/ItemUtils.java @@ -18,7 +18,6 @@ import com.lyncode.xoai.dataprovider.xml.xoai.Element; import com.lyncode.xoai.dataprovider.xml.xoai.Metadata; import com.lyncode.xoai.util.Base64Utils; -import org.apache.commons.text.StringEscapeUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.dspace.app.util.factory.UtilServiceFactory; @@ -168,7 +167,7 @@ private static Element createBundlesElement(Context context, Item item) throws S /** * Sanitizes a string to remove characters that are invalid - * in XML 1.0 using the Apache Commons Text library. + * in XML 1.0 using a hardcoded regex to avoid escaping special characters twice. * @param value The string to sanitize. * @return A sanitized string, or null if the input was null. */ @@ -176,7 +175,15 @@ private static String sanitize(String value) { if (value == null) { return null; } - return StringEscapeUtils.escapeXml10(value); + + // Strips characters that are illegal in XML 1.0 (per the XML spec, https://www.w3.org/TR/xml/#charsets) + // The allowed character set is: #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] + // This regex matches everything OUTSIDE that allowed set, i.e. it removes: + // - C0 control characters other than tab (\x09), LF (\x0A), and CR (\x0D) + // (i.e. \x00-\x08, \x0B, \x0C, \x0E-\x1F) + // - The UTF-16 surrogate range \uD800-\uDFFF + // - The non-characters \uFFFE and \uFFFF + return value.replaceAll("[^\\x09\\x0A\\x0D\\x20-\\uD7FF\\uE000-\\uFFFD]", ""); } /** diff --git a/dspace-oai/src/main/resources/templates/index.html b/dspace-oai/src/main/resources/templates/index.html index a0d35d91dea2..5aa811687bbf 100644 --- a/dspace-oai/src/main/resources/templates/index.html +++ b/dspace-oai/src/main/resources/templates/index.html @@ -19,7 +19,7 @@ - + @@ -55,8 +55,26 @@

Identify List Sets List Metadata Formats - List Identifiers - List Records +
+ + +
+
+ + +

diff --git a/dspace-oai/src/test/java/org/dspace/xoai/tests/integration/xoai/PipelineTest.java b/dspace-oai/src/test/java/org/dspace/xoai/tests/integration/xoai/PipelineTest.java index 0f7ffde0bd00..4707334fab03 100644 --- a/dspace-oai/src/test/java/org/dspace/xoai/tests/integration/xoai/PipelineTest.java +++ b/dspace-oai/src/test/java/org/dspace/xoai/tests/integration/xoai/PipelineTest.java @@ -19,16 +19,16 @@ import com.lyncode.xoai.util.XSLPipeline; import org.apache.commons.io.IOUtils; +import org.dspace.app.util.XMLUtils; import org.dspace.xoai.tests.support.XmlMatcherBuilder; import org.junit.Test; public class PipelineTest { - private static TransformerFactory factory = TransformerFactory.newInstance(); - @Test public void pipelineTest() throws Exception { InputStream input = PipelineTest.class.getClassLoader().getResourceAsStream("item.xml"); InputStream xslt = PipelineTest.class.getClassLoader().getResourceAsStream("oai_dc.xsl"); + TransformerFactory factory = XMLUtils.getTransformerFactory(); String output = IOUtils.toString(new XSLPipeline(input, true) .apply(factory.newTemplates(new StreamSource(xslt))) .getTransformed(), Charset.defaultCharset()); diff --git a/dspace-oai/src/test/java/org/dspace/xoai/tests/stylesheets/AbstractXSLTest.java b/dspace-oai/src/test/java/org/dspace/xoai/tests/stylesheets/AbstractXSLTest.java index 42dbed04b63b..75b725e108aa 100644 --- a/dspace-oai/src/test/java/org/dspace/xoai/tests/stylesheets/AbstractXSLTest.java +++ b/dspace-oai/src/test/java/org/dspace/xoai/tests/stylesheets/AbstractXSLTest.java @@ -17,12 +17,9 @@ import javax.xml.transform.stream.StreamSource; import org.apache.commons.io.IOUtils; +import org.dspace.app.util.XMLUtils; public abstract class AbstractXSLTest { - // Requires usage of Saxon as OAI-PMH uses some XSLT 2 functions - private static final TransformerFactory factory = TransformerFactory - .newInstance("net.sf.saxon.TransformerFactoryImpl", null); - protected TransformBuilder apply(String xslLocation) throws Exception { return new TransformBuilder(xslLocation); } @@ -44,8 +41,16 @@ public static class TransformBuilder { private final Transformer transformer; public TransformBuilder(String xslLocation) throws Exception { + File inputFile = new File("../dspace/config/crosswalks/oai/metadataFormats", xslLocation); + String inputFileDir = inputFile.toPath().normalize().getParent().toString(); + + // Requires usage of Saxon as OAI-PMH uses some XSLT 2 functions. Only trust stylesheets stored under + // the same directory as the given XSL. + TransformerFactory factory = XMLUtils.getTrustedTransformerFactory("net.sf.saxon.TransformerFactoryImpl", + new String[] {inputFileDir}); + this.transformer = factory.newTransformer( - new StreamSource(new File("../dspace/config/crosswalks/oai/metadataFormats", xslLocation))); + new StreamSource(inputFile)); } public String to(InputStream input) throws Exception { diff --git a/dspace-rdf/pom.xml b/dspace-rdf/pom.xml index db24b3995688..4b5675d65623 100644 --- a/dspace-rdf/pom.xml +++ b/dspace-rdf/pom.xml @@ -9,7 +9,7 @@ org.dspace dspace-parent - 8.4 + 8.5 .. @@ -24,25 +24,10 @@ org.apache.jena apache-jena-libs + - jackson-core - com.fasterxml.jackson.core - - - jackson-databind - com.fasterxml.jackson.core - - - org.slf4j - slf4j-api - - - org.slf4j - slf4j-log4j12 - - - log4j - log4j + org.checkerframework + checker-qual pom diff --git a/dspace-server-webapp/pom.xml b/dspace-server-webapp/pom.xml index 3f226327fb94..e6d251abe9c5 100644 --- a/dspace-server-webapp/pom.xml +++ b/dspace-server-webapp/pom.xml @@ -14,7 +14,7 @@ org.dspace dspace-parent - 8.4 + 8.5 .. @@ -588,7 +588,7 @@ org.apache.httpcomponents.client5 httpclient5 - 5.6.1 + 5.6.4 test diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/CollectionItemTemplateController.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/CollectionItemTemplateController.java index 66a3965d869e..c7dc746eafe8 100644 --- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/CollectionItemTemplateController.java +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/CollectionItemTemplateController.java @@ -16,8 +16,8 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import jakarta.servlet.http.HttpServletRequest; -import jakarta.ws.rs.BadRequestException; import org.dspace.app.rest.converter.ConverterService; +import org.dspace.app.rest.exception.DSpaceBadRequestException; import org.dspace.app.rest.exception.UnprocessableEntityException; import org.dspace.app.rest.model.CollectionRest; import org.dspace.app.rest.model.TemplateItemRest; @@ -106,7 +106,8 @@ public ResponseEntity> createTemplateItem(HttpServletRequ throws SQLException, AuthorizeException { if (itemBody == null) { - throw new BadRequestException("The new item should be included as json in the body of this request"); + throw new DSpaceBadRequestException( + "The new item should be included as json in the body of this request"); } Context context = ContextUtil.obtainContext(request); @@ -143,7 +144,7 @@ public ResponseEntity> createTemplateItem(HttpServletRequ * @return The template item from the Collection in the request * @throws SQLException */ - @PreAuthorize("hasPermission(#uuid, 'COLLECTION', 'READ')") + @PreAuthorize("hasPermission(#uuid, 'COLLECTION', 'ADD')") @RequestMapping(method = RequestMethod.GET) public TemplateItemResource getTemplateItem(HttpServletRequest request, @PathVariable UUID uuid) throws SQLException { diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/ExternalSourcesRestController.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/ExternalSourcesRestController.java index 357ea409c0f6..0c8862527ea7 100644 --- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/ExternalSourcesRestController.java +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/ExternalSourcesRestController.java @@ -17,6 +17,7 @@ import org.springframework.data.domain.Pageable; import org.springframework.data.web.PagedResourcesAssembler; import org.springframework.hateoas.PagedModel; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -54,6 +55,7 @@ public class ExternalSourcesRestController { * @return A paginated list of ExternalSourceEntryResource objects that comply with the params */ @RequestMapping(method = RequestMethod.GET, value = "/entries") + @PreAuthorize("hasAuthority('AUTHENTICATED')") public PagedModel getExternalSourceEntries( @PathVariable("externalSourceName") String externalSourceName, @RequestParam(name = "query") String query, @@ -81,6 +83,7 @@ public PagedModel getExternalSourceEntries( * @return An ExternalSourceEntryResource that complies with the above params */ @RequestMapping(method = RequestMethod.GET, value = "/entryValues/{entryId}") + @PreAuthorize("hasAuthority('AUTHENTICATED')") public ExternalSourceEntryResource getExternalSourceEntryValue(@PathVariable("externalSourceName") String externalSourceName, @PathVariable("entryId") String entryId) { diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/OpenSearchController.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/OpenSearchController.java index 85ec441e20c1..760bf7946082 100644 --- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/OpenSearchController.java +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/OpenSearchController.java @@ -14,7 +14,6 @@ import java.util.Map; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; @@ -26,6 +25,7 @@ import org.dspace.app.rest.utils.ContextUtil; import org.dspace.app.rest.utils.ScopeResolver; import org.dspace.app.util.SyndicationFeed; +import org.dspace.app.util.XMLUtils; import org.dspace.app.util.factory.UtilServiceFactory; import org.dspace.app.util.service.OpenSearchService; import org.dspace.core.Context; @@ -205,7 +205,7 @@ public void search(HttpServletRequest request, (int) qResults.getTotalSearchResults(), qResults.getStart(), qResults.getMaxResults(), container, dsoResults, labelMap); try { - Transformer xf = TransformerFactory.newInstance().newTransformer(); + Transformer xf = XMLUtils.getTransformerFactory().newTransformer(); response.setContentType(openSearchService.getContentType(format)); xf.transform(new DOMSource(resultsDoc), new StreamResult(response.getWriter())); diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/health/SEOHealthIndicator.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/health/SEOHealthIndicator.java index 5b57f2d537fc..cf5634a2c2db 100644 --- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/health/SEOHealthIndicator.java +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/health/SEOHealthIndicator.java @@ -7,9 +7,11 @@ */ package org.dspace.app.rest.health; +import static org.dspace.app.rest.configuration.ActuatorConfiguration.UP_WITH_ISSUES_STATUS; + import org.apache.commons.lang3.StringUtils; import org.dspace.services.ConfigurationService; -import org.dspace.services.factory.DSpaceServicesFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.actuate.health.AbstractHealthIndicator; import org.springframework.boot.actuate.health.Health; import org.springframework.web.client.RestTemplate; @@ -22,9 +24,26 @@ */ public class SEOHealthIndicator extends AbstractHealthIndicator { - ConfigurationService configurationService = DSpaceServicesFactory.getInstance().getConfigurationService(); + public static final String SITEMAP = "sitemap"; + public static final String ROBOTS_TXT = "robots.txt"; + public static final String SSR = "ssr"; + public static final String OK = "OK"; + public static final String SITEMAP_MISSING = "Sitemaps are missing or inaccessible. Please see the " + + "DSpace Documentation on Search Engine Optimization for how to enable " + + "Sitemaps."; + public static final String ROBOTS_MISSING = "Missing or inaccessible. Please see the DSpace Documentation on " + + "Search Engine Optimization for how to create a robots.txt."; + public static final String ROBOTS_INVALID = "Invalid because it contains localhost URLs. This is often a sign " + + "that a proxy is failing to pass X-Forwarded headers to DSpace. Please see the DSpace " + + "Documentation on Search Engine Optimization for how to pass X-Forwarded headers."; + public static final String SSR_DISABLED = "Server-side rendering (SSR) appears to be disabled. Most " + + "search engines require enabling SSR for proper indexing. Please see the DSpace Documentation on" + + " Search Engine Optimization for more details."; + + @Autowired + private ConfigurationService configurationService; - private final RestTemplate restTemplate = new RestTemplate(); + private RestTemplate restTemplate = new RestTemplate(); @Override protected void doHealthCheck(Health.Builder builder) { @@ -36,27 +55,21 @@ protected void doHealthCheck(Health.Builder builder) { if (sitemapOk && robotsTxtStatus == RobotsTxtStatus.VALID && ssrOk) { builder.up() - .withDetail("sitemap", "OK") - .withDetail("robots.txt", "OK") - .withDetail("ssr", "OK"); + .withDetail(SITEMAP, OK) + .withDetail(ROBOTS_TXT, OK) + .withDetail(SSR, OK); } else { - builder.down(); - builder.withDetail("sitemap", sitemapOk ? "OK" : "Sitemaps are missing or inaccessible. Please see the " + - "DSpace Documentation on Search Engine Optimization for how to enable Sitemaps."); + builder.status(UP_WITH_ISSUES_STATUS) + .withDetail(SITEMAP, sitemapOk ? OK : SITEMAP_MISSING); if (robotsTxtStatus == RobotsTxtStatus.MISSING) { - builder.withDetail("robots.txt", "Missing or inaccessible. Please see the DSpace Documentation on " + - "Search Engine Optimization for how to create a robots.txt."); + builder.withDetail(ROBOTS_TXT, ROBOTS_MISSING); } else if (robotsTxtStatus == RobotsTxtStatus.INVALID) { - builder.withDetail("robots.txt", "Invalid because it contains localhost URLs. This is often a sign " + - "that a proxy is failing to pass X-Forwarded headers to DSpace. Please see the DSpace " + - "Documentation on Search Engine Optimization for how to pass X-Forwarded headers."); + builder.withDetail(ROBOTS_TXT, ROBOTS_INVALID); } else { - builder.withDetail("robots.txt", "OK"); + builder.withDetail(ROBOTS_TXT, OK); } - builder.withDetail("ssr", ssrOk ? "OK" : "Server-side rendering (SSR) appears to be disabled. Most " + - "search engines require enabling SSR for proper indexing. Please see the DSpace Documentation on" + - " Search Engine Optimization for more details."); + builder.withDetail(SSR, ssrOk ? OK : SSR_DISABLED); } } diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/login/impl/ResearcherProfileAutomaticClaim.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/login/impl/ResearcherProfileAutomaticClaim.java index 8521da970b27..2244e706ea69 100644 --- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/login/impl/ResearcherProfileAutomaticClaim.java +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/login/impl/ResearcherProfileAutomaticClaim.java @@ -10,6 +10,7 @@ import static org.apache.commons.collections4.IteratorUtils.toList; import static org.apache.commons.lang3.StringUtils.isBlank; import static org.dspace.content.authority.Choices.CF_ACCEPTED; +import static org.dspace.core.Constants.WRITE; import java.sql.SQLException; import java.util.List; @@ -22,6 +23,7 @@ import org.apache.logging.log4j.Logger; import org.dspace.app.rest.login.PostLoggedInAction; import org.dspace.authorize.AuthorizeException; +import org.dspace.authorize.service.AuthorizeService; import org.dspace.content.Item; import org.dspace.content.MetadataFieldName; import org.dspace.content.service.ItemService; @@ -54,6 +56,9 @@ public class ResearcherProfileAutomaticClaim implements PostLoggedInAction { @Autowired private EPersonService ePersonService; + @Autowired + private AuthorizeService authorizeService; + /** * The field of the eperson to search for. */ @@ -104,6 +109,7 @@ private void claimProfile(Context context, EPerson currentUser) throws SQLExcept if (item != null) { itemService.addMetadata(context, item, "dspace", "object", "owner", null, fullName, id.toString(), CF_ACCEPTED); + authorizeService.addPolicy(context, item, WRITE, currentUser); } } diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/model/RegistrationRest.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/model/RegistrationRest.java index eb7c58a18cba..9eef047f11dd 100644 --- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/model/RegistrationRest.java +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/model/RegistrationRest.java @@ -10,9 +10,10 @@ import java.util.UUID; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.constraints.Email; +import jakarta.validation.constraints.NotEmpty; import org.dspace.app.rest.RestResourceController; - /** * This class acts as the REST representation of the RegistrationData model class. * This class acts as a data holder for the RegistrationResource @@ -24,7 +25,10 @@ public class RegistrationRest extends RestAddressableModel { public static final String PLURAL_NAME = "registrations"; public static final String CATEGORY = EPERSON; + @Email + @NotEmpty private String email; + private UUID user; /** diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/model/step/SherpaPolicy.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/model/step/OpenPolicyFinderPolicy.java similarity index 55% rename from dspace-server-webapp/src/main/java/org/dspace/app/rest/model/step/SherpaPolicy.java rename to dspace-server-webapp/src/main/java/org/dspace/app/rest/model/step/OpenPolicyFinderPolicy.java index 1f6bd07c2af1..08e0e9441498 100644 --- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/model/step/SherpaPolicy.java +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/model/step/OpenPolicyFinderPolicy.java @@ -9,20 +9,20 @@ import java.util.Date; -import org.dspace.app.sherpa.v2.SHERPAResponse; +import org.dspace.app.openpolicyfinder.v2.OpenPolicyFinderResponse; /** - * Java Bean to expose Sherpa policies during in progress submission. + * Java Bean to expose Open Policy Finder policies during in progress submission. * * @author Mykhaylo Boychuk (mykhaylo.boychuk at 4science.com) */ -public class SherpaPolicy implements SectionData { +public class OpenPolicyFinderPolicy implements SectionData { private static final long serialVersionUID = 2440249335255683173L; private Date retrievalTime; - private SHERPAResponse sherpaResponse; + private OpenPolicyFinderResponse opfResponse; public Date getRetrievalTime() { return retrievalTime; @@ -32,17 +32,17 @@ public void setRetrievalTime(Date retrievalTime) { this.retrievalTime = retrievalTime; } - public SHERPAResponse getSherpaResponse() { - return sherpaResponse; + public OpenPolicyFinderResponse getOpfResponse() { + return opfResponse; } /** - * Setting a sherpaResponse will automatically set the retrievealTime + * Setting a opfResponse will automatically set the retrievealTime * of the section copying the value from the response if not null */ - public void setSherpaResponse(SHERPAResponse sherpaResponse) { - this.sherpaResponse = sherpaResponse; - this.retrievalTime = sherpaResponse.getRetrievalTime(); + public void setOpfResponse(OpenPolicyFinderResponse opfResponse) { + this.opfResponse = opfResponse; + this.retrievalTime = opfResponse.getRetrievalTime(); } } \ No newline at end of file diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/EPersonRestRepository.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/EPersonRestRepository.java index ce1edc1eed92..9f9b5d1d5052 100644 --- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/EPersonRestRepository.java +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/EPersonRestRepository.java @@ -253,6 +253,7 @@ public Page findAll(Context context, Pageable pageable) { * is the *required* email address * @return a Page of EPersonRest instances matching the user query */ + @PreAuthorize("hasAuthority('ADMIN') || hasAuthority('MANAGE_ACCESS_GROUP')") @SearchRestMethod(name = "byEmail") public EPersonRest findByEmail(@Parameter(value = "email", required = true) String email) { EPerson eperson = null; diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/ExternalSourceRestRepository.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/ExternalSourceRestRepository.java index 736261cd263b..a19630579c00 100644 --- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/ExternalSourceRestRepository.java +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/ExternalSourceRestRepository.java @@ -82,7 +82,7 @@ public Page getExternalSourceEntries(String externalSou } @Override - @PreAuthorize("permitAll()") + @PreAuthorize("hasAuthority('AUTHENTICATED')") public ExternalSourceRest findOne(Context context, String externalSourceName) { ExternalDataProvider externalDataProvider = externalDataService.getExternalDataProvider(externalSourceName); if (externalDataProvider == null) { @@ -93,7 +93,7 @@ public ExternalSourceRest findOne(Context context, String externalSourceName) { } @Override - @PreAuthorize("permitAll()") + @PreAuthorize("hasAuthority('AUTHENTICATED')") public Page findAll(Context context, Pageable pageable) { List externalSources = externalDataService.getExternalDataProviders(); return converter.toRestPage(externalSources, pageable, utils.obtainProjection()); @@ -107,7 +107,7 @@ public Page findAll(Context context, Pageable pageable) { * @param entityType Entity type label * @return */ - @PreAuthorize("permitAll()") + @PreAuthorize("hasAuthority('AUTHENTICATED')") @SearchRestMethod(name = "findByEntityType") public Page findByEntityType(Context context, Pageable pageable, @Parameter(required = true, value = "entityType") String entityType) { diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/ProcessRestRepository.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/ProcessRestRepository.java index 9942f55b82a5..107a0bdb6b48 100644 --- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/ProcessRestRepository.java +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/ProcessRestRepository.java @@ -168,12 +168,13 @@ public BitstreamRest getProcessBitstreamByType(Integer processId, String type) } @Override - protected void delete(Context context, Integer integer) + @PreAuthorize("hasPermission(#processId, 'PROCESS', 'DELETE')") + protected void delete(Context context, Integer processId) throws AuthorizeException, RepositoryMethodNotImplementedException { try { - processService.delete(context, processService.find(context, integer)); + processService.delete(context, processService.find(context, processId)); } catch (SQLException | IOException e) { - log.error("Something went wrong trying to find Process with id: " + integer, e); + log.error("Something went wrong trying to find Process with id: " + processId, e); throw new RuntimeException(e.getMessage(), e); } } diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/RegistrationRestRepository.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/RegistrationRestRepository.java index 9c1c3b393bbb..c68a39e5d1b0 100644 --- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/RegistrationRestRepository.java +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/RegistrationRestRepository.java @@ -11,11 +11,14 @@ import java.io.IOException; import java.sql.SQLException; +import java.util.Set; import com.fasterxml.jackson.databind.ObjectMapper; import jakarta.mail.MessagingException; import jakarta.servlet.ServletInputStream; import jakarta.servlet.http.HttpServletRequest; +import jakarta.validation.ConstraintViolation; +import jakarta.validation.Validator; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -79,6 +82,12 @@ public class RegistrationRestRepository extends DSpaceRestRepository findAll(Context context, Pageable pageable) { @Override public RegistrationRest createAndReturn(Context context) { HttpServletRequest request = requestService.getCurrentRequest().getHttpServletRequest(); - ObjectMapper mapper = new ObjectMapper(); - RegistrationRest registrationRest; String accountType = request.getParameter(TYPE_QUERY_PARAM); if (StringUtils.isBlank(accountType) || (!accountType.equalsIgnoreCase(TYPE_FORGOT) && !accountType.equalsIgnoreCase(TYPE_REGISTER))) { @@ -112,61 +119,42 @@ public RegistrationRest createAndReturn(Context context) { } } + RegistrationRest registrationRest; try { ServletInputStream input = request.getInputStream(); registrationRest = mapper.readValue(input, RegistrationRest.class); } catch (IOException e1) { throw new UnprocessableEntityException("Error parsing request body.", e1); } - if (StringUtils.isBlank(registrationRest.getEmail())) { - throw new UnprocessableEntityException("The email cannot be omitted from the Registration endpoint"); + + // Validation of deserialized object + Set> violations = validator.validate(registrationRest); + if (violations != null && !violations.isEmpty()) { + StringBuilder sb = new StringBuilder(); + for (ConstraintViolation v : violations) { + sb.append(v.getPropertyPath()) + .append(": ") + .append(v.getMessage()) + .append("; "); + } + throw new UnprocessableEntityException("Validation error: " + sb.toString()); } + EPerson eperson = null; try { eperson = ePersonService.findByEmail(context, registrationRest.getEmail()); } catch (SQLException e) { log.error("Something went wrong retrieving EPerson for email: " + registrationRest.getEmail(), e); } + if (eperson != null && accountType.equalsIgnoreCase(TYPE_FORGOT)) { - try { - if (!AuthorizeUtil.authorizeForgotPassword()) { - throw new AccessDeniedException("Password reset is not allowed!"); - } - if (!AuthorizeUtil.authorizeUpdatePassword(context, eperson.getEmail())) { - throw new DSpaceBadRequestException("Password cannot be updated for the given EPerson with email: " - + eperson.getEmail()); - } - accountService.sendForgotPasswordInfo(context, registrationRest.getEmail()); - } catch (SQLException | IOException | MessagingException | AuthorizeException e) { - log.error("Something went wrong with sending forgot password info email: " - + registrationRest.getEmail(), e); - } + resetPassword(context, registrationRest, eperson); } else if (accountType.equalsIgnoreCase(TYPE_REGISTER)) { if (eperson == null) { - try { - String email = registrationRest.getEmail(); - if (!AuthorizeUtil.authorizeNewAccountRegistration(context, request)) { - throw new AccessDeniedException( - "Registration is disabled, you are not authorized to create a new Authorization"); - } - if (!authenticationService.canSelfRegister(context, request, email)) { - throw new UnprocessableEntityException( - String.format("Registration is not allowed with email address" + - " %s", email)); - } - accountService.sendRegistrationInfo(context, email); - } catch (SQLException | IOException | MessagingException | AuthorizeException e) { - log.error("Something went wrong with sending registration info email: " - + registrationRest.getEmail(), e); - } + registerEperson(context, request, registrationRest); } else { // if an eperson with this email already exists then send "forgot password" email instead - try { - accountService.sendForgotPasswordInfo(context, registrationRest.getEmail()); - } catch (SQLException | IOException | MessagingException | AuthorizeException e) { - log.error("Something went wrong with sending forgot password info email: " - + registrationRest.getEmail(), e); - } + resetPassword(context, registrationRest, eperson); } } return null; @@ -177,6 +165,63 @@ public Class getDomainClass() { return RegistrationRest.class; } + /** + * This method will register a new eperson with the email given in the registrationRest object, and send an + * registration email to that email address. + * @param context + * @param request + * @param registrationRest + * @throws UnprocessableEntityException If self registration is not allowed. + * @throws AccessDeniedException If the user is not authorized to register a new eperson + */ + private void registerEperson(Context context, HttpServletRequest request, RegistrationRest registrationRest) + throws UnprocessableEntityException, AccessDeniedException { + try { + if (!AuthorizeUtil.authorizeNewAccountRegistration(context, request)) { + throw new AccessDeniedException( + "Registration is disabled, you are not authorized to create a new Authorization"); + } + + if (!authenticationService.canSelfRegister(context, request, registrationRest.getEmail())) { + throw new UnprocessableEntityException( + String.format("Registration is not allowed with email address" + + " %s", registrationRest.getEmail())); + } + + accountService.sendRegistrationInfo(context, registrationRest.getEmail()); + } catch (SQLException | IOException | MessagingException | AuthorizeException e) { + log.error("Something went wrong with sending registration info email: " + + registrationRest.getEmail(), e); + } + } + + /** + * This method will send a forgot password email to the email address given in the registrationRest object, if the + * email address belongs to an existing eperson. If the email address doesn't belong to any existing eperson, + * nothing will happen. + * @param context + * @param registrationRest + * @param eperson + * @throws AccessDeniedException If the user is not authorized to reset the password for the given eperson + * @throws DSpaceBadRequestException If the password cannot be updated for the given eperson + */ + private void resetPassword(Context context, RegistrationRest registrationRest, EPerson eperson) + throws AccessDeniedException, DSpaceBadRequestException { + try { + if (!AuthorizeUtil.authorizeForgotPassword()) { + throw new AccessDeniedException("Password reset is not allowed!"); + } + if (!AuthorizeUtil.authorizeUpdatePassword(context, eperson.getEmail())) { + throw new DSpaceBadRequestException("Password cannot be updated for the given EPerson with email: " + + eperson.getEmail()); + } + accountService.sendForgotPasswordInfo(context, registrationRest.getEmail()); + } catch (SQLException | IOException | MessagingException | AuthorizeException e) { + log.error("Something went wrong with sending forgot password info email: " + + registrationRest.getEmail(), e); + } + } + /** * This method will find the RegistrationRest object that is associated with the token given * @param token The token to be found and for which a RegistrationRest object will be found @@ -186,7 +231,14 @@ public Class getDomainClass() { */ @SearchRestMethod(name = "findByToken") public RegistrationRest findByToken(@Parameter(value = "token", required = true) String token) - throws SQLException, AuthorizeException { + throws SQLException, AuthorizeException, DSpaceBadRequestException { + if (StringUtils.isBlank(token)) { + throw new DSpaceBadRequestException("Missing or empty token query parameter"); + } + if (StringUtils.length(token) > 48) { + throw new DSpaceBadRequestException("Token length cannot be longer than 48 characters"); + } + Context context = obtainContext(); RegistrationData registrationData = registrationDataService.findByToken(context, token); if (registrationData == null) { diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/ScriptRestRepository.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/ScriptRestRepository.java index e26f91c88981..87b03dc11715 100644 --- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/ScriptRestRepository.java +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/ScriptRestRepository.java @@ -191,6 +191,11 @@ private void checkFileNames(DSpaceRunnable dSpaceRunnable, List f String fileName = file.getOriginalFilename(); if (fileNames.contains(fileName)) { throw new UnprocessableEntityException("There are two files with the same name: " + fileName); + } else if (StringUtils.containsAny(fileName, "..", "/", "\\")) { + // NOTE: This is just a "fail-fast", basic protection against a potential path traversal attack. + // Individual scripts MUST also contain their own path traversal protections. + throw new UnprocessableEntityException( + "Filenames cannot contain path characters such as '..', '/', or '\\' : " + fileName); } else { fileNames.add(fileName); } diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/VersionItemLinkRepository.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/VersionItemLinkRepository.java index d171492e9fa1..265649a5fcc5 100644 --- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/VersionItemLinkRepository.java +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/VersionItemLinkRepository.java @@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Pageable; import org.springframework.data.rest.webmvc.ResourceNotFoundException; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.stereotype.Component; /** @@ -44,6 +45,7 @@ public class VersionItemLinkRepository extends AbstractDSpaceRestRepository * @return The ItemRest object that is relevant for the Version * @throws SQLException If something goes wrong */ + @PreAuthorize("@versioningSecurity.isEnableVersioning() && hasPermission(#versionId, 'VERSION', 'READ')") public ItemRest getVersionItem(@Nullable HttpServletRequest request, Integer versionId, @Nullable Pageable optionalPageable, diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/scripts/handler/impl/RestDSpaceRunnableHandler.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/scripts/handler/impl/RestDSpaceRunnableHandler.java index ee67baa8ab38..ccaaecc59017 100644 --- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/scripts/handler/impl/RestDSpaceRunnableHandler.java +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/scripts/handler/impl/RestDSpaceRunnableHandler.java @@ -50,8 +50,8 @@ public class RestDSpaceRunnableHandler implements DSpaceRunnableHandler { .getLogger(RestDSpaceRunnableHandler.class); private BitstreamService bitstreamService = ContentServiceFactory.getInstance().getBitstreamService(); - private ProcessService processService = ScriptServiceFactory.getInstance().getProcessService(); private EPersonService ePersonService = EPersonServiceFactory.getInstance().getEPersonService(); + private ProcessService processService = ScriptServiceFactory.getInstance().getProcessService(); private Integer processId; private String scriptName; @@ -70,6 +70,7 @@ public RestDSpaceRunnableHandler(EPerson ePerson, String scriptName, List getSpecialGroups() { Context context = new Context(); + setCurrentUser(context); List specialGroups = new ArrayList<>(); try { Process process = processService.find(context, processId); @@ -329,4 +332,25 @@ public List getSpecialGroups() { } return specialGroups; } + + /** + * Set the current context user if ePerson UUID parameter is not null + * and can be found. Reloads from database to avoid detached entity + * issues in downstream usage (e.g. authorization checks with equals() + * checks on EPerson objects, after the initial context was closed) + * @param context The current DSpace context + */ + private void setCurrentUser(Context context) { + if (ePersonId == null) { + return; + } + try { + EPerson ePerson = ePersonService.find(context, ePersonId); + if (ePerson != null) { + context.setCurrentUser(ePerson); + } + } catch (SQLException e) { + log.error("Could not set the current user", e); + } + } } diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/ProcessRestPermissionEvaluatorPlugin.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/ProcessRestPermissionEvaluatorPlugin.java index b476b3fef98d..541948ab163f 100644 --- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/ProcessRestPermissionEvaluatorPlugin.java +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/ProcessRestPermissionEvaluatorPlugin.java @@ -54,17 +54,20 @@ public boolean hasDSpacePermission(Authentication authentication, Serializable t Request request = requestService.getCurrentRequest(); Context context = ContextUtil.obtainContext(request.getHttpServletRequest()); + if (context == null) { + return false; + } try { int processId = Integer.parseInt(targetId.toString()); Process process = processService.find(context, processId); + // This previously returned true, to allow a 404 to be thrown later. However, this assists enumeration + // of sequential process IDs. It is better to simply return 'unauthorized' here. if (process == null) { - return true; - } - if (!((context.getCurrentUser() == null) || (!context.getCurrentUser().equals(process.getEPerson()) - && !authorizeService.isAdmin(context)))) { - return true; + return false; } + // Only the process owner or an administrator may perform any action + return processService.authorizeActionBoolean(context, process); } catch (SQLException e) { log.error(e::getMessage, e); } diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/submit/step/OpenPolicyFinderPolicyStep.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/submit/step/OpenPolicyFinderPolicyStep.java new file mode 100644 index 000000000000..cf89feb26111 --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/submit/step/OpenPolicyFinderPolicyStep.java @@ -0,0 +1,64 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.submit.step; + +import java.util.Objects; + +import jakarta.servlet.http.HttpServletRequest; +import org.dspace.app.openpolicyfinder.cache.OpenPolicyFinderCacheEvictService; +import org.dspace.app.openpolicyfinder.submit.OpenPolicyFinderSubmitService; +import org.dspace.app.openpolicyfinder.v2.OpenPolicyFinderResponse; +import org.dspace.app.rest.model.patch.Operation; +import org.dspace.app.rest.model.step.OpenPolicyFinderPolicy; +import org.dspace.app.rest.submit.AbstractProcessingStep; +import org.dspace.app.rest.submit.SubmissionService; +import org.dspace.app.util.SubmissionStepConfig; +import org.dspace.content.InProgressSubmission; +import org.dspace.core.Context; +import org.dspace.utils.DSpace; +import org.dspace.web.ContextUtil; + +/** + * OpenPolicyFinderPolicy step for DSpace Spring Rest. Expose information about + * the Open Policy Finder policies for the in progress submission. + * + * @author Mykhaylo Boychuk (mykhaylo.boychuk at 4science.com) + */ +public class OpenPolicyFinderPolicyStep extends AbstractProcessingStep { + + public static final String RETRIEVAL_TIME = "retrievalTime"; + + private OpenPolicyFinderCacheEvictService opfCacheEvictService = new DSpace().getSingletonService( + OpenPolicyFinderCacheEvictService.class); + private OpenPolicyFinderSubmitService opfSubmitService = + new DSpace().getSingletonService(OpenPolicyFinderSubmitService.class); + + @Override + @SuppressWarnings("unchecked") + public OpenPolicyFinderPolicy getData(SubmissionService submissionService, InProgressSubmission obj, + SubmissionStepConfig config) throws Exception { + Context context = ContextUtil.obtainCurrentRequestContext(); + OpenPolicyFinderResponse response = opfSubmitService.searchRelatedJournals(context, obj.getItem()); + if (Objects.nonNull(response)) { + OpenPolicyFinderPolicy result = new OpenPolicyFinderPolicy(); + result.setOpfResponse(response); + return result; + } + return null; + } + + @Override + public void doPatchProcessing(Context context, HttpServletRequest currentRequest, InProgressSubmission source, + Operation op, SubmissionStepConfig stepConf) throws Exception { + String path = op.getPath(); + if (path.contains(RETRIEVAL_TIME)) { + opfCacheEvictService.evictCacheValues(context, source.getItem()); + } + } + +} \ No newline at end of file diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/submit/step/SherpaPolicyStep.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/submit/step/SherpaPolicyStep.java deleted file mode 100644 index 206b3fab5974..000000000000 --- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/submit/step/SherpaPolicyStep.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * The contents of this file are subject to the license and copyright - * detailed in the LICENSE and NOTICE files at the root of the source - * tree and available online at - * - * http://www.dspace.org/license/ - */ -package org.dspace.app.rest.submit.step; - -import java.util.Objects; - -import jakarta.servlet.http.HttpServletRequest; -import org.dspace.app.rest.model.patch.Operation; -import org.dspace.app.rest.model.step.SherpaPolicy; -import org.dspace.app.rest.submit.AbstractProcessingStep; -import org.dspace.app.rest.submit.SubmissionService; -import org.dspace.app.sherpa.cache.SherpaCacheEvictService; -import org.dspace.app.sherpa.submit.SHERPASubmitService; -import org.dspace.app.sherpa.v2.SHERPAResponse; -import org.dspace.app.util.SubmissionStepConfig; -import org.dspace.content.InProgressSubmission; -import org.dspace.core.Context; -import org.dspace.utils.DSpace; -import org.dspace.web.ContextUtil; - -/** - * SherpaPolicy step for DSpace Spring Rest. Expose information about - * the Sherpa policies for the in progress submission. - * - * @author Mykhaylo Boychuk (mykhaylo.boychuk at 4science.com) - */ -public class SherpaPolicyStep extends AbstractProcessingStep { - - public static final String SHERPA_RETRIEVAL_TIME = "retrievalTime"; - - private SherpaCacheEvictService sherpaCacheEvictService = new DSpace().getSingletonService( - SherpaCacheEvictService.class); - private SHERPASubmitService sherpaSubmitService = new DSpace().getSingletonService(SHERPASubmitService.class); - - @Override - @SuppressWarnings("unchecked") - public SherpaPolicy getData(SubmissionService submissionService, InProgressSubmission obj, - SubmissionStepConfig config) throws Exception { - Context context = ContextUtil.obtainCurrentRequestContext(); - SHERPAResponse response = sherpaSubmitService.searchRelatedJournals(context, obj.getItem()); - if (Objects.nonNull(response)) { - SherpaPolicy result = new SherpaPolicy(); - result.setSherpaResponse(response); - return result; - } - return null; - } - - @Override - public void doPatchProcessing(Context context, HttpServletRequest currentRequest, InProgressSubmission source, - Operation op, SubmissionStepConfig stepConf) throws Exception { - String path = op.getPath(); - if (path.contains(SHERPA_RETRIEVAL_TIME)) { - sherpaCacheEvictService.evictCacheValues(context, source.getItem()); - } - } - -} \ No newline at end of file diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/itemimport/ItemImportIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/itemimport/ItemImportIT.java index 68511a9d8921..708a41c82ac9 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/itemimport/ItemImportIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/itemimport/ItemImportIT.java @@ -59,6 +59,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.mock.web.MockMultipartFile; +import org.springframework.test.web.servlet.ResultMatcher; /** * Basic integration testing for the SAF Import feature via UI {@link ItemImport}. @@ -81,6 +82,9 @@ public class ItemImportIT extends AbstractEntityIntegrationTest { private ProcessService processService; @Autowired private DSpaceRunnableParameterConverter dSpaceRunnableParameterConverter; + @Autowired + private ObjectMapper mapper; + private Collection collection; private Path workDir; private static final String TEMP_DIR = ItemImport.TEMP_DIR; @@ -134,6 +138,39 @@ public void importItemByZipSafWithBitstreams() throws Exception { assertTrue(workTempDir.exists()); } + @Test + public void importItemUsingInvalidZipName() throws Exception { + String zipfileName = "saf-bitstreams.zip"; + // This zip name is invalid as it must only contain a file name. + // This is an example path traversal attack. + String badZipFileName = "../../../" + zipfileName; + + // First attack attempt. Provide a path traversal via both "-z" param and "filename" of multipart request. + LinkedList parameters = new LinkedList<>(); + parameters.add(new DSpaceCommandLineParameter("-a", "")); + parameters.add(new DSpaceCommandLineParameter("-c", collection.getID().toString())); + parameters.add(new DSpaceCommandLineParameter("-z", badZipFileName)); + MockMultipartFile bitstreamFile = new MockMultipartFile("file", badZipFileName, + MediaType.APPLICATION_OCTET_STREAM_VALUE, + getClass().getResourceAsStream("saf-bitstreams.zip")); + + // Verify this import will fail and throw a 422 error + performImportScriptExpectError(parameters, bitstreamFile, status().isUnprocessableEntity()); + + // Second attack attempt. Provide a path traversal via "-z" param but a VALID file in "filename" + // of multipart request. + parameters = new LinkedList<>(); + parameters.add(new DSpaceCommandLineParameter("-a", "")); + parameters.add(new DSpaceCommandLineParameter("-c", collection.getID().toString())); + parameters.add(new DSpaceCommandLineParameter("-z", badZipFileName)); + bitstreamFile = new MockMultipartFile("file", zipfileName, + MediaType.APPLICATION_OCTET_STREAM_VALUE, + getClass().getResourceAsStream("saf-bitstreams.zip")); + + // Verify this import will also fail and throw a 422 error + performImportScriptExpectError(parameters, bitstreamFile, status().isUnprocessableEntity()); + } + @Test public void importItemByZipSafWithRelationships() throws Exception { context.turnOffAuthorisationSystem(); @@ -263,4 +300,23 @@ private void checkProcess(Process process) { .filter(b -> StringUtils.contains(b.getName(), ".zip")) .count()); } + + private void performImportScriptExpectError(LinkedList parameters, + MockMultipartFile bitstreamFile, + ResultMatcher expectedErrorMatcher) + throws Exception { + List list = parameters.stream() + .map(dSpaceCommandLineParameter -> dSpaceRunnableParameterConverter + .convert(dSpaceCommandLineParameter, Projection.DEFAULT)) + .collect(Collectors.toList()); + + AtomicReference idRef = new AtomicReference<>(); + + // Verify process fails + getClient(getAuthToken(admin.getEmail(), password)) + .perform(multipart("/api/system/scripts/import/processes") + .file(bitstreamFile) + .param("properties", mapper.writeValueAsString(list))) + .andExpect(expectedErrorMatcher); + } } diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/EPersonRestRepositoryIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/EPersonRestRepositoryIT.java index beeef03aec47..5e84fefd31a4 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/EPersonRestRepositoryIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/EPersonRestRepositoryIT.java @@ -197,7 +197,7 @@ public void createAnonAccessDeniedTest() throws Exception { .andExpect(status().isUnauthorized()); getClient().perform(get("/api/eperson/epersons/search/byEmail") .param("email", data.getEmail())) - .andExpect(status().isNoContent()); + .andExpect(status().isUnauthorized()); } @Test diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/ExternalSourcesRestControllerIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/ExternalSourcesRestControllerIT.java index 55cc99567f59..f75d020a2e93 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/ExternalSourcesRestControllerIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/ExternalSourcesRestControllerIT.java @@ -26,6 +26,7 @@ import org.dspace.external.provider.ExternalDataProvider; import org.dspace.external.service.ExternalDataService; import org.hamcrest.Matchers; +import org.junit.Before; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -34,9 +35,19 @@ public class ExternalSourcesRestControllerIT extends AbstractControllerIntegrati @Autowired private ExternalDataService externalDataService; + String token; + + @Before + @Override + public void setUp() throws Exception { + super.setUp(); + // All tests just require basic authentication privileges + token = getAuthToken(eperson.getEmail(), password); + } + @Test public void findAllExternalSources() throws Exception { - getClient().perform(get("/api/integration/externalsources")) + getClient(token).perform(get("/api/integration/externalsources")) .andExpect(status().isOk()) .andExpect(jsonPath("$._embedded.externalsources", Matchers.hasItems( ExternalSourceMatcher.matchExternalSource("mock", "mock", false), @@ -44,11 +55,11 @@ public void findAllExternalSources() throws Exception { ExternalSourceMatcher.matchExternalSource("suggestion", "suggestion", false), ExternalSourceMatcher.matchExternalSource("scopus", "scopus", false), ExternalSourceMatcher.matchExternalSource( - "sherpaJournalIssn", "sherpaJournalIssn", false), + "opfJournalIssn", "opfJournalIssn", false), ExternalSourceMatcher.matchExternalSource( - "sherpaJournal", "sherpaJournal", false), + "opfJournal", "opfJournal", false), ExternalSourceMatcher.matchExternalSource( - "sherpaPublisher", "sherpaPublisher", false), + "opfPublisher", "opfPublisher", false), ExternalSourceMatcher.matchExternalSource( "pubmed", "pubmed", false), ExternalSourceMatcher.matchExternalSource( @@ -57,51 +68,70 @@ public void findAllExternalSources() throws Exception { .andExpect(jsonPath("$.page.totalElements", Matchers.is(11))); } + @Test + public void findAllExternalSourcesAnonymous() throws Exception { + getClient().perform(get("/api/integration/externalsources").param("size", "21")) + .andExpect(status().isUnauthorized()); + } + @Test public void findOneExternalSourcesExistingSources() throws Exception { - getClient().perform(get("/api/integration/externalsources/mock")) + getClient(token).perform(get("/api/integration/externalsources/mock")) .andExpect(status().isOk()) .andExpect(jsonPath("$", Matchers.is( ExternalSourceMatcher.matchExternalSource("mock", "mock", false) ))); } + + @Test + public void findOneExternalSourcesExistingSourcesAnonymous() throws Exception { + getClient().perform(get("/api/integration/externalsources/mock")) + .andExpect(status().isUnauthorized()); + } + @Test public void findOneExternalSourcesNotExistingSources() throws Exception { - getClient().perform(get("/api/integration/externalsources/mock2")) + getClient(token).perform(get("/api/integration/externalsources/mock2")) .andExpect(status().isNotFound()); } @Test public void findOneExternalSourceEntryValue() throws Exception { - getClient().perform(get("/api/integration/externalsources/mock/entryValues/one")) + getClient(token).perform(get("/api/integration/externalsources/mock/entryValues/one")) .andExpect(status().isOk()) .andExpect(jsonPath("$", Matchers.is( ExternalSourceEntryMatcher.matchExternalSourceEntry("one", "one", "one", "mock") ))); } + @Test + public void findOneExternalSourceEntryValueAnonymous() throws Exception { + getClient().perform(get("/api/integration/externalsources/mock/entryValues/one")) + .andExpect(status().isUnauthorized()); + } + @Test public void findOneExternalSourceEntryValueInvalidEntryId() throws Exception { - getClient().perform(get("/api/integration/externalsources/mock/entryValues/entryIdInvalid")) + getClient(token).perform(get("/api/integration/externalsources/mock/entryValues/entryIdInvalid")) .andExpect(status().isNotFound()); } @Test public void findOneExternalSourceEntryValueInvalidSource() throws Exception { - getClient().perform(get("/api/integration/externalsources/mocktwo/entryValues/one")) + getClient(token).perform(get("/api/integration/externalsources/mocktwo/entryValues/one")) .andExpect(status().isNotFound()); } @Test public void findOneExternalSourceEntriesInvalidSource() throws Exception { - getClient().perform(get("/api/integration/externalsources/mocktwo/entries") + getClient(token).perform(get("/api/integration/externalsources/mocktwo/entries") .param("query", "test")) .andExpect(status().isNotFound()); } @Test public void findOneExternalSourceEntriesApplicableQuery() throws Exception { - getClient().perform(get("/api/integration/externalsources/mock/entries") + getClient(token).perform(get("/api/integration/externalsources/mock/entries") .param("query", "one")) .andExpect(status().isOk()) .andExpect(jsonPath("$._embedded.externalSourceEntries", Matchers.containsInAnyOrder( @@ -112,8 +142,15 @@ public void findOneExternalSourceEntriesApplicableQuery() throws Exception { } @Test - public void findOneExternalSourceEntriesApplicableQueryPagination() throws Exception { + public void findOneExternalSourceEntriesApplicableQueryAnonymous() throws Exception { getClient().perform(get("/api/integration/externalsources/mock/entries") + .param("query", "one")) + .andExpect(status().isUnauthorized()); + } + + @Test + public void findOneExternalSourceEntriesApplicableQueryPagination() throws Exception { + getClient(token).perform(get("/api/integration/externalsources/mock/entries") .param("query", "one").param("size", "1")) .andExpect(status().isOk()) .andExpect(jsonPath("$._embedded.externalSourceEntries", Matchers.hasItem( @@ -121,7 +158,7 @@ public void findOneExternalSourceEntriesApplicableQueryPagination() throws Excep ))) .andExpect(jsonPath("$.page", PageMatcher.pageEntryWithTotalPagesAndElements(0, 1, 2, 2))); - getClient().perform(get("/api/integration/externalsources/mock/entries") + getClient(token).perform(get("/api/integration/externalsources/mock/entries") .param("query", "one").param("size", "1").param("page", "1")) .andExpect(status().isOk()) .andExpect(jsonPath("$._embedded.externalSourceEntries", Matchers.hasItem( @@ -132,7 +169,7 @@ public void findOneExternalSourceEntriesApplicableQueryPagination() throws Excep @Test public void findOneExternalSourceEntriesNoReturnQuery() throws Exception { - getClient().perform(get("/api/integration/externalsources/mock/entries") + getClient(token).perform(get("/api/integration/externalsources/mock/entries") .param("query", "randomqueryfornoresults")) .andExpect(status().isOk()) .andExpect(jsonPath("$._embedded").doesNotExist()); @@ -140,7 +177,7 @@ public void findOneExternalSourceEntriesNoReturnQuery() throws Exception { @Test public void findOneExternalSourceEntriesNoQuery() throws Exception { - getClient().perform(get("/api/integration/externalsources/mock/entries")) + getClient(token).perform(get("/api/integration/externalsources/mock/entries")) .andExpect(status().isBadRequest()); } @@ -151,7 +188,7 @@ public void findExternalSourcesByEntityTypeTest() throws Exception { List journalProviders = externalDataService.getExternalDataProvidersForEntityType("Journal"); - getClient().perform(get("/api/integration/externalsources/search/findByEntityType") + getClient(token).perform(get("/api/integration/externalsources/search/findByEntityType") .param("entityType", "Publication")) .andExpect(status().isOk()) // Expect that Publication sources match (check a max of 20 as that is default page size) @@ -160,7 +197,7 @@ public void findExternalSourcesByEntityTypeTest() throws Exception { )) .andExpect(jsonPath("$.page.totalElements", Matchers.is(publicationProviders.size()))); - getClient().perform(get("/api/integration/externalsources/search/findByEntityType") + getClient(token).perform(get("/api/integration/externalsources/search/findByEntityType") .param("entityType", "Journal")) .andExpect(status().isOk()) // Check that Journal sources match (check a max of 20 as that is default page size) @@ -170,9 +207,16 @@ public void findExternalSourcesByEntityTypeTest() throws Exception { .andExpect(jsonPath("$.page.totalElements", Matchers.is(journalProviders.size()))); } + @Test + public void findExternalSourcesByEntityTypeAnonymousTest() throws Exception { + getClient().perform(get("/api/integration/externalsources/search/findByEntityType") + .param("entityType", "Publication")) + .andExpect(status().isUnauthorized()); + } + @Test public void findExternalSourcesByEntityTypeBadRequestTest() throws Exception { - getClient().perform(get("/api/integration/externalsources/search/findByEntityType")) + getClient(token).perform(get("/api/integration/externalsources/search/findByEntityType")) .andExpect(status().isBadRequest()); } @@ -186,7 +230,7 @@ public void findExternalSourcesByEntityTypePaginationTest() throws Exception { int pageSize = 2; int numberOfPages = (int) Math.ceil((double) numJournalProviders / pageSize); - getClient().perform(get("/api/integration/externalsources/search/findByEntityType") + getClient(token).perform(get("/api/integration/externalsources/search/findByEntityType") .param("entityType", "Journal") .param("size", String.valueOf(pageSize))) .andExpect(status().isOk()) @@ -196,7 +240,7 @@ public void findExternalSourcesByEntityTypePaginationTest() throws Exception { .andExpect(jsonPath("$.page.totalPages", Matchers.is(numberOfPages))) .andExpect(jsonPath("$.page.totalElements", Matchers.is(numJournalProviders))); - getClient().perform(get("/api/integration/externalsources/search/findByEntityType") + getClient(token).perform(get("/api/integration/externalsources/search/findByEntityType") .param("entityType", "Journal") .param("page", "1") .param("size", String.valueOf(pageSize))) diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/ItemTemplateRestControllerIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/ItemTemplateRestControllerIT.java index f3ba6d3aed1f..67c1f74ce6c1 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/ItemTemplateRestControllerIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/ItemTemplateRestControllerIT.java @@ -30,23 +30,19 @@ import org.dspace.app.rest.model.patch.Operation; import org.dspace.app.rest.model.patch.ReplaceOperation; import org.dspace.app.rest.test.AbstractControllerIntegrationTest; -import org.dspace.authorize.service.ResourcePolicyService; import org.dspace.builder.CollectionBuilder; import org.dspace.builder.CommunityBuilder; +import org.dspace.builder.GroupBuilder; import org.dspace.builder.ResourcePolicyBuilder; import org.dspace.content.Collection; import org.dspace.core.Constants; import org.hamcrest.Matchers; import org.junit.Before; import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.web.servlet.MvcResult; public class ItemTemplateRestControllerIT extends AbstractControllerIntegrationTest { - @Autowired - ResourcePolicyService resourcePolicyService; - private ObjectMapper mapper; private String adminAuthToken; private Collection childCollection; @@ -168,16 +164,56 @@ public void getTemplateItemFromCollection() throws Exception { } @Test - public void getTemplateItemFromCollectionForbiddenTest() throws Exception { + public void getTemplateItemFromCollectionNotLoggedIn() throws Exception { setupTestTemplate(); - String itemUuidString = installTestTemplate(); + installTestTemplate(); + + getClient().perform(get(getCollectionTemplateItemUrlTemplate(childCollection.getID().toString()))) + .andExpect(status().isUnauthorized()); + } + + @Test + public void getTemplateItemFromCollectionNoRights() throws Exception { + setupTestTemplate(); + installTestTemplate(); - resourcePolicyService.removePolicies(context, childCollection, Constants.READ); String tokenEperson = getAuthToken(eperson.getEmail(), password); getClient(tokenEperson).perform(get(getCollectionTemplateItemUrlTemplate(childCollection.getID().toString()))) .andExpect(status().isForbidden()); } + @Test + public void getTemplateItemFromCollectionAsSubmitter() throws Exception { + setupTestTemplate(); + installTestTemplate(); + + GroupBuilder.createCollectionSubmitterGroup(context, childCollection) + .addMember(eperson) + .build(); + String submitterToken = getAuthToken(eperson.getEmail(), password); + + getClient(submitterToken) + .perform(get(getCollectionTemplateItemUrlTemplate(childCollection.getID().toString()))) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.type", is("itemtemplate"))); + } + + @Test + public void getTemplateItemFromCollectionAsCollectionAdmin() throws Exception { + setupTestTemplate(); + installTestTemplate(); + + GroupBuilder.createCollectionAdminGroup(context, childCollection) + .addMember(eperson) + .build(); + String collectionAdminToken = getAuthToken(eperson.getEmail(), password); + + getClient(collectionAdminToken) + .perform(get(getCollectionTemplateItemUrlTemplate(childCollection.getID().toString()))) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.type", is("itemtemplate"))); + } + @Test public void getTemplateItemFromItemId() throws Exception { setupTestTemplate(); diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/OpenaireFundingExternalSourcesIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/OpenaireFundingExternalSourcesIT.java index 8c76c7adea0e..afb74ae26ae7 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/OpenaireFundingExternalSourcesIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/OpenaireFundingExternalSourcesIT.java @@ -17,10 +17,21 @@ import org.dspace.app.rest.matcher.ExternalSourceMatcher; import org.dspace.app.rest.test.AbstractControllerIntegrationTest; import org.hamcrest.Matchers; +import org.junit.Before; import org.junit.Test; public class OpenaireFundingExternalSourcesIT extends AbstractControllerIntegrationTest { + String token; + + @Before + @Override + public void setUp() throws Exception { + super.setUp(); + // All tests just require basic authentication privileges + token = getAuthToken(eperson.getEmail(), password); + } + /** * Test openaire funding external source * @@ -28,7 +39,7 @@ public class OpenaireFundingExternalSourcesIT extends AbstractControllerIntegrat */ @Test public void findOneOpenaireFundingExternalSourceTest() throws Exception { - getClient().perform(get("/api/integration/externalsources")).andExpect(status().isOk()) + getClient(token).perform(get("/api/integration/externalsources")).andExpect(status().isOk()) .andExpect(jsonPath("$._embedded.externalsources", Matchers.hasItem( ExternalSourceMatcher.matchExternalSource("openaireFunding", "openaireFunding", false)))); } @@ -40,11 +51,18 @@ public void findOneOpenaireFundingExternalSourceTest() throws Exception { */ @Test public void findOneOpenaireFundingExternalSourceEntriesEmptyWithQueryTest() throws Exception { - - getClient().perform(get("/api/integration/externalsources/openaireFunding/entries").param("query", "empty")) + getClient(token).perform(get("/api/integration/externalsources/openaireFunding/entries") + .param("query", "empty")) .andExpect(status().isOk()).andExpect(jsonPath("$.page.number", is(0))); } + @Test + public void findOneOpenaireFundingExternalSourceEntriesEmptyWithQueryAnonymousTest() throws Exception { + getClient().perform(get("/api/integration/externalsources/openaireFunding/entries") + .param("query", "empty")) + .andExpect(status().isUnauthorized()); + } + /** * Test openaire funding entries with multiple keywords for a query returning no * results @@ -54,7 +72,7 @@ public void findOneOpenaireFundingExternalSourceEntriesEmptyWithQueryTest() thro @Test public void findOneOpenaireFundingExternalSourceEntriesWithQueryMultipleKeywordsTest() throws Exception { - getClient() + getClient(token) .perform( get("/api/integration/externalsources/openaireFunding/entries").param("query", "empty+results")) .andExpect(status().isOk()).andExpect(jsonPath("$.page.number", is(0))); @@ -67,7 +85,8 @@ public void findOneOpenaireFundingExternalSourceEntriesWithQueryMultipleKeywords */ @Test public void findOneOpenaireFundingExternalSourceEntriesWithQueryTest() throws Exception { - getClient().perform(get("/api/integration/externalsources/openaireFunding/entries").param("query", "mushroom")) + getClient(token).perform(get("/api/integration/externalsources/openaireFunding/entries") + .param("query", "mushroom")) .andExpect(status().isOk()) .andExpect(jsonPath("$._embedded.externalSourceEntries", Matchers.hasItem(ExternalSourceEntryMatcher.matchExternalSourceEntry( @@ -90,7 +109,7 @@ public void findOneOpenaireFundingExternalSourceEntryValueTest() throws Exceptio String projectName = "Portuguese Wild Mushrooms: Chemical characterization and functional study" + " of antiproliferative and proapoptotic properties in cancer cell lines"; - getClient().perform(get("/api/integration/externalsources/openaireFunding/entryValues/" + projectID)) + getClient(token).perform(get("/api/integration/externalsources/openaireFunding/entryValues/" + projectID)) .andExpect(status().isOk()) .andExpect(jsonPath("$", Matchers.allOf(hasJsonPath("$.id", is(projectID)), hasJsonPath("$.display", is(projectName)), diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/OrcidExternalSourcesIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/OrcidExternalSourcesIT.java index 04592c17da2d..e8e96076e5ab 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/OrcidExternalSourcesIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/OrcidExternalSourcesIT.java @@ -23,6 +23,7 @@ import org.dspace.services.ConfigurationService; import org.hamcrest.Matchers; import org.junit.Assume; +import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentMatchers; import org.mockito.Mockito; @@ -55,9 +56,19 @@ public void onlyRunIfConfigExists() { } } + String token; + + @Before + @Override + public void setUp() throws Exception { + super.setUp(); + // All tests just require basic authentication privileges + token = getAuthToken(eperson.getEmail(), password); + } + @Test public void findOneExternalSourcesExistingSources() throws Exception { - getClient().perform(get("/api/integration/externalsources/orcid")) + getClient(token).perform(get("/api/integration/externalsources/orcid")) .andExpect(status().isOk()) .andExpect(jsonPath("$", Matchers.allOf( hasJsonPath("$.id", is("orcid")), @@ -67,12 +78,18 @@ public void findOneExternalSourcesExistingSources() throws Exception { ))); } + @Test + public void findOneExternalSourcesExistingSourcesAnonymous() throws Exception { + getClient().perform(get("/api/integration/externalsources/orcid")) + .andExpect(status().isUnauthorized()); + } + @Test public void findOneExternalSourcesExistingSourcesWithentryValueTest() throws Exception { // this test will query the real ORCID API if configured in the CI otherwise will be skipped onlyRunIfConfigExists(); String entry = "0000-0002-9029-1854"; - getClient().perform(get("/api/integration/externalsources/orcid/entryValues/" + entry)) + getClient(token).perform(get("/api/integration/externalsources/orcid/entryValues/" + entry)) .andExpect(status().isOk()) .andExpect(jsonPath("$", Matchers.allOf( hasJsonPath("$.id", is(entry)), @@ -92,7 +109,7 @@ public void findOneExternalSourceEntriesApplicableQueryTest() throws Exception { // this test will query the real ORCID API if configured in the CI otherwise will be skipped onlyRunIfConfigExists(); String q = "orcid:0000-0002-9029-1854"; - getClient().perform(get("/api/integration/externalsources/orcid/entries") + getClient(token).perform(get("/api/integration/externalsources/orcid/entries") .param("query", q)) .andExpect(status().isOk()) .andExpect(jsonPath("$._embedded.externalSourceEntries[0]", Matchers.allOf( @@ -117,7 +134,7 @@ public void findOneExternalSourceEntriesApplicableQueryFamilyNameAndGivenNamesTe // this test will query the real ORCID API if configured in the CI otherwise will be skipped onlyRunIfConfigExists(); String q = "family-name:bollini AND given-names:andrea"; - getClient().perform(get("/api/integration/externalsources/orcid/entries") + getClient(token).perform(get("/api/integration/externalsources/orcid/entries") .param("query", q)) .andExpect(status().isOk()) .andExpect(jsonPath("$._embedded.externalSourceEntries", Matchers.hasItem( @@ -158,7 +175,7 @@ public InputStream answer(InvocationOnMock invocation) { }); String entry = "0000-0002-9029-1854"; - getClient().perform(get("/api/integration/externalsources/orcid/entryValues/" + entry)) + getClient(token).perform(get("/api/integration/externalsources/orcid/entryValues/" + entry)) .andExpect(status().isOk()) .andExpect(jsonPath("$", Matchers.allOf( hasJsonPath("$.id", is(entry)), @@ -200,7 +217,7 @@ public InputStream answer(InvocationOnMock invocation) { } }); String q = "orcid:0000-0002-9029-1854"; - getClient().perform(get("/api/integration/externalsources/orcid/entries") + getClient(token).perform(get("/api/integration/externalsources/orcid/entries") .param("query", q)) .andExpect(status().isOk()) .andExpect(jsonPath("$._embedded.externalSourceEntries[0]", Matchers.allOf( @@ -253,7 +270,7 @@ public InputStream answer(InvocationOnMock invocation) { } }); String q = "family-name:bollini AND given-names:andrea"; - getClient().perform(get("/api/integration/externalsources/orcid/entries") + getClient(token).perform(get("/api/integration/externalsources/orcid/entries") .param("query", q)) .andExpect(status().isOk()) .andExpect(jsonPath("$._embedded.externalSourceEntries", Matchers.hasItem( diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/ProcessRestRepositoryIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/ProcessRestRepositoryIT.java index d657917f13e3..6d0887c86f43 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/ProcessRestRepositoryIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/ProcessRestRepositoryIT.java @@ -12,6 +12,7 @@ import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.is; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @@ -55,6 +56,7 @@ public class ProcessRestRepositoryIT extends AbstractControllerIntegrationTest { @Before public void setup() throws SQLException { + context.setCurrentUser(admin); CollectionUtils.emptyIfNull(processService.findAll(context)).stream().forEach(process -> { try { processService.delete(context, process); @@ -66,6 +68,7 @@ public void setup() throws SQLException { parameters.add(new DSpaceCommandLineParameter("-i", null)); process = ProcessBuilder.createProcess(context, admin, "mock-script", parameters).build(); + context.setCurrentUser(eperson); } @Test @@ -84,7 +87,9 @@ public void getProcessAdmin() throws Exception { public void getProcessAdminEmptyParam() throws Exception { String token = getAuthToken(admin.getEmail(), password); + context.setCurrentUser(admin); Process process = ProcessBuilder.createProcess(context, admin, "mock-script", new LinkedList<>()).build(); + context.setCurrentUser(eperson); getClient(token).perform(get("/api/system/processes/" + process.getID())) .andExpect(status().isOk()) @@ -132,7 +137,7 @@ public void getProcessNotExisting() throws Exception { String token = getAuthToken(eperson.getEmail(), password); getClient(token).perform(get("/api/system/processes/" + process.getID() * 23 + 17)) - .andExpect(status().isNotFound()); + .andExpect(status().isForbidden()); } @Test @@ -154,9 +159,11 @@ public void getAllProcessesTestAdmin() throws Exception { Process newProcess4 = ProcessBuilder.createProcess(context, eperson, "mock-script", parameters).build(); Process newProcess5 = ProcessBuilder.createProcess(context, eperson, "mock-script", parameters).build(); Process newProcess6 = ProcessBuilder.createProcess(context, eperson, "mock-script", parameters).build(); + context.setCurrentUser(admin); Process newProcess7 = ProcessBuilder.createProcess(context, admin, "mock-script", parameters).build(); Process newProcess8 = ProcessBuilder.createProcess(context, admin, "mock-script", parameters).build(); Process newProcess9 = ProcessBuilder.createProcess(context, admin, "mock-script", parameters).build(); + context.setCurrentUser(eperson); String token = getAuthToken(admin.getEmail(), password); @@ -211,9 +218,11 @@ public void getAllProcessesTestStartingUser() throws Exception { Process newProcess4 = ProcessBuilder.createProcess(context, eperson, "mock-script", new LinkedList<>()).build(); Process newProcess5 = ProcessBuilder.createProcess(context, eperson, "mock-script", new LinkedList<>()).build(); Process newProcess6 = ProcessBuilder.createProcess(context, eperson, "mock-script", new LinkedList<>()).build(); + context.setCurrentUser(admin); Process newProcess7 = ProcessBuilder.createProcess(context, admin, "mock-script", new LinkedList<>()).build(); Process newProcess8 = ProcessBuilder.createProcess(context, admin, "mock-script", new LinkedList<>()).build(); Process newProcess9 = ProcessBuilder.createProcess(context, admin, "mock-script", new LinkedList<>()).build(); + context.setCurrentUser(eperson); String token = getAuthToken(eperson.getEmail(), password); @@ -310,9 +319,11 @@ public void getProcessFilesTypes() throws Exception { @Test public void getProcessFilesTypesForbidden() throws Exception { + context.setCurrentUser(admin); try (InputStream is = IOUtils.toInputStream("Test File For Process", CharEncoding.UTF_8)) { processService.appendFile(context, process, is, "inputfile", "test.csv"); } + context.setCurrentUser(eperson); List fileTypesToCheck = new LinkedList<>(); fileTypesToCheck.add("inputfile"); @@ -327,9 +338,11 @@ public void getProcessFilesTypesForbidden() throws Exception { @Test public void getProcessFilesTypesUnAuthorized() throws Exception { + context.setCurrentUser(admin); try (InputStream is = IOUtils.toInputStream("Test File For Process", CharEncoding.UTF_8)) { processService.appendFile(context, process, is, "inputfile", "test.csv"); } + context.setCurrentUser(eperson); List fileTypesToCheck = new LinkedList<>(); fileTypesToCheck.add("inputfile"); @@ -341,9 +354,11 @@ public void getProcessFilesTypesUnAuthorized() throws Exception { @Test public void getProcessFilesTypesRandomProcessId() throws Exception { + context.setCurrentUser(admin); try (InputStream is = IOUtils.toInputStream("Test File For Process", CharEncoding.UTF_8)) { processService.appendFile(context, process, is, "inputfile", "test.csv"); } + context.setCurrentUser(eperson); List fileTypesToCheck = new LinkedList<>(); fileTypesToCheck.add("inputfile"); @@ -380,9 +395,11 @@ public void searchProcessTestByUser() throws Exception { Process newProcess4 = ProcessBuilder.createProcess(context, eperson, "mock-script", parameters).build(); Process newProcess5 = ProcessBuilder.createProcess(context, eperson, "mock-script", parameters).build(); Process newProcess6 = ProcessBuilder.createProcess(context, eperson, "mock-script", parameters).build(); + context.setCurrentUser(admin); Process newProcess7 = ProcessBuilder.createProcess(context, admin, "mock-script", parameters).build(); Process newProcess8 = ProcessBuilder.createProcess(context, admin, "mock-script", parameters).build(); Process newProcess9 = ProcessBuilder.createProcess(context, admin, "mock-script", parameters).build(); + context.setCurrentUser(eperson); String token = getAuthToken(admin.getEmail(), password); @@ -446,11 +463,13 @@ public void searchProcessTestByProcessStatus() throws Exception { Process newProcess4 = ProcessBuilder.createProcess(context, eperson, "mock-script", parameters).build(); Process newProcess5 = ProcessBuilder.createProcess(context, eperson, "mock-script", parameters).build(); Process newProcess6 = ProcessBuilder.createProcess(context, eperson, "mock-script", parameters).build(); + context.setCurrentUser(admin); Process newProcess7 = ProcessBuilder.createProcess(context, admin, "mock-script", parameters) .withProcessStatus(ProcessStatus.FAILED).build(); Process newProcess8 = ProcessBuilder.createProcess(context, admin, "mock-script", parameters).build(); Process newProcess9 = ProcessBuilder.createProcess(context, admin, "mock-script", parameters) .withProcessStatus(ProcessStatus.FAILED).build(); + context.setCurrentUser(eperson); String token = getAuthToken(admin.getEmail(), password); @@ -478,11 +497,13 @@ public void searchProcessTestByScriptName() throws Exception { Process newProcess4 = ProcessBuilder.createProcess(context, eperson, "mock-script", parameters).build(); Process newProcess5 = ProcessBuilder.createProcess(context, eperson, "mock-script", parameters).build(); Process newProcess6 = ProcessBuilder.createProcess(context, eperson, "mock-script", parameters).build(); + context.setCurrentUser(admin); Process newProcess7 = ProcessBuilder.createProcess(context, admin, "mock-script", parameters) .withProcessStatus(ProcessStatus.FAILED).build(); Process newProcess8 = ProcessBuilder.createProcess(context, admin, "another-mock-script", parameters).build(); Process newProcess9 = ProcessBuilder.createProcess(context, admin, "mock-script", parameters) .withProcessStatus(ProcessStatus.FAILED).build(); + context.setCurrentUser(eperson); String token = getAuthToken(admin.getEmail(), password); @@ -507,11 +528,13 @@ public void searchProcessTestByScriptNameAndUserId() throws Exception { Process newProcess4 = ProcessBuilder.createProcess(context, eperson, "another-mock-script", parameters).build(); Process newProcess5 = ProcessBuilder.createProcess(context, eperson, "another-mock-script", parameters).build(); Process newProcess6 = ProcessBuilder.createProcess(context, eperson, "another-mock-script", parameters).build(); + context.setCurrentUser(admin); Process newProcess7 = ProcessBuilder.createProcess(context, admin, "another-mock-script", parameters) .withProcessStatus(ProcessStatus.FAILED).build(); Process newProcess8 = ProcessBuilder.createProcess(context, admin, "another-mock-script", parameters).build(); Process newProcess9 = ProcessBuilder.createProcess(context, admin, "mock-script", parameters) .withProcessStatus(ProcessStatus.FAILED).build(); + context.setCurrentUser(eperson); String token = getAuthToken(admin.getEmail(), password); @@ -541,11 +564,13 @@ public void searchProcessTestByUserIdAndProcessStatus() throws Exception { Process newProcess4 = ProcessBuilder.createProcess(context, eperson, "another-mock-script", parameters).build(); Process newProcess5 = ProcessBuilder.createProcess(context, eperson, "another-mock-script", parameters).build(); Process newProcess6 = ProcessBuilder.createProcess(context, eperson, "another-mock-script", parameters).build(); + context.setCurrentUser(admin); Process newProcess7 = ProcessBuilder.createProcess(context, admin, "another-mock-script", parameters).build(); Process newProcess8 = ProcessBuilder.createProcess(context, admin, "another-mock-script", parameters) .withProcessStatus(ProcessStatus.FAILED).build(); Process newProcess9 = ProcessBuilder.createProcess(context, admin, "mock-script", parameters) .withProcessStatus(ProcessStatus.FAILED).build(); + context.setCurrentUser(eperson); String token = getAuthToken(admin.getEmail(), password); @@ -576,10 +601,12 @@ public void searchProcessTestByUserIdAndProcessStatusAndScriptName() throws Exce Process newProcess4 = ProcessBuilder.createProcess(context, eperson, "mock-script", parameters).build(); Process newProcess5 = ProcessBuilder.createProcess(context, eperson, "another-mock-script", parameters).build(); Process newProcess6 = ProcessBuilder.createProcess(context, eperson, "another-mock-script", parameters).build(); + context.setCurrentUser(admin); Process newProcess7 = ProcessBuilder.createProcess(context, admin, "another-mock-script", parameters).build(); Process newProcess8 = ProcessBuilder.createProcess(context, admin, "another-mock-script", parameters) .withProcessStatus(ProcessStatus.FAILED).build(); Process newProcess9 = ProcessBuilder.createProcess(context, admin, "mock-script", parameters).build(); + context.setCurrentUser(eperson); String token = getAuthToken(admin.getEmail(), password); @@ -892,9 +919,11 @@ public void testFindByCurrentUser() throws Exception { Process process1 = ProcessBuilder.createProcess(context, eperson, "mock-script", parameters) .withStartAndEndTime("10/01/1990", "20/01/1990") .build(); + context.setCurrentUser(admin); ProcessBuilder.createProcess(context, admin, "mock-script", parameters) .withStartAndEndTime("11/01/1990", "19/01/1990") .build(); + context.setCurrentUser(eperson); Process process3 = ProcessBuilder.createProcess(context, eperson, "mock-script", parameters) .withStartAndEndTime("12/01/1990", "18/01/1990") .build(); @@ -950,4 +979,54 @@ public void getProcessOutput() throws Exception { is("script_output"))); } + + @Test + public void deleteProcessByAdmin() throws Exception { + // Admin should be able to delete any process + Process processToDelete = ProcessBuilder.createProcess(context, eperson, "mock-script", parameters).build(); + int processId = processToDelete.getID(); + String adminToken = getAuthToken(admin.getEmail(), password); + getClient(adminToken).perform(get("/api/system/processes/" + processId)) + .andExpect(status().isOk()); + getClient(adminToken).perform(delete("/api/system/processes/" + processId)) + .andExpect(status().isNoContent()); + getClient(adminToken).perform(get("/api/system/processes/" + processId)) + .andExpect(status().isNotFound()); + } + + @Test + public void deleteProcessByOwner() throws Exception { + // The user who started the process should be able to delete it + Process processToDelete = ProcessBuilder.createProcess(context, eperson, "mock-script", parameters).build(); + int processId = processToDelete.getID(); + String ownerToken = getAuthToken(eperson.getEmail(), password); + getClient(ownerToken).perform(get("/api/system/processes/" + processId)) + .andExpect(status().isOk()); + getClient(ownerToken).perform(delete("/api/system/processes/" + processId)) + .andExpect(status().isNoContent()); + String adminToken = getAuthToken(admin.getEmail(), password); + getClient(adminToken).perform(get("/api/system/processes/" + processId)) + .andExpect(status().isNotFound()); + } + + @Test + public void deleteProcessByOtherUserForbidden() throws Exception { + // A user who did not start the process (and is not admin) should get 403 + String epersonToken = getAuthToken(eperson.getEmail(), password); + getClient(epersonToken).perform(delete("/api/system/processes/" + process.getID())) + .andExpect(status().isForbidden()); + String adminToken = getAuthToken(admin.getEmail(), password); + getClient(adminToken).perform(get("/api/system/processes/" + process.getID())) + .andExpect(status().isOk()); + } + + @Test + public void deleteProcessByAnonymousUnauthorized() throws Exception { + // Anonymous users should get 401 + getClient().perform(delete("/api/system/processes/" + process.getID())) + .andExpect(status().isUnauthorized()); + String adminToken = getAuthToken(admin.getEmail(), password); + getClient(adminToken).perform(get("/api/system/processes/" + process.getID())) + .andExpect(status().isOk()); + } } diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/RegistrationRestRepositoryIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/RegistrationRestRepositoryIT.java index 1831fc6a8a85..3621ac846b7c 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/RegistrationRestRepositoryIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/RegistrationRestRepositoryIT.java @@ -33,6 +33,7 @@ import org.dspace.app.rest.repository.RegistrationRestRepository; import org.dspace.app.rest.test.AbstractControllerIntegrationTest; import org.dspace.builder.EPersonBuilder; +import org.dspace.core.Email; import org.dspace.eperson.CaptchaServiceImpl; import org.dspace.eperson.InvalidReCaptchaException; import org.dspace.eperson.RegistrationData; @@ -40,7 +41,12 @@ import org.dspace.eperson.service.CaptchaService; import org.dspace.services.ConfigurationService; import org.hamcrest.Matchers; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.BeforeClass; import org.junit.Test; +import org.mockito.MockedStatic; +import org.mockito.Mockito; import org.springframework.beans.factory.annotation.Autowired; public class RegistrationRestRepositoryIT extends AbstractControllerIntegrationTest { @@ -53,6 +59,29 @@ public class RegistrationRestRepositoryIT extends AbstractControllerIntegrationT private ConfigurationService configurationService; @Autowired private RegistrationRestRepository registrationRestRepository; + @Autowired + private ObjectMapper mapper; + + private static MockedStatic emailMockedStatic; + + @After + public void tearDown() throws Exception { + Iterator iterator = registrationDataDAO.findAll(context, RegistrationData.class).iterator(); + while (iterator.hasNext()) { + RegistrationData registrationData = iterator.next(); + registrationDataDAO.delete(context, registrationData); + } + } + + @BeforeClass + public static void init() throws Exception { + emailMockedStatic = Mockito.mockStatic(Email.class); + } + + @AfterClass + public static void tearDownClass() throws Exception { + emailMockedStatic.close(); + } @Test public void findByTokenTestExistingUserTest() throws Exception { @@ -121,6 +150,33 @@ private void createTokenForEmail(String email) throws Exception { .andExpect(status().isCreated()); } + @Test + public void findByTokenWithoutToken() throws Exception { + getClient().perform(get("/api/eperson/registrations/search/findByToken")) + .andExpect(status().isBadRequest()); + } + + @Test + public void findByTokenWithEmptyToken() throws Exception { + getClient().perform(get("/api/eperson/registrations/search/findByToken") + .param("token", "")) + .andExpect(status().isBadRequest()); + } + + @Test + public void findByTokenWithBlankToken() throws Exception { + getClient().perform(get("/api/eperson/registrations/search/findByToken") + .param("token", " ")) + .andExpect(status().isBadRequest()); + } + + @Test + public void findByTokenWithTooLongToken() throws Exception { + getClient().perform(get("/api/eperson/registrations/search/findByToken") + .param("token", "t".repeat(49))) // token length cannot be longer than 48 characters + .andExpect(status().isBadRequest()); + } + @Test public void registrationFlowTest() throws Exception { List registrationDataList = registrationDataDAO.findAll(context, RegistrationData.class); @@ -472,4 +528,51 @@ public void accountEndpoint_WrongAccountTypeParam() throws Exception { .andExpect(status().isBadRequest()); } + @Test + public void registrationWithInvalidEmailFormatTest() throws Exception { + Email spy = Mockito.spy(Email.class); + doNothing().when(spy).send(); + emailMockedStatic.when(() -> Email.getEmail(any())).thenReturn(spy); + + RegistrationRest registrationRest = new RegistrationRest(); + registrationRest.setEmail("invalid-email!!!!"); + + getClient().perform(post("/api/eperson/registrations") + .param(TYPE_QUERY_PARAM, TYPE_REGISTER) + .content(mapper.writeValueAsBytes(registrationRest)) + .contentType(contentType)) + .andExpect(status().isUnprocessableEntity()); + } + + @Test + public void registrationWithEmptyEmailTest() throws Exception { + Email spy = Mockito.spy(Email.class); + doNothing().when(spy).send(); + emailMockedStatic.when(() -> Email.getEmail(any())).thenReturn(spy); + + RegistrationRest registrationRest = new RegistrationRest(); + registrationRest.setEmail(""); + + getClient().perform(post("/api/eperson/registrations") + .param(TYPE_QUERY_PARAM, TYPE_REGISTER) + .content(mapper.writeValueAsBytes(registrationRest)) + .contentType(contentType)) + .andExpect(status().isUnprocessableEntity()); + } + + @Test + public void registrationWithNullEmailTest() throws Exception { + Email spy = Mockito.spy(Email.class); + doNothing().when(spy).send(); + emailMockedStatic.when(() -> Email.getEmail(any())).thenReturn(spy); + + RegistrationRest registrationRest = new RegistrationRest(); + registrationRest.setEmail(null); + + getClient().perform(post("/api/eperson/registrations") + .param(TYPE_QUERY_PARAM, TYPE_REGISTER) + .content(mapper.writeValueAsBytes(registrationRest)) + .contentType(contentType)) + .andExpect(status().isUnprocessableEntity()); + } } diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/ResearcherProfileRestRepositoryIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/ResearcherProfileRestRepositoryIT.java index a0c66cddb70e..687efcef9c6f 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/ResearcherProfileRestRepositoryIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/ResearcherProfileRestRepositoryIT.java @@ -1028,6 +1028,22 @@ public void testAutomaticProfileClaimByEmailWithRegularEntity() throws Exception String secondItemId = getItemIdByProfileId(newUserToken, id); assertEquals("The item should be the same", firstItemId, secondItemId); + getClient(getAuthToken(admin.getEmail(), password)) + .perform(get("/api/authz/resourcepolicies/search/resource") + .param("uuid", firstItemId)) + .andExpect(status().isOk()) + .andExpect(jsonPath("$._embedded.resourcepolicies", + hasItem(matchResourcePolicyProperties(null, user, itemToBeClaimed, null, + Constants.WRITE, null)))); + + getClient(newUserToken) + .perform(get("/api/authz/authorizations/search/object") + .param("uri", "http://localhost/api/core/items/" + firstItemId) + .param("feature", "canEditMetadata") + .param("embed", "feature")) + .andExpect(status().isOk()) + .andExpect(jsonPath("$._embedded.authorizations[0]._embedded.feature.id") + .value("canEditMetadata")); } @Test diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/VersionRestRepositoryIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/VersionRestRepositoryIT.java index daec24d29e70..0418643a58a8 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/VersionRestRepositoryIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/VersionRestRepositoryIT.java @@ -84,8 +84,12 @@ public class VersionRestRepositoryIT extends AbstractControllerIntegrationTest { private Item item; + private Item adminOnlyItem; + private Version version; + private Version adminOnlyVersion; + @Autowired private VersioningService versioningService; @@ -114,7 +118,7 @@ public void setup() throws SQLException, AuthorizeException { context.turnOffAuthorisationSystem(); //** GIVEN ** - //1. A community-collection structure with one parent community with sub-community and two collections. + //1. A community-collection structure with one parent community with sub-community and one collection. parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .build(); @@ -123,7 +127,7 @@ public void setup() throws SQLException, AuthorizeException { .build(); Collection col1 = CollectionBuilder.createCollection(context, child1).withName("Collection 1").build(); - //2. Three public items that are readable by Anonymous with different subjects + //2. One public item that is readable by Anonymous item = ItemBuilder.createItem(context, col1) .withTitle("Public item 1") .withIssueDate("2017-10-17") @@ -132,6 +136,21 @@ public void setup() throws SQLException, AuthorizeException { .build(); version = VersionBuilder.createVersion(context, item, "Fixing some typos").build(); + + //3. One Admin-Only Item, created by the Admin user + context.setCurrentUser(admin); + adminOnlyItem = ItemBuilder.createItem(context, col1) + .withTitle("Admin-Only item") + .withIssueDate("2017-10-17") + .withAuthor("Smith, Donald").withAuthor("Doe, John") + .withSubject("Private") + .withReaderGroup(context.getAdminGroup()) + .build(); + adminOnlyVersion = VersionBuilder.createVersion(context, item, "Fixing some typos").build(); + + // Revert current user to EPerson for all tests + context.setCurrentUser(eperson); + context.restoreAuthSystemState(); } @@ -274,6 +293,31 @@ public void versionItemTest() throws Exception { .andExpect(jsonPath("$", Matchers.is(ItemMatcher.matchItemProperties(version.getItem())))); } + @Test + public void versionRestrictedItemAdminTest() throws Exception { + String adminToken = getAuthToken(admin.getEmail(), password); + + // The Admin-only item is visible to Admin + getClient(adminToken).perform(get("/api/versioning/versions/" + adminOnlyVersion.getID() + "/item")) + .andExpect(status().isOk()); + } + + @Test + public void versionRestrictedItemForbiddenUserTest() throws Exception { + String epersonToken = getAuthToken(eperson.getEmail(), password); + + // The Admin-only item is not visible to another user + getClient(epersonToken).perform(get("/api/versioning/versions/" + adminOnlyVersion.getID() + "/item")) + .andExpect(status().isForbidden()); + } + + @Test + public void versionRestrictedItemAnonymousTest() throws Exception { + // Anonymous user cannot access info about an Admin-only item + getClient().perform(get("/api/versioning/versions/" + adminOnlyVersion.getID() + "/item")) + .andExpect(status().isUnauthorized()); + } + @Test public void versionItemTestWrongId() throws Exception { diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/VocabularyRestRepositoryIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/VocabularyRestRepositoryIT.java index 7a3bc738eb66..356ca9fe9900 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/VocabularyRestRepositoryIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/VocabularyRestRepositoryIT.java @@ -73,8 +73,8 @@ public void setup() throws Exception { configurationService.setProperty("plugin.named.org.dspace.content.authority.ChoiceAuthority", new String[] { "org.dspace.content.authority.SolrAuthority = SolrAuthorAuthority", - "org.dspace.content.authority.SHERPARoMEOPublisher = SRPublisher", - "org.dspace.content.authority.SHERPARoMEOJournalTitle = SRJournalTitle" + "org.dspace.content.authority.OpenPolicyFinderPublisherAuthority = SRPublisher", + "org.dspace.content.authority.OpenPolicyFinderJournalTitle = SRJournalTitle" }); configurationService.setProperty("solr.authority.server", @@ -364,7 +364,7 @@ public void noResultsSolrQueryTest() throws Exception { } @Test - public void sherpaJournalTest() throws Exception { + public void opfJournalTest() throws Exception { String token = getAuthToken(admin.getEmail(), password); getClient(token).perform( get("/api/submission/vocabularies/SRJournalTitle/entries") @@ -380,7 +380,7 @@ public void sherpaJournalTest() throws Exception { } @Test - public void sherpaPublisherTest() throws Exception { + public void opfPublisherTest() throws Exception { String token = getAuthToken(admin.getEmail(), password); getClient(token).perform( get("/api/submission/vocabularies/SRPublisher/entries") diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/WorkspaceItemRestRepositoryIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/WorkspaceItemRestRepositoryIT.java index 24a389dcaf69..fb07ad843913 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/WorkspaceItemRestRepositoryIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/WorkspaceItemRestRepositoryIT.java @@ -8133,7 +8133,7 @@ public void verifyUnconfiguredBitstreamPolicyIsDeniedTest() throws Exception { } @Test - public void sherpaPolicySectionCacheTest() throws Exception { + public void opfPolicySectionCacheTest() throws Exception { context.turnOffAuthorisationSystem(); String dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX"; @@ -8161,15 +8161,15 @@ public void sherpaPolicySectionCacheTest() throws Exception { getClient(token).perform(get("/api/submission/workspaceitems/" + witem.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$", Matchers.allOf( - hasJsonPath("$.sections.sherpaPolicies.sherpaResponse.error", is(false))))) + hasJsonPath("$.sections.opfPolicies.opfResponse.error", is(false))))) .andExpect(jsonPath("$", Matchers.allOf( - hasJsonPath("$.sections.sherpaPolicies.sherpaResponse.journals[0].titles[0]", + hasJsonPath("$.sections.opfPolicies.opfResponse.journals[0].titles[0]", is("Nature Synthesis"))))) .andExpect(jsonPath("$", Matchers.allOf( - hasJsonPath("$.sections.sherpaPolicies.sherpaResponse.journals[0].issns[0]", + hasJsonPath("$.sections.opfPolicies.opfResponse.journals[0].issns[0]", is("2731-0582"))))) .andDo(result -> retrievalTime.set(read( - result.getResponse().getContentAsString(), "$.sections.sherpaPolicies.retrievalTime"))); + result.getResponse().getContentAsString(), "$.sections.opfPolicies.retrievalTime"))); Date date = new SimpleDateFormat(dateFormat).parse(retrievalTime.get()); @@ -8177,15 +8177,15 @@ public void sherpaPolicySectionCacheTest() throws Exception { getClient(token).perform(get("/api/submission/workspaceitems/" + witem.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$", Matchers.allOf( - hasJsonPath("$.sections.sherpaPolicies.sherpaResponse.error", is(false))))) + hasJsonPath("$.sections.opfPolicies.opfResponse.error", is(false))))) .andExpect(jsonPath("$", Matchers.allOf( - hasJsonPath("$.sections.sherpaPolicies.sherpaResponse.journals[0].titles[0]", + hasJsonPath("$.sections.opfPolicies.opfResponse.journals[0].titles[0]", is("Nature Synthesis"))))) .andExpect(jsonPath("$", Matchers.allOf( - hasJsonPath("$.sections.sherpaPolicies.sherpaResponse.journals[0].issns[0]", + hasJsonPath("$.sections.opfPolicies.opfResponse.journals[0].issns[0]", is("2731-0582"))))) .andDo(result -> retrievalTime2.set(read( - result.getResponse().getContentAsString(), "$.sections.sherpaPolicies.retrievalTime"))); + result.getResponse().getContentAsString(), "$.sections.opfPolicies.retrievalTime"))); Date date2 = new SimpleDateFormat(dateFormat).parse(retrievalTime2.get()); @@ -8193,7 +8193,7 @@ public void sherpaPolicySectionCacheTest() throws Exception { // create a list of values to use in add operation List operations = new ArrayList<>(); - operations.add(new RemoveOperation("/sections/sherpaPolicies/retrievalTime")); + operations.add(new RemoveOperation("/sections/opfPolicies/retrievalTime")); // empty the cache and verify the retrivatTime String patchBody = getPatchContent(operations); @@ -8202,15 +8202,15 @@ public void sherpaPolicySectionCacheTest() throws Exception { .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isOk()) .andExpect(jsonPath("$", Matchers.allOf( - hasJsonPath("$.sections.sherpaPolicies.sherpaResponse.error", is(false))))) + hasJsonPath("$.sections.opfPolicies.opfResponse.error", is(false))))) .andExpect(jsonPath("$", Matchers.allOf( - hasJsonPath("$.sections.sherpaPolicies.sherpaResponse.journals[0].titles[0]", + hasJsonPath("$.sections.opfPolicies.opfResponse.journals[0].titles[0]", is("Nature Synthesis"))))) .andExpect(jsonPath("$", Matchers.allOf( - hasJsonPath("$.sections.sherpaPolicies.sherpaResponse.journals[0].issns[0]", + hasJsonPath("$.sections.opfPolicies.opfResponse.journals[0].issns[0]", is("2731-0582"))))) .andDo(result -> retrievalTime.set(read( - result.getResponse().getContentAsString(), "$.sections.sherpaPolicies.retrievalTime"))); + result.getResponse().getContentAsString(), "$.sections.opfPolicies.retrievalTime"))); date = new SimpleDateFormat(dateFormat).parse(retrievalTime.get()); @@ -8220,22 +8220,22 @@ public void sherpaPolicySectionCacheTest() throws Exception { getClient(token).perform(get("/api/submission/workspaceitems/" + witem.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$", Matchers.allOf( - hasJsonPath("$.sections.sherpaPolicies.sherpaResponse.error", is(false))))) + hasJsonPath("$.sections.opfPolicies.opfResponse.error", is(false))))) .andExpect(jsonPath("$", Matchers.allOf( - hasJsonPath("$.sections.sherpaPolicies.sherpaResponse.journals[0].titles[0]", + hasJsonPath("$.sections.opfPolicies.opfResponse.journals[0].titles[0]", is("Nature Synthesis"))))) .andExpect(jsonPath("$", Matchers.allOf( - hasJsonPath("$.sections.sherpaPolicies.sherpaResponse.journals[0].issns[0]", + hasJsonPath("$.sections.opfPolicies.opfResponse.journals[0].issns[0]", is("2731-0582"))))) .andDo(result -> retrievalTime2.set(read( - result.getResponse().getContentAsString(), "$.sections.sherpaPolicies.retrievalTime"))); + result.getResponse().getContentAsString(), "$.sections.opfPolicies.retrievalTime"))); date2 = new SimpleDateFormat(dateFormat).parse(retrievalTime2.get()); assertTrue(date.equals(date2)); } @Test - public void sherpaPolicySectionWithWrongIssnCacheTest() throws Exception { + public void opfPolicySectionWithWrongIssnCacheTest() throws Exception { context.turnOffAuthorisationSystem(); String dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX"; @@ -8263,13 +8263,13 @@ public void sherpaPolicySectionWithWrongIssnCacheTest() throws Exception { getClient(token).perform(get("/api/submission/workspaceitems/" + witem.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$", Matchers.allOf( - hasJsonPath("$.sections.sherpaPolicies.sherpaResponse.error", is(true))))) + hasJsonPath("$.sections.opfPolicies.opfResponse.error", is(true))))) .andExpect(jsonPath("$", Matchers.allOf( - hasJsonPath("$.sections.sherpaPolicies.sherpaResponse.message", is("No results found"))))) + hasJsonPath("$.sections.opfPolicies.opfResponse.message", is("No results found"))))) .andExpect(jsonPath("$", Matchers.allOf( - hasJsonPath("$.sections.sherpaPolicies.sherpaResponse.journals", nullValue())))) + hasJsonPath("$.sections.opfPolicies.opfResponse.journals", nullValue())))) .andDo(result -> retrievalTime.set(read( - result.getResponse().getContentAsString(), "$.sections.sherpaPolicies.retrievalTime"))); + result.getResponse().getContentAsString(), "$.sections.opfPolicies.retrievalTime"))); Date date = new SimpleDateFormat(dateFormat).parse(retrievalTime.get()); @@ -8277,13 +8277,13 @@ public void sherpaPolicySectionWithWrongIssnCacheTest() throws Exception { getClient(token).perform(get("/api/submission/workspaceitems/" + witem.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$", Matchers.allOf( - hasJsonPath("$.sections.sherpaPolicies.sherpaResponse.error", is(true))))) + hasJsonPath("$.sections.opfPolicies.opfResponse.error", is(true))))) .andExpect(jsonPath("$", Matchers.allOf( - hasJsonPath("$.sections.sherpaPolicies.sherpaResponse.message", is("No results found"))))) + hasJsonPath("$.sections.opfPolicies.opfResponse.message", is("No results found"))))) .andExpect(jsonPath("$", Matchers.allOf( - hasJsonPath("$.sections.sherpaPolicies.sherpaResponse.journals", nullValue())))) + hasJsonPath("$.sections.opfPolicies.opfResponse.journals", nullValue())))) .andDo(result -> retrievalTime2.set(read( - result.getResponse().getContentAsString(), "$.sections.sherpaPolicies.retrievalTime"))); + result.getResponse().getContentAsString(), "$.sections.opfPolicies.retrievalTime"))); Date date2 = new SimpleDateFormat(dateFormat).parse(retrievalTime2.get()); @@ -8291,7 +8291,7 @@ public void sherpaPolicySectionWithWrongIssnCacheTest() throws Exception { // create a list of values to use in add operation List operations = new ArrayList<>(); - operations.add(new RemoveOperation("/sections/sherpaPolicies/retrievalTime")); + operations.add(new RemoveOperation("/sections/opfPolicies/retrievalTime")); // empty the cache and verify the retrivatTime String patchBody = getPatchContent(operations); @@ -8300,13 +8300,13 @@ public void sherpaPolicySectionWithWrongIssnCacheTest() throws Exception { .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isOk()) .andExpect(jsonPath("$", Matchers.allOf( - hasJsonPath("$.sections.sherpaPolicies.sherpaResponse.error", is(true))))) + hasJsonPath("$.sections.opfPolicies.opfResponse.error", is(true))))) .andExpect(jsonPath("$", Matchers.allOf( - hasJsonPath("$.sections.sherpaPolicies.sherpaResponse.message", is("No results found"))))) + hasJsonPath("$.sections.opfPolicies.opfResponse.message", is("No results found"))))) .andExpect(jsonPath("$", Matchers.allOf( - hasJsonPath("$.sections.sherpaPolicies.sherpaResponse.journals", nullValue())))) + hasJsonPath("$.sections.opfPolicies.opfResponse.journals", nullValue())))) .andDo(result -> retrievalTime.set(read( - result.getResponse().getContentAsString(), "$.sections.sherpaPolicies.retrievalTime"))); + result.getResponse().getContentAsString(), "$.sections.opfPolicies.retrievalTime"))); date = new SimpleDateFormat(dateFormat).parse(retrievalTime.get()); @@ -8316,13 +8316,13 @@ public void sherpaPolicySectionWithWrongIssnCacheTest() throws Exception { getClient(token).perform(get("/api/submission/workspaceitems/" + witem.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$", Matchers.allOf( - hasJsonPath("$.sections.sherpaPolicies.sherpaResponse.error", is(true))))) + hasJsonPath("$.sections.opfPolicies.opfResponse.error", is(true))))) .andExpect(jsonPath("$", Matchers.allOf( - hasJsonPath("$.sections.sherpaPolicies.sherpaResponse.message", is("No results found"))))) + hasJsonPath("$.sections.opfPolicies.opfResponse.message", is("No results found"))))) .andExpect(jsonPath("$", Matchers.allOf( - hasJsonPath("$.sections.sherpaPolicies.sherpaResponse.journals", nullValue())))) + hasJsonPath("$.sections.opfPolicies.opfResponse.journals", nullValue())))) .andDo(result -> retrievalTime2.set(read( - result.getResponse().getContentAsString(), "$.sections.sherpaPolicies.retrievalTime"))); + result.getResponse().getContentAsString(), "$.sections.opfPolicies.retrievalTime"))); date2 = new SimpleDateFormat(dateFormat).parse(retrievalTime2.get()); assertTrue(date.equals(date2)); diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/health/SEOHealthIndicatorTest.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/health/SEOHealthIndicatorTest.java new file mode 100644 index 000000000000..e5c9bb1c9e5d --- /dev/null +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/health/SEOHealthIndicatorTest.java @@ -0,0 +1,123 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.health; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.when; + +import java.util.Map; + +import org.dspace.app.rest.configuration.ActuatorConfiguration; +import org.dspace.services.ConfigurationService; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.springframework.boot.actuate.health.Health; +import org.springframework.boot.actuate.health.Status; +import org.springframework.http.ResponseEntity; +import org.springframework.web.client.RestClientException; +import org.springframework.web.client.RestTemplate; + +/** + * Unit tests for {@link SEOHealthIndicator}. + */ +@RunWith(MockitoJUnitRunner.class) +public class SEOHealthIndicatorTest { + + private static final String BASE_URL = "https://demo.dspace.org"; + + @Mock + private ConfigurationService configurationService; + + @Mock + private RestTemplate restTemplate; + + @InjectMocks + private SEOHealthIndicator seoHealthIndicator; + + @Before + public void setUp() { + when(configurationService.getProperty("dspace.ui.url")).thenReturn(BASE_URL); + } + + @Test + public void testWithSeoConfiguredCorrectly() { + when(restTemplate.getForEntity(anyString(), eq(String.class))) + .thenReturn(ResponseEntity.ok("")); + when(restTemplate.getForObject(eq(BASE_URL + "/robots.txt"), eq(String.class))) + .thenReturn("User-agent: *\nSitemap: " + BASE_URL + "/sitemap_index.xml"); + when(restTemplate.getForObject(eq(BASE_URL), eq(String.class))) + .thenReturn("Rendered content"); + + Health health = seoHealthIndicator.health(); + + assertThat(health.getStatus(), is(Status.UP)); + assertThat(health.getDetails(), is(Map.of( + SEOHealthIndicator.SITEMAP, SEOHealthIndicator.OK, + SEOHealthIndicator.ROBOTS_TXT, SEOHealthIndicator.OK, + SEOHealthIndicator.SSR, SEOHealthIndicator.OK))); + } + + @Test + public void testWithSeoChecksFailingReportsUpWithIssues() { + when(restTemplate.getForEntity(anyString(), eq(String.class))) + .thenThrow(new RestClientException("connection refused")); + when(restTemplate.getForObject(anyString(), eq(String.class))) + .thenThrow(new RestClientException("connection refused")); + + Health health = seoHealthIndicator.health(); + + assertThat(health.getStatus(), is(ActuatorConfiguration.UP_WITH_ISSUES_STATUS)); + assertThat(health.getDetails(), is(Map.of( + SEOHealthIndicator.SITEMAP, SEOHealthIndicator.SITEMAP_MISSING, + SEOHealthIndicator.ROBOTS_TXT, SEOHealthIndicator.ROBOTS_MISSING, + SEOHealthIndicator.SSR, SEOHealthIndicator.SSR_DISABLED))); + } + + @Test + public void testWithRobotsTxtContainingLocalhostReportsUpWithIssues() { + when(restTemplate.getForEntity(anyString(), eq(String.class))) + .thenReturn(ResponseEntity.ok("")); + when(restTemplate.getForObject(eq(BASE_URL + "/robots.txt"), eq(String.class))) + .thenReturn("Sitemap: http://localhost:8080/sitemap_index.xml"); + when(restTemplate.getForObject(eq(BASE_URL), eq(String.class))) + .thenReturn("Rendered content"); + + Health health = seoHealthIndicator.health(); + + assertThat(health.getStatus(), is(ActuatorConfiguration.UP_WITH_ISSUES_STATUS)); + assertThat(health.getDetails(), is(Map.of( + SEOHealthIndicator.SITEMAP, SEOHealthIndicator.OK, + SEOHealthIndicator.ROBOTS_TXT, SEOHealthIndicator.ROBOTS_INVALID, + SEOHealthIndicator.SSR, SEOHealthIndicator.OK))); + } + + @Test + public void testWithSsrDisabledReportsUpWithIssues() { + when(restTemplate.getForEntity(anyString(), eq(String.class))) + .thenReturn(ResponseEntity.ok("")); + when(restTemplate.getForObject(eq(BASE_URL + "/robots.txt"), eq(String.class))) + .thenReturn("User-agent: *\nSitemap: " + BASE_URL + "/sitemap_index.xml"); + when(restTemplate.getForObject(eq(BASE_URL), eq(String.class))) + .thenReturn(""); + + Health health = seoHealthIndicator.health(); + + assertThat(health.getStatus(), is(ActuatorConfiguration.UP_WITH_ISSUES_STATUS)); + assertThat(health.getDetails(), is(Map.of( + SEOHealthIndicator.SITEMAP, SEOHealthIndicator.OK, + SEOHealthIndicator.ROBOTS_TXT, SEOHealthIndicator.OK, + SEOHealthIndicator.SSR, SEOHealthIndicator.SSR_DISABLED))); + } +} diff --git a/dspace-services/pom.xml b/dspace-services/pom.xml index cc0af05c37a5..49f2d433e946 100644 --- a/dspace-services/pom.xml +++ b/dspace-services/pom.xml @@ -9,7 +9,7 @@ org.dspace dspace-parent - 8.4 + 8.5 diff --git a/dspace-sword/pom.xml b/dspace-sword/pom.xml index ad02d31f1325..a3490942c204 100644 --- a/dspace-sword/pom.xml +++ b/dspace-sword/pom.xml @@ -15,7 +15,7 @@ org.dspace dspace-parent - 8.4 + 8.5 .. @@ -72,7 +72,7 @@ xom xom - 1.4.1 + 1.4.6 diff --git a/dspace-swordv2/pom.xml b/dspace-swordv2/pom.xml index 27c4bee8e77c..9067e546379d 100644 --- a/dspace-swordv2/pom.xml +++ b/dspace-swordv2/pom.xml @@ -13,7 +13,7 @@ org.dspace dspace-parent - 8.4 + 8.5 .. diff --git a/dspace/config/crosswalks/DIM2DataCite.xsl b/dspace/config/crosswalks/DIM2DataCite.xsl index 34fb9c64bf96..c44fb3d65780 100644 --- a/dspace/config/crosswalks/DIM2DataCite.xsl +++ b/dspace/config/crosswalks/DIM2DataCite.xsl @@ -359,14 +359,16 @@ - - - - + + + + + + diff --git a/dspace/config/dspace.cfg b/dspace/config/dspace.cfg index 5917849ad634..9f4383d5ceb3 100644 --- a/dspace/config/dspace.cfg +++ b/dspace/config/dspace.cfg @@ -915,6 +915,11 @@ checker.retention.CHECKSUM_MATCH=8w # The directory where the exports will be done and compressed org.dspace.app.itemexport.work.dir = ${dspace.dir}/exports +# Allowed base directories for item export output. This directory +# will be enforced as the parent dir of all exports, including downloads, script "-d" +# destination path, and so on. The default value matches org.dspace.app.itemexport.work.dir. +#org.dspace.app.itemexport.allowed.dir = ${org.dspace.app.itemexport.work.dir} + # The directory where the compressed files will reside and be read by the downloader org.dspace.app.itemexport.download.dir = ${dspace.dir}/exports/download @@ -1459,17 +1464,6 @@ sitemap.dir = ${dspace.dir}/sitemaps # Keep in mind, changing the schedule requires rebooting your servlet container, e.g. Tomcat. sitemap.cron = 0 15 1 * * ? -##### SHERPA/Romeo Integration Settings #### -# The SHERPA/RoMEO endpoint (v2 API) -sherpa.romeo.url = https://v2.sherpa.ac.uk/cgi/retrieve - -# Please register for a free api access key to use the SHERPA v2 API -# https://v2.sherpa.ac.uk/api/ -# Please note: the SHERPA v2 API uses different API keys to the legacy APIs. -# If you have been using the old ROMeO endpoint (end-of-life as at 2020-04-14), you must -# register for a new API key -sherpa.romeo.apikey = - ##### Google Scholar Metadata Configuration ##### google-metadata.config = ${dspace.dir}/config/crosswalks/google-metadata.properties google-metadata.enable = true diff --git a/dspace/config/ehcache.xml b/dspace/config/ehcache.xml index 41508a5fa826..b5430d0723a2 100644 --- a/dspace/config/ehcache.xml +++ b/dspace/config/ehcache.xml @@ -44,10 +44,10 @@ 4 - + - org.dspace.app.sherpa.cache.SherpaCacheLogger + org.dspace.app.openpolicyfinder.cache.OpenPolicyFinderCacheLogger ASYNCHRONOUS UNORDERED CREATED @@ -64,6 +64,6 @@ - + \ No newline at end of file diff --git a/dspace/config/item-submission.xml b/dspace/config/item-submission.xml index 42b8c4f950d0..e0d2ebd3ce09 100644 --- a/dspace/config/item-submission.xml +++ b/dspace/config/item-submission.xml @@ -228,10 +228,10 @@ sample - - submit.progressbar.sherpapolicy - org.dspace.app.rest.submit.step.SherpaPolicyStep - sherpaPolicy + + submit.progressbar.opfpolicy + org.dspace.app.rest.submit.step.OpenPolicyFinderPolicyStep + opfPolicy @@ -288,8 +288,8 @@ - - + + - - - + + + + - + Journal - - - - + + + + @@ -247,10 +247,10 @@ - - - - + + + + diff --git a/dspace/config/spring/api/sherpa.xml b/dspace/config/spring/api/openpolicyfinder.xml similarity index 59% rename from dspace/config/spring/api/sherpa.xml rename to dspace/config/spring/api/openpolicyfinder.xml index da42880218ca..a30e0df20a9b 100644 --- a/dspace/config/spring/api/sherpa.xml +++ b/dspace/config/spring/api/openpolicyfinder.xml @@ -10,19 +10,21 @@ - + + - + creativeworkseries.issn + dc.identifier.issn - @@ -41,8 +43,8 @@ - - + + diff --git a/dspace/config/submission-forms.xml b/dspace/config/submission-forms.xml index 102ff804568d..3074b3c3d02d 100644 --- a/dspace/config/submission-forms.xml +++ b/dspace/config/submission-forms.xml @@ -719,7 +719,7 @@ Select the journal related to this volume. - sherpaJournal + opfJournal diff --git a/dspace/modules/additions/pom.xml b/dspace/modules/additions/pom.xml index f094b1dfcaf1..2f6d7a61c952 100644 --- a/dspace/modules/additions/pom.xml +++ b/dspace/modules/additions/pom.xml @@ -17,7 +17,7 @@ org.dspace modules - 8.4 + 8.5 .. diff --git a/dspace/modules/pom.xml b/dspace/modules/pom.xml index b41455e53e0d..40ce9685278f 100644 --- a/dspace/modules/pom.xml +++ b/dspace/modules/pom.xml @@ -11,7 +11,7 @@ org.dspace dspace-parent - 8.4 + 8.5 ../../pom.xml diff --git a/dspace/modules/server-boot/pom.xml b/dspace/modules/server-boot/pom.xml index 5e4b7fe9611c..c1ef5d283a5b 100644 --- a/dspace/modules/server-boot/pom.xml +++ b/dspace/modules/server-boot/pom.xml @@ -11,7 +11,7 @@ modules org.dspace - 8.4 + 8.5 .. diff --git a/dspace/modules/server/pom.xml b/dspace/modules/server/pom.xml index 6523392f76fe..ef67939e8d97 100644 --- a/dspace/modules/server/pom.xml +++ b/dspace/modules/server/pom.xml @@ -7,7 +7,7 @@ modules org.dspace - 8.4 + 8.5 .. diff --git a/dspace/pom.xml b/dspace/pom.xml index 7492408e81a4..65cd86f3006a 100644 --- a/dspace/pom.xml +++ b/dspace/pom.xml @@ -16,7 +16,7 @@ org.dspace dspace-parent - 8.4 + 8.5 ../pom.xml diff --git a/dspace/src/main/config/build.xml b/dspace/src/main/config/build.xml index f588eb023877..44acfb393428 100644 --- a/dspace/src/main/config/build.xml +++ b/dspace/src/main/config/build.xml @@ -126,6 +126,7 @@ Common usage: + @@ -163,6 +164,16 @@ Common usage: + + + + + + + + + @@ -178,11 +189,83 @@ Common usage: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +==================================================================== + The following configuration files are no longer part of DSpace. + Each one has been renamed to "<filename>.obsolete-${build.date}" + so that it can no longer be loaded by DSpace: + + ${obsolete.configs.found} + + Nothing was deleted. Review these files for any local customizations + you still need, then run "ant clean_obsolete" to remove them. +==================================================================== + + + + 17 - 6.2.18 - 3.3.7 - 3.5.14 - 6.5.10 + 6.2.19 + 3.3.8 + 3.5.16 + 6.5.11 6.4.10.Final - 8.0.3.Final - 42.7.11 + 8.0.5.Final + 42.7.13 10.22.0 8.11.4 3.12.0 2.42.0 - 2.21.3 - 2.21 + 2.22.2 + 2.22 2.1.1 4.0.5 - 4.0.8 + 4.0.9 1.1.1 9.4.58.v20250814 - 2.25.4 - 3.0.7 + 2.26.1 + 3.0.8 1.19.0 - 2.0.17 - 3.3.0 + 2.0.18 + 3.3.2 1.81 8.0.1 - 3.1.11 + 3.1.12 2.10.0 @@ -92,7 +92,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.6.2 + 3.6.3 enforce-java @@ -189,7 +189,7 @@ org.apache.maven.plugins maven-jar-plugin - 3.5.0 + 3.5.1 @@ -220,7 +220,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.5.5 + 3.5.6 @@ -247,7 +247,7 @@ maven-failsafe-plugin - 3.5.5 + 3.5.6 @@ -315,7 +315,7 @@ com.github.spotbugs spotbugs-maven-plugin - 4.9.8.3 + 4.10.4.0 Max Low @@ -325,7 +325,7 @@ com.github.spotbugs spotbugs - 4.9.8 + 4.10.4 @@ -360,7 +360,7 @@ org.apache.maven.plugins maven-dependency-plugin - 3.10.0 + 3.11.0 org.apache.maven.plugins @@ -377,7 +377,7 @@ org.sonatype.central central-publishing-maven-plugin - 0.10.0 + 0.11.0 @@ -417,7 +417,7 @@ org.jacoco jacoco-maven-plugin - 0.8.14 + 0.8.15 @@ -507,7 +507,7 @@ - + ${root.basedir} @@ -517,6 +517,7 @@ **/target/** + **/.*/** @@ -1026,68 +1027,68 @@ org.dspace dspace-api - 8.4 + 8.5 org.dspace dspace-api test-jar - 8.4 + 8.5 test org.dspace.modules additions - 8.4 + 8.5 org.dspace.modules server classes - 8.4 + 8.5 org.dspace dspace-sword - 8.4 + 8.5 org.dspace dspace-swordv2 - 8.4 + 8.5 org.dspace dspace-oai - 8.4 + 8.5 org.dspace dspace-services - 8.4 + 8.5 org.dspace dspace-server-webapp test-jar - 8.4 + 8.5 test org.dspace dspace-rdf - 8.4 + 8.5 org.dspace dspace-iiif - 8.4 + 8.5 org.dspace dspace-server-webapp - 8.4 + 8.5 @@ -1354,7 +1355,7 @@ com.healthmarketscience.jackcess jackcess - 4.0.10 + 4.0.11 @@ -1509,17 +1510,17 @@ commons-codec commons-codec - 1.22.0 + 1.22.1 org.apache.commons commons-collections4 - 4.5.0 + 4.6.0 org.apache.commons commons-configuration2 - 2.15.0 + 2.15.1 org.apache.commons @@ -1548,7 +1549,7 @@ commons-logging commons-logging - 1.3.6 + 1.4.0 org.apache.commons @@ -1573,7 +1574,7 @@ commons-validator commons-validator - 1.10.1 + 1.11.0 jakarta.activation @@ -1609,7 +1610,7 @@ jaxen jaxen - 2.0.1 + 2.0.6 org.jdom @@ -1746,20 +1747,6 @@ test - - - com.google.code.findbugs - jsr305 - 3.0.2 - provided - - - com.google.code.findbugs - annotations - 3.0.1u2 - provided - - com.fasterxml @@ -1801,7 +1788,7 @@ xom xom - 1.4.1 + 1.4.6 xml-apis @@ -1943,7 +1930,7 @@ scm:git:git@github.com:DSpace/DSpace.git scm:git:git@github.com:DSpace/DSpace.git https://github.com/DSpace/DSpace - dspace-8.4 + dspace-8.5