Skip to content

Commit

Permalink
Hiding all env vars, starting with "SECRET_"; #10
Browse files Browse the repository at this point in the history
  • Loading branch information
phax committed Aug 4, 2021
1 parent 4b073c0 commit 41c04f0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public class BasePageSysInfoEnvironmentVariables <WPECTYPE extends IWebPageExecu
protected enum EText implements IHasDisplayText
{
MSG_NAME ("Name", "Name"),
MSG_VALUE ("Wert", "Value");
MSG_VALUE ("Wert", "Value"),
MSG_HIDDEN_VALUE ("*versteckt*", "*hidden*");

private final IMultilingualText m_aTP;

Expand Down Expand Up @@ -104,9 +105,16 @@ protected void fillContent (@Nonnull final WPECTYPE aWPEC)
// For all environment variables
for (final Map.Entry <String, String> aEntry : System.getenv ().entrySet ())
{
final String sName = aEntry.getKey ();
final String sNameLC = sName.toLowerCase (Locale.ROOT);
final String sValue = aEntry.getValue ();

final HCRow aRow = aTable.addBodyRow ();
aRow.addCell (aEntry.getKey ());
aRow.addCell (aEntry.getValue ());
aRow.addCell (sName);
if (sNameLC.startsWith ("secret_"))
aRow.addCell (EText.MSG_HIDDEN_VALUE.getDisplayText (aDisplayLocale));
else
aRow.addCell (sValue);
}
aNodeList.addChild (aTable);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public class BasePageSysInfoEnvironmentVariables <WPECTYPE extends IWebPageExecu
protected enum EText implements IHasDisplayText
{
MSG_NAME ("Name", "Name"),
MSG_VALUE ("Wert", "Value");
MSG_VALUE ("Wert", "Value"),
MSG_HIDDEN_VALUE ("*versteckt*", "*hidden*");

private final IMultilingualText m_aTP;

Expand Down Expand Up @@ -104,9 +105,16 @@ protected void fillContent (@Nonnull final WPECTYPE aWPEC)
// For all environment variables
for (final Map.Entry <String, String> aEntry : System.getenv ().entrySet ())
{
final String sName = aEntry.getKey ();
final String sNameLC = sName.toLowerCase (Locale.ROOT);
final String sValue = aEntry.getValue ();

final HCRow aRow = aTable.addBodyRow ();
aRow.addCell (aEntry.getKey ());
aRow.addCell (aEntry.getValue ());
aRow.addCell (sName);
if (sNameLC.startsWith ("secret_"))
aRow.addCell (EText.MSG_HIDDEN_VALUE.getDisplayText (aDisplayLocale));
else
aRow.addCell (sValue);
}
aNodeList.addChild (aTable);

Expand Down

0 comments on commit 41c04f0

Please sign in to comment.