chore: pyt contract tests for transformations auth - #7239
Open
fracasula wants to merge 7 commits into
Open
Conversation
fracasula
marked this pull request as ready for review
August 3, 2026 08:45
ktgowtham
approved these changes
Aug 4, 2026
ktgowtham
left a comment
Contributor
There was a problem hiding this comment.
test are failing. pl check
Collaborator
Author
@ktgowtham As usual they should pass once we merge the pyt PR (the one with the secret support) and then create a release. Then these tests will pull |
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
See this PR.
Contract tests for how
rudder-pytransformertalks to the config backend: hosted-secretauthentication and redirect responses. Tests only — no production code changes in this repo.
Both behaviours matter to rudder-server specifically because they decide whether a config backend misconfiguration is retryable or terminal. rudder-server aborts any per-event status that is not 200/298, so a terminal answer here means every event for every Python transformation is destroyed with nothing to replay from.
Config backend authentication —
config_backend_auth_test.goPins both variants of pytransformer's
CONFIG_BACKEND_HOSTED_SECRET:Authorizationheader at all. A build sendingBasic Og==(base64 of":") would pass a "does it still work" check against a permissive backend and 401 against a strict one; only looking at the received header separates the two.Basic base64("<secret>:"), on the transformation fetch and the library fetch, and it authenticates against a backend enforcing the real check. The empty password is load-bearing: the config backend rejects any decoded token that doesn't holdexactly one colon.
X-Rudder-Should-Retry+X-Rudder-Error-Reason: config_backend_auth_failed, so events are held rather than aborted. Same for an anonymous fetch against an authenticated backend; a blocked public route (403) reportsconfig_backend_forbiddenso a bad secret and a missed repoint page differently.The mock config backend is a port of
rudder-config-backend, not an invention:RudderKoaBasicAuth(including the exactly-one-colon rule and the non-short-circuiting constant-time comparison),hostedSecretConfig's comma-split/trim/drop-blanks parsing with empty passwords,verifyHostedDataPlaneSecretcollapsing every rejection into one 401, andblockHostedPublicAccess's 403. Provenance is listed file-by-file in the mock's doc comment.TestConfigBackendAuthMockMatchesConfigBackendpins the port itself against cases taken from rudder-config-backend's own suites, and runs without containers — the container tests are only worth their runtime if the thing they authenticate against enforces the real rules.Config backend redirects —
redirects_test.gopytransformer does not follow redirects, so a 3xx from a misconfigured proxy raises
ConfigBackendRedirectError→ 503 + retry headers.TestConfigBackendRedirectIsRetriedNotDroppedis the regression test for the data loss: it holds the config backend broken through a full rudder-server pipeline, asserts nothing is aborted, then repairs it and shows the original events come out the far end transformed. Under the previous terminal behaviour those events were gone. It also asserts the redirect target is never contacted.Running
These need a
rudder-pytransformerimage; build it from that repo withmake build-ecr-latest,then:
go test -v -count 1 -race ./integration_test/pytransformer_contract -timeout=10mLinear Ticket
< Fixes PIPE-3229 >
Security