tusd icon indicating copy to clipboard operation
tusd copied to clipboard

hooks: add pre-access blocking hook

Open sberthier opened this issue 1 year ago • 6 comments

  • To replace pre-resume PR (#1074)
  • Add Access.Mode and Access.Files to HookEvent for pre-access and pre-create (when Upload-Concat) hook.
    • Files is an array because of Concatenation extension that access many files to make a new one
    • Mode is read (Get/Head) or write (Patch/Delete)
  • Add pre-access before each http request Get/Head/Patch/Delete.
    • This new hook is disabled by default
    • Access can be rejected by setting RejectAccess in HookResponse. Http response status code will be 403, if not override in HttpResponse.
    • Useful for authentication/authorization of upload access, based on http request headers for instance

close #1074

sberthier avatar Jan 30 '24 11:01 sberthier

I made the changes you suggested, except the last one to set Hook.Upload to nil !

sberthier avatar Feb 16 '24 09:02 sberthier

Thank you for the updates, I will look into this in two weeks and then we should be able to get this merged.

Acconut avatar Mar 25 '24 23:03 Acconut

Hi everyone. Just wanted to ask, if this this is still being worked on?

quality-leftovers avatar Feb 10 '25 13:02 quality-leftovers

There hasn't been any work on this since, but we are still interested in adding this to tusd.

Acconut avatar Feb 10 '25 14:02 Acconut

@Acconut it seems the PR is ready to merge, any reason why is postponed please?

videni avatar May 21 '25 00:05 videni

In general, this PR looks good but I need to give it another review and probably polish a few edges. I'm not sure when I'll get to that as time is tight, but I'll try my best. Apologies for the delay!

Acconut avatar May 21 '25 06:05 Acconut