Repository navigation
[pull] main from miniflux:main - #316
Merged
Merged
Conversation
When a non-existent username was submitted, CheckPassword returned immediately without performing a bcrypt comparison, making it possible to distinguish valid from invalid usernames by measuring response time. Perform a dummy bcrypt comparison against a fixed cost-10 hash when the user is not found so the response time is indistinguishable from a real password check.
While inspecting the network requests done by miniflux' web interface, I noticed that immutable assets with the `immutable` header were still fetched. So I reread https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Cache-Control: > immutable tells a cache that the response is immutable while it's fresh and avoids those kinds of unnecessary conditional requests to the server. So it needs to have max-age as well, otherwise the browser will consider the resource as not fresh, and will perform a network request (and get a 304).
iconPath() is called a bunch of times on virtually every pages. Each call did a
fmt.Sprintf to build a string of the form
"{basePath}/icon/{checksum}/{filename}". Since both the base path and
BinaryBundles are fixed at startup, all results are determinate.
This commit precomputes the full URL for every embedded bundle once in
funcMap.Map() into a map[string]string and turns iconPath into a single map
lookup. The "_/" fallback for unknown filenames was unused, as every caller
passes a compile-time literal present in bin/, so it was removed.
Microbenchmarks are showing stupidly high gains of course, but anything macro
is non-trivial, and I gave up on it. Knowing that it removes at least one heap
allocation and a couple of reflection calls on every iconPath call is enough to
bring me joy.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )