Map every failure at the origin to one status - #74
Merged
Conversation
- Add DimsOriginStatusMode, which reports 404, 502, and 504 instead of the origin's own status. - Add DimsStatusVerbose, which hides the component versions from the status page. - Read an https source URL out of the request path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
DimsOriginStatusModedecides how a failure at the origin reaches the caller.forwardis the default and reports the status the origin returned, which is what the module has always done.mapreports 404 for a missing source, 504 for a download timeout, and 502 for every other origin failure.The mapping covers a failure at the origin and nothing else. A malformed geometry fails after a successful fetch, which leaves 200 on the request, and calling that a bad gateway would blame the origin for the caller's mistake. Both modes report the module's own status there.
DimsStatusVerbosedecides whether the status page prints the mod_dims, ImageMagick, and libcurl versions. The default isOn, which is today's behavior. The counters and the uptime print either way.src/url.creads the source URL out of a request path. Three handlers carried a near identical copy of that code, and each looked forhttp:/alone.Why
The status the origin returned became the status mod_dims returned. Combined with a reachable target that makes the service an oracle: 401 says the target exists and wants credentials, a timeout says the port is filtered, and 200 says it is open. A caller learns what is behind the service by reading status codes.
/dims-status/returns the version of every component to any caller, and the shippeddocker/dims.confexposes the handler with no access control. The versions name each library a caller would need to pick an exploit.https:/does not containhttp:/, so a TLS source URL in the request path was never found and the request failed as a bad URL. Only the?url=and?eurl=forms reached an https origin.The two response paths still disagree about which status a failure gets.
dims_send_imageforwards the origin's status wheredims_cleanupreports the module's own. Closing that disagreement changes what/dims3/and/dims4/return, somapis what closes it.Verify
184 cases pass, 182 before. No golden file changes.
The suite gains a server on port 8005 with
DimsOriginStatusMode map,DimsStatusVerbose off, a one second download timeout, and the sizer enabled. The origin gains/slow.png, which answers five seconds later than any timeout.test/unit/test_url.ccovers the path reader directly: both schemes, a collapsed slash and an escaped one, a path with no URL, and the truncation the caller performs afterwards.The sizer is not in the shipped configuration, so port 8005 is the first place the allowlist it gained in #73 runs.
TestSizerAppliesTheAllowlistcovers it.Breaking
Nothing. Both directives default to today's behavior, and the path reader only finds a URL that failed to parse before.
An
https:/source in the path now reaches the fetch instead of failing as a bad URL. A deployment that relied on that failure gets a connection attempt instead.The configuration pages do not exist yet, so neither directive is documented outside the
httpd -Lhelp text.