Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[BUG] FedoraAdapter for flysystem reporting success when failing to write to fedora. #2094

Open
nigelgbanks opened this issue Apr 21, 2022 · 1 comment
Labels
Type: bug identifies a problem in the software with clear steps to reproduce

Comments

@nigelgbanks
Copy link
Member

What steps does it take to reproduce the issue?

Use the following command, on a working site.

drush php:cli

Enter in the following code.

file_put_contents('fedora://2099-99/dummy.txt', "some text");

Note that it response successfully with 9 bytes written. However it did not actually write to fedora which can be confirmed with the following code.

file_get_contents('fedora://2099-99/dummy.txt');

Which yields 'false'.

From the fedora logs we can see this failed to authorise with 403 as the returned status code on the PUT request.

172.22.0.10 - - [21/Apr/2022:17:12:59 +0000] "HEAD /fcrepo/rest/2099-99/dummy.txt HTTP/1.1" 404 0 "-" "GuzzleHttp/6.5.5 curl/7.77.0 PHP/7.4.21" "172.22.0.18"
21-Apr-2022 17:12:59.715 INFO [http-nio-8080-exec-9] ca.islandora.syn.valve.SynValve.doAuthentication Site verified: https://default/
172.22.0.10 - - [21/Apr/2022:17:12:59 +0000] "PUT /fcrepo/rest/2099-99/dummy.txt HTTP/1.1" 403 618 "-" "GuzzleHttp/6.5.5 curl/7.77.0 PHP/7.4.21" "172.22.0.18"

If one programatically logs in as user 1 it will authorise and the content can be written to fedora. Though the issue here is that file_put_contents returns successful when it has in fact failed.

  • When does this issue occur?

N/A.

  • Which page does it occur on?

N/A.

  • What happens?

N/A.

  • To whom does it occur (anonymous visitor, editor, administrator)?

Users without permission to write to fedora.

  • What did you expect to happen?

That file_put_contents would return FALSE.

Which version of Islandora are you using?

2.2.0

Any related open or closed issues to this bug report?

No

Screenshots:

N/A.

@nigelgbanks nigelgbanks added the Type: bug identifies a problem in the software with clear steps to reproduce label Apr 21, 2022
@seth-shaw-unlv
Copy link
Contributor

Weird. The Fedora Flysystem Adapter should be returning FALSE on the write call when it gets a 403 response:

    $code = $response->getStatusCode();
    if (!in_array($code, [201, 204])) {
      return FALSE;
    }

Someone is going to need to step through this with a debugger (or use a liberal amount of logging statements) to figure out how this is getting through.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: bug identifies a problem in the software with clear steps to reproduce
Projects
None yet
Development

No branches or pull requests

2 participants