Commit 8648a53
fix(jwt-authenticator): handle PEM private keys with escaped newlines
Fixes an issue where JWT authentication fails when PEM-formatted private keys
contain escaped newlines (\n) instead of actual newline characters. This
commonly occurs when keys are stored in configuration systems like Airbyte Cloud.
The fix adds normalization logic in JwtAuthenticator._get_secret_key() that:
- Detects PEM-style keys (containing '-----BEGIN' and 'KEY-----')
- Converts escaped newlines to actual newlines before JWT signing
- Is guarded to only affect PEM keys, leaving other secret types unchanged
This resolves the same issue fixed for the Okta connector in airbytehq/airbyte#69831,
but at the CDK level so all declarative/Builder connectors using JWT authentication
with private keys benefit from the fix.
Includes a unit test that verifies JWT signing works with escaped newlines.
Co-Authored-By: [email protected] <[email protected]>1 parent 80b7668 commit 8648a53
File tree
2 files changed
+47
-0
lines changed- airbyte_cdk/sources/declarative/auth
- unit_tests/sources/declarative/auth
2 files changed
+47
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
186 | 191 | | |
187 | 192 | | |
188 | 193 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
392 | 392 | | |
393 | 393 | | |
394 | 394 | | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
0 commit comments