fcrepo-exts / fcrepo-import-export

Apache License 2.0
15 stars 19 forks source link

Ensures that external resources are not exported by default. #158

Closed dbernstein closed 3 years ago

dbernstein commented 3 years ago

Users must now specify --external=true to export proxied and redirected external resources.

Resolves: https://jira.lyrasis.org/browse/FCREPO-3416

This PR is covered by new integration test.

To test manually:

  1. start up fcrepo 5.1.1 with allowed external content
    cat "https://" > allowed_external_paths.txt
    java -Dfcrepo.external.content.allowed=./allowed_external_paths.txt -jar fcrepo-webapp-5.1.1-jetty-console.jar --headless
  2. create a proxied resource pointing at the newly created binary.
    curl -i -H"Link: <https://wiki.lyrasis.org/download/attachments/4980737/atl.site.logo>; rel=\"http://fedoraent\"; handling=\"proxy\"; type=\"image/png\"" -XPUT -ufedoraAdmin:fedoraAdmin http://localhost:8080/rest/proxy_test
  3. perform an export
    java -jar fcrepo-import-export-1.1.0-SNAPSHOT.jar -b -d export-3416 -u fedoraAdmin:fedoraAdmin  -b -m export -r http://localhost:8080/rest
  4. verify that the external resource file is zero length
    ls -lastR export-3416/ | grep proxy_test.external
  5. perform export again with --external flag enabled
    # remove previous export
    rm -rf export-3416
    # run export
    java -jar target/fcrepo-import-export-1.1.0-SNAPSHOT.jar -b -d export-3416 -u fedoraAdmin:fedoraAdmin  -b --external -m export -r http://localhost:8080/rest
  6. verify that the external resource non-zero length.
    ls -lastR export-3416/ | grep proxy_test.external