Repository navigation
The CI-checks clause is served and stored without its credentials - #198
Merged
Merged
Conversation
…ssword masked redact_table_function masked quoted literals from the fourth on, so the db.table, bare-identifier, view(...) and named-collection forms of remote/remoteSecure kept their password; it now masks by argument position after the table. tracker.test_signal's source and loom.qa_rollup_days.source read the clause through the same masking (checks_source_label) instead of the raw checks_config value. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
A table function other than remote, a subquery and a malformed call now have every quoted literal masked, including an unterminated one; any call as remote's second argument is one table argument. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…table argument, is served masked Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…comments Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…all's address and table Masking by argument position kept missing SQL syntax (comments, quoted names, bare key = value values); the label now shows only parts that cannot hold a credential and names any other clause by its function. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…hat is no call Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…tion name, under test Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
… trailing ... Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
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.
Changelog category (leave one):
Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):
tracker.test_signal'ssource, thesourcecolumn ofloom.qa_rollup_daysandloom tracker-probeshow the CI-checks clause without its credentials: a table name as is, aremote/remoteSecurecall as its address and table (with...for any arguments after it), and any other clause as its function name.Why
Two leaks of the same credential, the password inside a checks FROM clause (
LOOM_TRACKER_CHECKS_FROMor a source entry'schecks.from):redact_table_function("remoteSecure('h:9440', default.checks, 'play', 'secret')")returned its input. The same held for baredb, tableidentifiers, for theview(...)form, and for a named collection'spassword = '...'.loom tracker-probeprints the clause through this function.tracker.test_signal(VIEWER) returned the raw clause insource, and the daily rollup worker stored it inloom.qa_rollup_days.source. Neither went through the redactor.Pattern: credential masking keyed on the position of a quoted literal, and a credential-bearing setting served and stored without the masking that exists for it.
Fix:
redact_table_functionbuilds the label from parts that cannot hold a credential, so it fails closed instead of masking text it would have to parse. A table name comes back as is. Aremote/remoteSecurecall whose address and table match a strict pattern comes back asfn('address', table, ...). The table isdb.tableordb, table, quoted or bare, and every argument after it (the user, the password, a sharding key) reads.... Any other clause comes back as its function name,fn(...), or as(...). That covers aview(...)table argument, a named collection, another table function, a subquery and a malformed call. Masking by argument position missed each new piece of SQL syntax in turn (heredocs, quoted names,#and nested comments, barekey = valuevalues), so this PR drops it. A newchecks_source_label(org, namespace)returns the label, and both the op and the worker use it. The reads keep callingchecks_config, which still returns the full clause because the statement needs it.The two fixes are separate in code. They ship together because they close the same leak: an unmasked credential in a source string that Loom serves or stores.
Scope and risk
Touches only the label: what callers read and what the ledger stores. The FROM clause of the reads is unchanged. The label of a clause that is not a plain remote call is less detailed than before (
view(...)and named-collection calls show only the function name). That is the cost of never printing text the code does not recognise. Two surfaces outside the tracker plane are left alone. The settings listing (loom settings,repr(settings)) still printstracker_checks_fromandtracker_sources_jsonas configured. Marking either one secret would also refuse it in a settings file, which is a separate change with its own compatibility break. The other is ClickHouse error text thattracker.test_signalserves when a checks read fails, which may quote part of a malformed clause. Both go to a follow-up.Compatibility, rollout and rollback
tracker.test_signal.sourcekeeps its type and now holds the label above. Its field description (anddocs/reference/operations/tracker.md, regenerated) says so. No op or field is added or removed.loom.qa_rollup_dayskeep the clause they were written with. A final day is never rolled again, so those rows are not rewritten. Replicas still on the previous build keep writing the unmasked clause during the rolling upgrade, and today's partial day is rewritten on every pass. A deployment whose checks clause carried a password should rotate it. To clear the stored copies, run this after every replica is on this build:ALTER TABLE loom.qa_rollup_days UPDATE source = '' WHERE rolled_at < '<when the last replica moved to this build>' AND position(source, '(') > 0. The time bound keeps this build's labels, including one cut at 200 characters. The statement names no secret, sosystem.query_logandsystem.mutationshold none.Tests
tests/unit/test_qa_intel_client.py::test_the_checks_clause_label_is_built_from_parts_without_a_credential: the exact label for twenty-one clauses. They include a table name, eachremoteform (quoted, bare,db.table, a sharding key, a heredoc credential, a#comment with an apostrophe, a trailingJOIN), aview(...)argument, a named collection with bare values,mysql,s3, an unterminated heredoc and a subquery. Before the fix, eleven of the seventeen clauses that are not table names leaked a user or a password. The other six carry no credential, or had it in the fourth quoted literal or later.tests/unit/test_tracker_test_signal.py::test_the_served_source_carries_no_checks_password: the op'ssourcewith a password configured. Failed before the fix.tests/unit/test_tracker_test_daily.py::test_the_ledger_stores_the_checks_source_without_its_password: the worker's ledger rows. Failed before the fix.make format lint typecheck. The tracker unit tests pass. The full unit suite passes excepttest_document_extraction.py::test_the_wide_integer_check_is_linear_in_a_deep_table_of_long_keys, a wall-clock check that also fails on main.same_key/test_retirement_ch.py(two),test_memory_inspect.py::test_inspect_splits_own_from_others_and_changes_nothingandtest_search_statements_pass_analyzer.py::test_patch_part_probe_and_reemit_reads_pass_the_analyzer.AI assistance in the code (leave one; writing this description with AI is fine):
AI-generated (an agent wrote most of the diff): Claude Code. Checked each failing case against the code before the fix and confirmed the tests failed for that reason.
I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
make format-check,make lint,make typecheckandmake test-unitpass; the integration suite passes if server behaviour changed.main; no merged migration is edited. (none)frontend/changed. (unchanged)docs/describe the system as it now is, and this description names any operator steps and wire changes.git commit -s), as CONTRIBUTING.md asks.🤖 Generated with Claude Code