divyanshus2404 commented on PR #71711:
URL: https://github.com/apache/airflow/pull/71711#issuecomment-5819486756
Thanks for the thorough re-review. Both points are addressed in f66e620b.
Rather than patching the `endswith(quote)` check and `_SENSITIVE_KV_RE`
separately, I replaced the token-based heuristics with a single-pass scanner,
`_mask_sensitive_values()`, that computes exactly what the original regex on
`main` matches. Both problems came from the heuristics only approximating that
pattern, so matching it directly closes the whole class rather than the two
shapes found so far.
**Blocking — quoted multi-word values**
A quoted value now closes the same way as on `main`: at the last matching
quote before a quote-followed-by-whitespace or a newline. Both payloads are
pinned in `test_masks_passwords`:
```
IN : Config(password="my pass word", user=x)
OUT: Config(password="******", user=x)
IN : {'password': 'a b'}
OUT: {'password': '******'}
```
Last round's two multi-key payloads still mask correctly. Both new cases
fail against the previous head.
**Major — super-linear `_SENSITIVE_KV_RE`**
There is no backtracking regex left in the masking path, and the incorrect
O(n) comments are gone. On the payload you gave:
| `"a=" + "secret" * n` | this PR |
|---|---|
| n=20,000 | 0.3 ms |
| n=40,000 | 0.7 ms |
| n=80,000 | 1.3 ms |
Other adversarial shapes (`"secret" * n`, `"x " * n`, alternating and
unterminated quotes, `secret= ` repeated) also scale linearly.
`test_masks_passwords_stays_fast_on_repeated_keywords` is now parametrized over
`"secret" * 20_000` and `"a=" + "secret" * 20_000`; on the previous head the
second one runs for minutes.
**Differential check**
I re-ran the comparison against the `main` regex with a generator that now
emits closed-quote-then-second-key tokens, quotes followed by punctuation
(`",`, `')`, `'}`), tabs, CRLF, newlines, `\xa0`, `
` and `ſ`. Over 1.4M
generated inputs, from short lines up to about 60 fragments, the output was
byte-identical to `main` in every case.
**Local checks**
- Spark provider tests: 282 passed, 2 skipped (system tests)
- ruff, mypy and the pre-commit prek hooks: clean. I skipped the
breeze-based `check-provider-yaml-valid` because breeze isn't installed
locally; `provider.yaml` is untouched.
---
Drafted-by: Claude Code (Opus 5.5); reviewed by @divyanshus2404 before
posting
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]