fix: tighten the debug logging, rule-pattern and ingress guards - #94
Merged
Conversation
Debug mode logged the composed message, which contains the verification code, and the destination chat id, which is a phone number, on three separate lines. Debug is switched on precisely when a delivery is misbehaving, so that output is what gets pasted into a support thread or shipped to a log collector — an OTP is a live credential and the id beside it names its owner. The send line now records the message length rather than the message, and chat ids in log lines are reduced to their last four digits: enough to correlate two lines about the same chat, not enough to identify anyone. The diagnostic still shows that a send was attempted, which is what debug is for.
The analyser rejects patterns prone to catastrophic backtracking before they are compiled. Two of its
assumptions were wrong.
It reasoned that a small bounded repeat is bounded by its constant. That holds for a variable-width body
but not for an unbounded one: `(a+){3}` expands to `a+a+a+`, which backtracks exponentially — 200
characters took 1.4 s and 1000 took over six. Any repeat of an unbounded body is refused now, while a
bounded repeat of a variable body like `(ab?){2}` stays allowed, since that is the case the constant
really does bound.
It also treated every group as breaking a run of adjacent unbounded quantifiers. A group that can match
empty does not, so `.*(x?).*(x?).*` was `.*.*.*` wearing a disguise. The run is now parked at the
opening paren and resumed if the group turns out to be nullable; a group that must consume something
still breaks it.
Overlapping alternation remains unmodelled and is still documented as such.
…mission An ingress route becomes a public endpoint once the host provisions it, and the host refuses to load a plugin that declares one without `webhook:ingress`. That refusal happens at install, on the operator's gateway, after the release has been tagged and published. The catalogue gate now checks it where the package is built instead.
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.
Three defects, each in a guard that was meant to prevent exactly the thing it let through.
supabase-otp-hook — debug logs carried the code and the number
Debug mode logged the composed message, which contains the verification code, and the destination chat id, which is a phone number, across three separate lines. Debug is switched on precisely when a delivery is misbehaving, so that output is what gets pasted into a support thread or shipped to a log collector — an OTP is a live credential, and the id beside it names its owner.
The send line now records the message length rather than the message, and chat ids are reduced to their last four digits: enough to correlate two lines about the same chat, not enough to identify anyone. The diagnostic still shows that a send was attempted, which is the point of debug mode.
faq-bot — two ways past the rule-pattern safety analyser
The analyser rejects patterns prone to catastrophic backtracking before they reach
new RegExp. Two of its assumptions were wrong, and both were reproduced:(a+){3}expands toa+a+a+. Measured: 200 characters took 1.4 s, 1000 took over 6 s. Any repeat of an unbounded body is refused now, while(ab?){2}stays allowed, since that is the case the constant really does bound..*(x?).*(x?).*was.*.*.*in disguise;\w*(a?)\w*(a?)\w*!took 10.6 s on 300 characters. The run is now parked at the opening paren and resumed if the group turns out nullable. A group that must consume something still breaks it, so.*(x).*(y).*remains accepted.Overlapping alternation is still not modelled, and the doc comment still says so.
catalog — ingress declared without the permission
An ingress route becomes a public endpoint once the host provisions it, and the host refuses to load a plugin declaring one without
webhook:ingress. That refusal lands at install, on the operator's gateway, after the release is tagged and published. The catalogue gate now checks it where the package is built.Verification