Bug 1879638

Summary: Binary file uploaded to a secret in OCP 4 GUI is not properly converted to Base64-encoded string
Product: OpenShift Container Platform Reporter: Rejeeb <rabdulra>
Component: Management ConsoleAssignee: Joe Caiani <jcaiani>
Status: CLOSED ERRATA QA Contact: Siva Reddy <schituku>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.6CC: akretzsc, andbartl, aos-bugs, arghosh, aygarg, jcaiani, jhadvig, jokerman, ngirard, spadgett, yapei
Target Milestone: ---   
Target Release: 4.8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: after 4.x we stopped supporting bin files for secrets Consequence: in 4.8 we've added this ability back to the console Fix: support binary files for secret values Result:
Story Points: ---
Clone Of:
: 1939553 (view as bug list) Environment:
Last Closed: 2021-07-27 22:33:27 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1939553    
Attachments:
Description Flags
OriginalSecret
none
binary file
none
yaml output none

Description Rejeeb 2020-09-16 17:23:35 UTC
Description of problem:
A binary file when uploaded to a secret via OCP 4.x GUI, it is not properly converted to a Base64-encoded string. Whereas in OCP 3.11 GUI/CLI, had verified that when a secret value contains non-printable characters, it is converted properly as a Base64-encoded string.

Version-Release number of selected component (if applicable):
4.6

How reproducible:
100%

Steps to Reproduce:
1. Login to the GUI and create a generic key value secret using a binary file.
2. Now create a generic key value secret using the same binary file through CLI.

Actual results:
Secrets created using same binary files are providing different Base64-encoded string.

Expected results:
Both CLI and GUI should provide correct Base64-encoded string for a secret based on a binary file.

Comment 2 Samuel Padgett 2020-09-17 14:09:45 UTC
I believe the underlying issue that we read the file as text, which won't work for binary files: `reader.readAsText(file, 'UTF-8')`

https://github.com/spadgett/console/blob/3c1e88824e28cff26a472a95041f4c892f01b042/frontend/public/components/utils/file-input.tsx#L39

Comment 3 Jakub Hadvig 2020-10-02 15:27:52 UTC
In the middle of the fixing process. Will fix next sprint.

Comment 4 Jakub Hadvig 2020-10-23 13:19:57 UTC
Still working on this issue.

Comment 5 akretzsc 2020-11-05 19:25:53 UTC
Jakub,

Do you have any update to share on this bug please?

Comment 6 Jakub Hadvig 2020-11-13 10:30:15 UTC
Hey Alex,
we are still working on this issue. To be honest we have't got time to address it yet since we are on feature work.
But Im confident it will get solved this sprint.

Comment 7 Joe Caiani 2020-12-04 20:38:04 UTC
pr is up for review, will complete in upcoming sprint

Comment 12 Siva Reddy 2021-03-16 22:38:45 UTC
Created attachment 1763852 [details]
OriginalSecret

Comment 13 Siva Reddy 2021-03-16 22:39:11 UTC
Created attachment 1763853 [details]
binary file

Comment 14 Siva Reddy 2021-03-16 22:39:40 UTC
Created attachment 1763854 [details]
yaml output

Comment 16 Siva Reddy 2021-03-24 04:47:19 UTC
retested using correct binary file and it works as intended.
  hence moving to verified.

Comment 25 errata-xmlrpc 2021-07-27 22:33:27 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: OpenShift Container Platform 4.8.2 bug fix and security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2021:2438