Repository navigation
fix(security): harden TLS verification, streaming, redaction, and routing guards - #174
Draft
skupriienko wants to merge 1 commit into
Draft
skupriienko wants to merge 1 commit into
skupriienko wants to merge 1 commit into
Conversation
This was referenced Nov 15, 2026
skupriienko
marked this pull request as draft
November 15, 2026 16:00
This branch has not been deployed
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.
Stack (v1.9.2 Hardening Rollout)
master<-wave-1-tooling-hygieneCRIT-03,CRIT-04,CRIT-05,HIGH-06wave-1-tooling-hygiene<-wave-2-transport-redactionCRIT-01,CRIT-02,HIGH-01(lock),HIGH-02,HIGH-03,HIGH-04(path),OPT-09wave-2-transport-redaction<-wave-3-boot-slots-poolingOPT-01..OPT-07,OPT-10,OPT-11,HIGH-01(warn_unclosed)wave-3-boot-slots-pooling<-wave-4-builders-semverHIGH-04(bool/stream),HIGH-05,HIGH-07,OPT-08wave-4-builders-semver<-wave-5-typing-stateful-testsMOD-02,MOD-04Merge in order: #173 -> #174 -> #175 -> #176 -> #177.
Note
Stacked PR workflow note:
ClusterFuzzLite PR fuzzingruns immediately on all PRs. Workflows scoped tobranches: [master](CI,PR Validation,Continuous Security Verification,CodeQL) trigger automatically after #173 merges intomasterand GitHub retargets this PR's base branch tomaster.Summary
Wave 2 of 5 for
v1.9.2(stacked on #173 /wave-1-tooling-hygiene). Hardens TLS verification with enterprise custom CA bundle support, blocks HTTP redirect credential leakage (allow_redirects=False+ fail-closed3xxhandling), secures attachment streaming against symlink/FIFO/TOCTOU hazards (O_NOFOLLOW+os.fstat), redacts formatted tracebacks (record.exc_text), adds thread-safe session initialization, and enforces complete builder and path-segment mediation throughSecurityGuard.Actions
mailjet_rest/client.py,mailjet_rest/config.py,CRIT-01,HIGH-01,HIGH-02,OPT-09):verify=Falseandverify=NonewithValueError+sys.auditevents while validating custom CA bundle file and directory paths (CRIT-01).allow_redirects=Falseexplicitly on transport calls and failed closed on3xxredirect responses withsys.audittelemetry (CRIT-01).status_codeandresponse_bodyon5xxerror responses (HIGH-02), added double-checked_session_lockinitialization (HIGH-01), and pre-computedSecretAuthBasic headers (OPT-09).mailjet_rest/utils/guardrails.py,mailjet_rest/builders.py,CRIT-02,HIGH-03,HIGH-04):/tmpearly-return bypass inSecurityGuard.validate_attachment_pathand opened validated paths inChunkedStreamer.encode_fileviaos.O_NOFOLLOW+os.fstatS_ISREGand byte-cap checks (CRIT-02).?and#query/fragment delimiters inSecurityGuard.sanitize_segment, scrubbedrecord.exc_text, and added__tracebackhide__ = Truearound auth validation (HIGH-03).MessageBuilder.set_sender()throughSecurityGuard.normalize_domain()andMessageBuilder.set_headers()throughSecurityGuard.sanitize_headers()(HIGH-04).mailjet_rest/endpoint.py,mailjet_rest/types.py,tests/unit/test_wave2_security.py):stacklevelinEndpointand added unit tests covering TLS verification, custom CAs, redirects,O_NOFOLLOW/ FIFO attachment guards,exc_textredaction, and concurrent session setup.Verification & Testing
v1.9.2stack:ruff check .,ruff format --check .,mypy --strict mailjet_rest,pyright mailjet_rest,slotscheck -m mailjet_rest,bandit -c pyproject.toml -r mailjet_rest, andpytest -n auto -W error tests/unit tests/property tests/regression(includingtests/unit/test_wave2_security.py).pytest -m network,samples/smoke_readme_runner.py) were skipped locally due to absentMJ_APIKEY_PUBLIC/MJ_APIKEY_PRIVATEcredentials.