Repository navigation
fix(tests): re-baseline raw-ClientSession ceiling to 13, document new SSRF-pinned carve-out, wire guard into CI (#13041) - #13046
Merged
Merged
Conversation
…fig_declared_provider.py carve-out and enforce guard in CI (#13041)
Contributor
✅ SSOT Configuration Compliance: Passing🎉 No hardcoded values detected that have SSOT config equivalents! |
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.
Thinking Path
test_raw_client_session_ceiling_12992.pywas failing onorigin/Dev_new_gui(13 rawaiohttp.ClientSession(...)sites vs. a recorded ceiling of 12). Re-measured with the test's own AST walker (nevergrep -c— it over/under-counts on string literals) against a tree freshly synced toorigin/Dev_new_guiata2f788889: confirmed 13, same offender list #13041 reported.Investigated each of #13041's three claimed "new, undocumented" offenders individually before touching anything:
agent_loop/search/config_declared_provider.py— genuinely new (added by PR feat(research): topic-based source routing + data-driven search sources (#12625) #13016 / Research agent P3: topic-based source routing + data-driven source definitions #12625) and genuinely undocumented. Read the file: its raw session pins aTCPConnectorviaautobot_shared.security.ssrf_guard.pinned_connector()fresh on every call (config_declared_provider.py:183-187,235) — the same SSRF-pinned-connector shape already carved out foroauth_flow.py/external_importer.py. Pooling it would silently drop the pin and reopen the security(codeql): Server-side request forgery (SSRF) — 4 open code-scanning alert(s) #12278 DNS-rebinding hole. This site must stay raw; it is a legitimate carve-out, not a violation.orchestration/dag_executor.pyandservices/slm_client.py— checked git history of the test file: both were already listed in the module docstring's "custom non-default TLS/SSL context" bullet since batch 8 landed the 12-ceiling (perf(http): pool remaining raw aiohttp.ClientSession sites onto shared client (#12979) #13006). fix(http): raw aiohttp.ClientSession ceiling regressed 12→13 (undocumented offenders, #12992) #13041's claim that these two are new/undocumented is incorrect — onlyconfig_declared_provider.pyis new.So the fix is: raise the ceiling to the measured, correct value (13) and document the one genuinely new carve-out — not convert
config_declared_provider.pyto the pooled client, which would be a security regression.Root cause of why this regressed unnoticed: the guard has never been collected by any CI workflow.
autobot-backend/tests/**only appears inmigration-gate.yml(migrations subdir only) andstartup-import-smoke.yml(onlytest_startup_imports.py); the required "Unit & Integration Tests" check (frontend-test.yml) is entirely frontend. That gap is tracked separately as #10691 (evidence already posted there) — out of scope for a "smallest sound fix" PR to broaden. Within this PR's blast radius, the guard has zero non-stdlib dependencies (ast/pathlibonly, no backend-module imports) andstartup-import-smoke.yml's job already installs the full backend dependency set and is a required check — the natural, low-risk place to add exactly this one test.What Changed
autobot-backend/tests/test_raw_client_session_ceiling_12992.py:MAX_RAW_CLIENT_SESSIONS12 → 13; module docstring's "Remaining raw sites" inventory updated to addagent_loop/search/config_declared_provider.pyunder the SSRF-pinned-connector category with its reasoning and refs (Research agent P3: topic-based source routing + data-driven source definitions #12625/feat(research): topic-based source routing + data-driven search sources (#12625) #13016/fix(http): raw aiohttp.ClientSession ceiling regressed 12→13 (undocumented offenders, #12992) #13041);MAX_RAW_CLIENT_SESSIONS's re-measurement history comment and the module docstring both record the fix(http): raw aiohttp.ClientSession ceiling regressed 12→13 (undocumented offenders, #12992) #13041 investigation, including which of its claimed offenders were already documented..github/workflows/startup-import-smoke.yml: added a second step to the existingstartup-import-smokejob (which already installs the full backend dep set and runs backend pytest, and is a required check) that runstest_raw_client_session_ceiling_12992.py, so a future regression fails CI instead of silently landing again.config_declared_provider.py,dag_executor.py, orslm_client.py— all three stay raw by design.Verification
origin/Dev_new_gui@a2f788889: 13 constructions, offender list matches fix(http): raw aiohttp.ClientSession ceiling regressed 12→13 (undocumented offenders, #12992) #13041 exactly.pytest autobot-backend/tests/test_raw_client_session_ceiling_12992.py -v: 2 passed (walker-sanity + ceiling).MAX_RAW_CLIENT_SESSIONSback to 12 in the working tree and re-ran — reproduced fix(http): raw aiohttp.ClientSession ceiling regressed 12→13 (undocumented offenders, #12992) #13041's exactAssertionError: 13 raw ... exceeding ... 12failure with the same offender list, then reverted to 13. Confirms the ratchet trips at ceiling+1.py_compile/flake8 --max-line-length=120/black --check --line-length=120on the changed test file: all clean.actions/setup-pythonversion), installedrequirements-ci.txt+pytest+ editableautobot_shared(the exact steps the job runs), then ranpytest autobot-backend/tests/test_startup_imports.py autobot-backend/tests/test_raw_client_session_ceiling_12992.pytogether and standalone — the ceiling guard collects and passes cleanly in both cases (2 passed), confirming the new workflow step actually executes the test rather than repeating the "silently never collected" failure mode fix(http): raw aiohttp.ClientSession ceiling regressed 12→13 (undocumented offenders, #12992) #13041 is about.pytestinvocation appended after the existingtest_startup_imports.pystep;test_startup_imports.pyitself was not modified (350/350 passing locally against available deps, same as before this change).Model Used
Sonnet