class
MartenRailsBridge::ActiveStorage::Blobs::ProxyHandlerGuardTest
- MartenRailsBridge::ActiveStorage::Blobs::ProxyHandlerGuardTest
- Minitest::Test
- Minitest::Runnable
- Reference
- Object
Overview
The gate a consumer puts in front of the mounted handler.
Marten::Handlers::Base#process_dispatch assigns the response a before_dispatch callback
returns and never calls #dispatch, so the gate runs before ActiveStorage::Blob.find_signed!:
a refused request reads neither the database nor the storage, and no byte of the blob is written.
:nodoc:
Defined in:
active_storage/blobs/proxy_handler_test.crConstant Summary
-
PAYLOAD =
"0123456789" -
Body stored for the blob created by
#create_blob.
Instance Method Summary
- #setup
- #teardown
-
#test_a_bad_signed_id_is_a_404_with_a_credential_and_a_401_without
The ordering proof: the same bad signed ID answers
404once the gate passed and401before it, which only holds if the gate runs first. -
#test_a_range_request_without_a_credential_writes_no_partial_body
A
Rangerequest is the one that could leak a slice of the blob, so it is refused before the range is even parsed: no206, noContent-Rangeand no body. - #test_a_revoked_credential_is_refused
- #test_a_subclass_that_forgets_http_method_names_widens_the_allowed_verbs
- #test_a_valid_credential_is_served
- #test_a_wrong_credential_is_refused
- #test_an_anonymous_request_is_refused_without_touching_the_service
-
#test_the_refusal_carries_an_empty_content_type
#headleaves an empty content type where Rails sends none. -
#test_the_widened_verbs_leak_through_the_allow_header_only
The widened verbs answer
405all the same, because theMarten::Handlers::Basemethod of each of them does.
Instance Method Detail
The ordering proof: the same bad signed ID answers 404 once the gate passed and 401 before
it, which only holds if the gate runs first.
A Range request is the one that could leak a slice of the blob, so it is refused before the
range is even parsed: no 206, no Content-Range and no body.
#head leaves an empty content type where Rails sends none. The 404 path of the handler
deviates the same way, and neither is fixed here.
The widened verbs answer 405 all the same, because the Marten::Handlers::Base method of each
of them does. What leaks is the Allow header of an OPTIONS response.