Skip to content

Commit

Permalink
fix: ensure secrets are base64-encoded string (#533)
Browse files Browse the repository at this point in the history
  • Loading branch information
iromli authored Mar 28, 2023
1 parent ffccc0a commit cca808b
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ data:
tls_generator.py: |-
from kubernetes import config, client
import logging
import base64
from pygluu.containerlib import get_manager
Expand Down Expand Up @@ -298,11 +299,20 @@ data:
:return: ssl cert and key (if any)
"""
def b64encode(value):
return base64.b64encode(value.encode()).decode()
manager = get_manager()
# returns empty string if not found
ssl_cert = manager.secret.get("ssl_cert")
if ssl_cert:
ssl_cert = b64encode(ssl_cert)
# returns empty string if not found
ssl_key = manager.secret.get("ssl_key")
if ssl_key:
ssl_key = b64encode(ssl_key)
return ssl_cert, ssl_key
Expand Down

0 comments on commit cca808b

Please sign in to comment.