lens icon indicating copy to clipboard operation
lens copied to clipboard

Error when reveal Environment secret in pod Side panel

Open anieo opened this issue 2 years ago • 5 comments

Describe the bug revealing a secret from secret key with a special character from the pod side panel To Reproduce Steps to reproduce the behavior:

  1. Go to 'pod side panel'
  2. Click on 'reveal environment secret'
  3. See error

Expected behavior should show the secret value in the side panel in the environment section

Environment (please complete the following information):

  • Lens Version: 5.3.3-latest.20211223.1
  • OS: ubuntu 22.04
  • Installation method (e.g. snap or AppImage in Linux): image

Logs: When you run the application executable from command line you will see some logging output. Please paste them here:

Component stack:


    at SecretKey (http://8446f41323f9ab89b6ca835e6d43bb45.localhost:44459/build/Lens.js:245651:53)
    at div
    at span
    at div
    at drawer_item_DrawerItem (http://8446f41323f9ab89b6ca835e6d43bb45.localhost:44459/build/Lens.js:135309:1)
    at wrappedComponent (http://8446f41323f9ab89b6ca835e6d43bb45.localhost:44459/build/Lens.js:10557:16)
    at div
    at PodDetailsContainer (http://8446f41323f9ab89b6ca835e6d43bb45.localhost:44459/build/Lens.js:246049:49)
    at div
    at PodDetails (http://8446f41323f9ab89b6ca835e6d43bb45.localhost:44459/build/Lens.js:246318:9)
    at div
    at div
    at div
    at Animate (http://8446f41323f9ab89b6ca835e6d43bb45.localhost:44459/build/Lens.js:148838:9)
    at drawer_Drawer (http://8446f41323f9ab89b6ca835e6d43bb45.localhost:44459/build/Lens.js:14247:9)
    at KubeObjectDetails (http://8446f41323f9ab89b6ca835e6d43bb45.localhost:44459/build/Lens.js:289281:9)
    at ErrorBoundary (http://8446f41323f9ab89b6ca835e6d43bb45.localhost:44459/build/Lens.js:237976:9)
    at Router (http://8446f41323f9ab89b6ca835e6d43bb45.localhost:44459/build/Lens.js:79057:30)
    at ClusterFrame (http://8446f41323f9ab89b6ca835e6d43bb45.localhost:44459/build/chunks/5.js:7941:9)
    at ThemeProvider (http://8446f41323f9ab89b6ca835e6d43bb45.localhost:44459/build/Lens.js:609784:24)
Error stack:

Error: Malformed UTF-8 data
    at Object.stringify (http://8446f41323f9ab89b6ca835e6d43bb45.localhost:44459/build/Lens.js:76677:24)
    at Object.toString (http://8446f41323f9ab89b6ca835e6d43bb45.localhost:44459/build/Lens.js:76432:38)
    at Module.decode (http://8446f41323f9ab89b6ca835e6d43bb45.localhost:44459/build/Lens.js:24904:38)
    at SecretKey (http://8446f41323f9ab89b6ca835e6d43bb45.localhost:44459/build/Lens.js:245662:102)
    at Ch (http://8446f41323f9ab89b6ca835e6d43bb45.localhost:44459/build/Lens.js:556372:137)
    at li (http://8446f41323f9ab89b6ca835e6d43bb45.localhost:44459/build/Lens.js:556395:154)
    at ck (http://8446f41323f9ab89b6ca835e6d43bb45.localhost:44459/build/Lens.js:556484:343)
    at bk (http://8446f41323f9ab89b6ca835e6d43bb45.localhost:44459/build/Lens.js:556465:347)
    at ak (http://8446f41323f9ab89b6ca835e6d43bb45.localhost:44459/build/Lens.js:556465:278)
    at Tj (http://8446f41323f9ab89b6ca835e6d43bb45.localhost:44459/build/Lens.js:556465:138)
    at Lj (http://8446f41323f9ab89b6ca835e6d43bb45.localhost:44459/build/Lens.js:556458:163)
    at http://8446f41323f9ab89b6ca835e6d43bb45.localhost:44459/build/Lens.js:556338:115
    at exports.unstable_runWithPriority (http://8446f41323f9ab89b6ca835e6d43bb45.localhost:44459/build/Lens.js:556549:343)
    at gg (http://8446f41323f9ab89b6ca835e6d43bb45.localhost:44459/build/Lens.js:556337:325)
    at jg (http://8446f41323f9ab89b6ca835e6d43bb45.localhost:44459/build/Lens.js:556338:61)
    at ig (http://8446f41323f9ab89b6ca835e6d43bb45.localhost:44459/build/Lens.js:556337:428)

secret: 8a7adbW+VCWSpSIF and I am sure the secret exists in the same namespace

anieo avatar Jun 22 '22 00:06 anieo

By special character what do you mean? An emoji or just that the string is not-"UTF-8" encoded?

Nokel81 avatar Jun 22 '22 14:06 Nokel81

this is the value that failed 8a7adbW+VCWSpSIF my guess is that it is a + problem but I can't be sure as I can't change the secret of the running application to test

anieo avatar Jun 22 '22 14:06 anieo

No that value is correctly encoded Base64 value, it is just that the source of that value is not utf-8 encoded data

Nokel81 avatar Jun 22 '22 14:06 Nokel81

@anieo Running that value through base64 --decode I get a trailing value which is probably why it is throwing.

I guess my question to you is, what do you want to display?

Nokel81 avatar Jun 22 '22 16:06 Nokel81

@Nokel81 the decoded value is 8a7adbW+VCWSpSIF and was supposed to be displayed in the pod's container's environment variable sections as its value was a secretKeyRef to mysql-secrets.root-password with the decoded value of 8a7adbW+VCWSpSIF the encoded value would be OGE3YWRiVytWQ1dTcFNJRgo=

anieo avatar Jun 23 '22 14:06 anieo