Skip to content

Strips newlines from AWS host/username secrets#842

Open
abdulazeem-tk4vr wants to merge 2 commits into
redhat-developer:mainfrom
abdulazeem-tk4vr:fix/tkn-sanitize-host-username-only
Open

Strips newlines from AWS host/username secrets#842
abdulazeem-tk4vr wants to merge 2 commits into
redhat-developer:mainfrom
abdulazeem-tk4vr:fix/tkn-sanitize-host-username-only

Conversation

@abdulazeem-tk4vr

@abdulazeem-tk4vr abdulazeem-tk4vr commented Jun 17, 2026

Copy link
Copy Markdown

Ensures that host and username values extracted from files for AWS host-access secrets are properly sanitized.

Previously, these values could include newline or carriage return characters, leading to incorrect base64 encoding and potential issues when creating Kubernetes Opaque secrets. Adding tr -d '\n\r' removes these characters, ensuring the secret data is clean and valid.

This PR helps close the issue in redhat-developer/mapt - #817

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

All ten Tekton Task YAML files (five templates under tkn/template/ and five rendered files under tkn/) are updated so that the host-info-secret step pipes file contents through tr -d '\n\r' before base64 -w0 when encoding host, username, and airgap bastion fields into the generated Kubernetes Secret.

Changes

host-info Secret Newline Sanitization

Layer / File(s) Summary
Template files: newline stripping before base64
tkn/template/infra-aws-fedora.yaml, tkn/template/infra-aws-mac.yaml, tkn/template/infra-aws-rhel-ai.yaml, tkn/template/infra-aws-rhel.yaml, tkn/template/infra-aws-windows-server.yaml
host-info-secret script now pipes host, username, and (per-template) id_rsa, bastion-host, bastion-username through tr -d '\n\r' before base64 -w0 in all five task templates.
Rendered task files: same change applied
tkn/infra-aws-fedora.yaml, tkn/infra-aws-mac.yaml, tkn/infra-aws-rhel-ai.yaml, tkn/infra-aws-rhel.yaml, tkn/infra-aws-windows-server.yaml
Identical newline-stripping update applied to the five rendered task files to keep them in sync with their templates.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding newline/carriage-return stripping to AWS host/username secrets across multiple YAML files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The pull request description accurately describes the changes being made across multiple YAML files to sanitize host and username values by stripping newline/carriage-return characters before base64 encoding.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@abdulazeem-tk4vr abdulazeem-tk4vr marked this pull request as ready for review June 17, 2026 22:18
This test ensures `tr -d '\n\r'` is correctly applied to host and username fields, but *not* to `id_rsa`, within AWS host-access secret templates. This prevents malformed private keys while ensuring host/username values are single-line.
@adrianriobo

adrianriobo commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

thx @abdulazeem-tk4vr for the contribution, can you check the failure it needs to catch the error I think, also can you extend the fix to all tekton tasks not only aws?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants