Skip to content

Commit bcb0183

Browse files
Marius Postaalafanechere
authored andcommitted
airbyte-ci: override secrets scrubbing in very few cases (airbytehq#34555)
Co-authored-by: Augustin <[email protected]>
1 parent 3390885 commit bcb0183

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

airbyte-ci/connectors/pipelines/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,8 +578,9 @@ E.G.: running `pytest` on a specific test folder:
578578

579579
| Version | PR | Description |
580580
| ------- | ---------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
581+
| 3.7.2 | [#34555](https://github.com/airbytehq/airbyte/pull/34555) | Override secret masking in some very specific special cases. |
581582
| 3.7.1 | [#34441](https://github.com/airbytehq/airbyte/pull/34441) | Support masked secret scrubbing for java CDK v0.15+ |
582-
| 3.7.0 | [#34343](https://github.com/airbytehq/airbyte/pull/34343) | allow running connector upgrade_cdk for java connectors |
583+
| 3.7.0 | [#34343](https://github.com/airbytehq/airbyte/pull/34343) | allow running connector upgrade_cdk for java connectors |
583584
| 3.6.1 | [#34490](https://github.com/airbytehq/airbyte/pull/34490) | Fix inconsistent dagger log path typing |
584585
| 3.6.0 | [#34111](https://github.com/airbytehq/airbyte/pull/34111) | Add python registry publishing |
585586
| 3.5.3 | [#34339](https://github.com/airbytehq/airbyte/pull/34339) | only do minimal changes on a connector version_bump |

airbyte-ci/connectors/pipelines/pipelines/dagger/actions/secrets.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,28 @@
1919
from pipelines.airbyte_ci.connectors.context import ConnectorContext
2020

2121

22-
async def get_secrets_to_mask(ci_credentials_with_downloaded_secrets: Container) -> list[str]:
22+
# List of overrides for the secrets masking logic.
23+
# These keywords may have been marked as secrets, perhaps somewhat aggressively.
24+
# Masking them, however, is annoying and pointless.
25+
# This list should be extended (carefully) as needed.
26+
NOT_REALLY_SECRETS = {
27+
"admin",
28+
"airbyte",
29+
"host",
30+
}
31+
32+
33+
async def get_secrets_to_mask(ci_credentials_with_downloaded_secrets: Container, connector_technical_name: str) -> list[str]:
2334
"""This function will print the secrets to mask in the GitHub actions logs with the ::add-mask:: prefix.
2435
We're not doing it directly from the ci_credentials tool because its stdout is wrapped around the dagger logger,
2536
And GHA will only interpret lines starting with ::add-mask:: as secrets to mask.
2637
"""
2738
secrets_to_mask = []
2839
if secrets_to_mask_file := await get_file_contents(ci_credentials_with_downloaded_secrets, "/tmp/secrets_to_mask.txt"):
2940
for secret_to_mask in secrets_to_mask_file.splitlines():
41+
if secret_to_mask in NOT_REALLY_SECRETS or secret_to_mask in connector_technical_name:
42+
# Don't mask secrets which are also common words or connector name.
43+
continue
3044
# We print directly to stdout because the GHA runner will mask only if the log line starts with "::add-mask::"
3145
# If we use the dagger logger, or context logger, the log line will start with other stuff and will not be masked
3246
print(f"::add-mask::{secret_to_mask}")
@@ -59,7 +73,7 @@ async def download(context: ConnectorContext, gcp_gsm_env_variable_name: str = "
5973
)
6074
# We don't want to print secrets in the logs when running locally.
6175
if context.is_ci:
62-
context.secrets_to_mask = await get_secrets_to_mask(with_downloaded_secrets)
76+
context.secrets_to_mask = await get_secrets_to_mask(with_downloaded_secrets, context.connector.technical_name)
6377
connector_secrets = {}
6478
for secret_file in await with_downloaded_secrets.directory(secrets_path).entries():
6579
secret_plaintext = await with_downloaded_secrets.directory(secrets_path).file(secret_file).contents()

airbyte-ci/connectors/pipelines/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
44

55
[tool.poetry]
66
name = "pipelines"
7-
version = "3.7.1"
7+
version = "3.7.2"
88
description = "Packaged maintained by the connector operations team to perform CI for connectors' pipelines"
99
authors = ["Airbyte <[email protected]>"]
1010

0 commit comments

Comments
 (0)