Repository navigation
[TH-9491] fix: keep URL credentials in an agent's description out of what the kit sends and stores - #278
Merged
khushalsonawat merged 8 commits intoNov 11, 2026
Conversation
…efore the platform (TH-9491) These fail until the fix lands. Refs: TH-9491 Signed-off-by: khushalsonawat <khushalsonawat@gmail.com>
…hat the kit sends and stores (TH-9491) The kit writes an agent's prompt, rules, summary and notes in its own words. That text can hold a web address with a password or key in it, and until now it reached the platform as written. After this change, every web address in that text loses its username, password, query and fragment wherever the kit saves or sends it. - providers/agent.py: _redact also cleans addresses inside prose. Every :// starts an address, and an address runs to the next whitespace, so no guessed end can leave a key behind. - contract.py: one writer for contract.json. Each description field is marked as free text, which is cleaned, or technical, which is kept as written. A test fails if a field is unmarked, or if a module writes contract.json without going through the writer. - Send-time guards re-clean before each send, for descriptions saved by older versions: the provision payload (_chosen_evals_and_prompt), the suite evals' agent_prompt, the judge's instructions, the live run view, the grade calls, emit_model_event, and cli._render's stdout. - hosted_chat_entrypoint.py: the hosted builder's chat events are cleaned, covering the streamed deltas, assistant_message, tool_result, artifact paths and the question prompt. Deltas go through a bounded holdback: text since the last whitespace is held; past 4,096 characters, everything before the last address start is sent; past 16,384, the address becomes [redacted]. amend's rule echo and cli's authoring drain are cleaned too. Known limits, each owned elsewhere: - traces: TH-9504. - bare keys, path tokens, file contents, whitespace inside a password, and an address broken by a line break or tab in a sentence: TH-9500. - the builder's transcript mirror, coordinator_state, remember notes and request_adjustment: TH-9532. - the model's files in the workspace checkpoint archive: TH-9521. Reviewed in three plan rounds and three change rounds, followed by a fix-only check by two fresh reviewers, as the Coordinator ruled after round 3. Both reviewers were CLEAR, and their Mediums are fixed here. Refs: TH-9491 Signed-off-by: khushalsonawat <khushalsonawat@gmail.com>
Signed-off-by: khushalsonawat <khushalsonawat@gmail.com>
TH-9491's redaction property tests in tests/providers/test_providers_agent_build.py import hypothesis, which the clean-install job did not install, so collection failed. Install it at the dev group's minimum, the same pin as pyproject.toml. Refs: TH-9491 Signed-off-by: khushalsonawat <khushalsonawat@gmail.com>
This was referenced Nov 10, 2026
Signed-off-by: khushalsonawat <khushalsonawat@gmail.com>
cdileep23
requested changes
Nov 11, 2026
… into TH-9491 - tools.py: _save_contract keeps the single writer (write_contract) and takes #268's new reply text, which names unconfirmed prompt lines. - contract.py: #268's new fields, unconfirmed_prompt_from and model (ModelSource), are marked as kept as written: they hold source lines and the cited model name, read by the build. The test that fails on an unmarked field caught them. Signed-off-by: khushalsonawat <khushalsonawat@gmail.com>
khushalsonawat
added a commit
that referenced
this pull request
Nov 11, 2026
…288) into TH-9491 - tests/test_harness_sandbox_server.py: both sides appended tests; kept both. - test_contract_writer's allow-list gains #269's two contract.json copies: reading_result.document's replace_if_unchanged (the saved contract's own bytes plus the reading record) and seed_contract.use_seed's _write_whole (the platform's seed, as written). - sandbox_server.py imports SecretResolutionError, which #284's resolver raises but the base never imports: seven sandbox-server tests fail with NameError on the base itself. Signed-off-by: khushalsonawat <khushalsonawat@gmail.com>
khushalsonawat
merged commit Nov 11, 2026
8bb5d39
into
feat/TH-8804-source-subfolder
11 checks passed
1 task done
khushalsonawat
added a commit
that referenced
this pull request
Nov 11, 2026
…ture too A message can carry a tool's input dumped as a JSON string inside JSON; cleaned as text, a URL with a query in it would take the rest of the string. Raised by Ash from #278's review. TH-9504 Signed-off-by: khushalsonawat <khushalsonawat@gmail.com>
khushalsonawat
added a commit
that referenced
this pull request
Nov 11, 2026
[TH-9491] docs: answer Dileep's review of #278
2 tasks done
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.
Description
When the kit reads an agent, it writes the agent's prompt, rules, summary and notes in its own words. That text can hold a web address with a password or key in it, such as
https://bot:hunter2@hooks.example/v1?key=sk-1. Until now it reached the platform as written: in the provision payload, the suite evals, the judge's instructions, the stored reading and the hosted builder's chat.After this change, every web address in that text loses its username, password, query and fragment wherever the kit saves or sends it.
Stacked on #271: this branch merges #271's head
53f06233, so that commit shows here until #271 lands.Type of Change
Changes
providers/agent.py,_redact: now also cleans addresses inside prose. It is still one cleaner, not a second one.://starts an address, even after a digit, dot or dash (1.https://…,-https://…,${SCHEME}://…).harness/contract.py, one writer forcontract.json: every writer goes through it, and it cleans the free text first. That covers the reading, the builder, the rule and tool amendments, and the repair steps.contract.jsonwithout the writer._chosen_evals_and_prompt, the provision payload;run/grade.py, the suite evals'agent_promptand the grade calls;hosted_entrypoint._agent_instructions, the judge;emit_model_event;cli._render's stdout.harness/hosted_chat_entrypoint.py, the hosted builder's chat:tool_result, the artifact paths, the question prompt and its options, and everyassistant_message, on success, interruption and failure.[redacted];assistant_messageand the end of the turn flush what is held.amend's rule echo andcli's authoring drain.Known limits (each has an owner)
PlatformSessionStore.append),coordinator_state, theremembernotes andrequest_adjustment. TH-9532..futureagi-adk.db,.claude/, the pending-question file and the kept notes. TH-9521.Testing
Each test file was run on its own on the final commit:
test_builder_chattest_contract_writertest_providers_agent_buildtest_hosted_entrypointtest_scenario_source_provision_agenttest_agent_readingtest_judgetest_harness -k suite_evaltest_hosted_conversationtest_contract_tools_subfoldertest_agent_type_refusaltests/providerstest_harness_sandbox_serverThe 2 failures in
test_harness_sandbox_serverare the base's owngithub_commit_sha_requiredfailures, and they fail the same way on the base.After merging the base at
cf3ebb44, the files that overlap it passed again:test_contract_writer43;test_harness_architecture55;test_agent_type_refusal651;test_contract_tools_subfolder180;test_bundle_author_v2323;test_instrumentation_evidence48;test_builder_chat179;test_harness_credentials80.Planted bugs check that the tests catch what they claim. Each was a one-token edit, restored and confirmed by sha256:
Two reviewers each re-ran the leak probes, and both found 0 leaks:
Review history:
Related Issues
Refs: TH-9491