Skip to content

Commit

Permalink
feat: add mask and no-capture classes to sensitive fields
Browse files Browse the repository at this point in the history
  • Loading branch information
rohan-chaturvedi committed Nov 1, 2023
1 parent b67ac5d commit 1274c04
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 23 deletions.
4 changes: 2 additions & 2 deletions frontend/app/[team]/apps/[app]/members/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ export default function Members({ params }: { params: { team: string; app: strin
minLength={16}
required
autoFocus
className="custom w-full text-zinc-800 font-mono dark:text-white bg-zinc-100 dark:bg-zinc-800 rounded-md"
className="custom w-full text-zinc-800 font-mono dark:text-white bg-zinc-100 dark:bg-zinc-800 rounded-md ph-mask"
/>
<button
className="bg-zinc-100 dark:bg-zinc-800 px-4 text-neutral-500 rounded-md"
Expand Down Expand Up @@ -820,7 +820,7 @@ export default function Members({ params }: { params: { team: string; app: strin
minLength={16}
required
autoFocus
className="custom w-full text-zinc-800 font-mono dark:text-white bg-zinc-100 dark:bg-zinc-800 rounded-md"
className="custom w-full text-zinc-800 font-mono dark:text-white bg-zinc-100 dark:bg-zinc-800 rounded-md ph-mask"
/>
<button
className="bg-zinc-100 dark:bg-zinc-800 px-4 text-neutral-500 rounded-md"
Expand Down
4 changes: 2 additions & 2 deletions frontend/app/[team]/apps/[app]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ export default function Secrets({ params }: { params: { team: string; app: strin
<div className="flex justify-between items-center w-full">
<code
className={clsx(
'break-all whitespace-break-spaces max-w-full',
'break-all whitespace-break-spaces max-w-full ph-mask',
sameAsProd ? 'text-amber-500' : 'text-emerald-500'
)}
>
Expand Down Expand Up @@ -299,7 +299,7 @@ export default function Secrets({ params }: { params: { team: string; app: strin
>
<td
className={clsx(
'px-6 py-3 whitespace-nowrap font-mono text-zinc-800 dark:text-zinc-300 flex items-center gap-2',
'px-6 py-3 whitespace-nowrap font-mono text-zinc-800 dark:text-zinc-300 flex items-center gap-2 ph-no-capture',
open ? 'font-bold' : 'font-medium'
)}
>
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/[team]/apps/[app]/tokens/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export default function Tokens({ params }: { params: { team: string; app: string
</div>
{!appSecret && <RotateAppDialog />}
</div>
<code className="text-xs text-red-500">{appSecret || appSecretPlaceholder}</code>
<code className="text-xs text-red-500 ph-mask">{appSecret || appSecretPlaceholder}</code>
</div>
</div>
)
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/[team]/newdevice/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ export default function NewDevice({ params }: { params: { team: string } }) {
minLength={16}
required
autoFocus
className="custom w-full text-zinc-800 font-mono dark:text-white bg-zinc-100 dark:bg-zinc-800 rounded-md"
className="custom w-full text-zinc-800 font-mono dark:text-white bg-zinc-100 dark:bg-zinc-800 rounded-md ph-mask"
/>
<button
className="bg-zinc-100 dark:bg-zinc-800 px-4 text-neutral-500 rounded-md"
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/[team]/settings/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ const ViewRecoveryDialog = () => {
minLength={16}
required
autoFocus
className="custom w-full text-zinc-800 font-mono dark:text-white bg-zinc-100 dark:bg-zinc-800 rounded-md"
className="custom w-full text-zinc-800 font-mono dark:text-white bg-zinc-100 dark:bg-zinc-800 rounded-md ph-mask"
/>
<button
className="bg-zinc-100 dark:bg-zinc-800 px-4 text-neutral-500 rounded-md"
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/[team]/tokens/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ const CreateUserTokenDialog = (props: { organisationId: string }) => {
)}
</div>
</div>
<code className="text-xs break-all text-blue-500">{userToken}</code>
<code className="text-xs break-all text-blue-500 ph-mask">{userToken}</code>
</div>
</div>
) : (
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/webauth/[requestCode]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ export default function WebAuth({ params }: { params: { requestCode: string } })
minLength={16}
required
autoFocus
className="custom w-full text-zinc-800 font-mono dark:text-white bg-zinc-100 dark:bg-zinc-800 rounded-md"
className="custom w-full text-zinc-800 font-mono dark:text-white bg-zinc-100 dark:bg-zinc-800 rounded-md ph-mask"
/>
<button
className="bg-zinc-100 dark:bg-zinc-800 px-4 text-neutral-500 rounded-md"
Expand Down
2 changes: 1 addition & 1 deletion frontend/components/apps/NewAppDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ export default function NewAppDialog(props: {
type={showPw ? 'text' : 'password'}
minLength={16}
required
className="w-full "
className="w-full ph-mask"
/>
<button
className="absolute inset-y-0 right-4"
Expand Down
4 changes: 3 additions & 1 deletion frontend/components/apps/tokens/SecretTokens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,9 @@ const CreateServiceTokenDialog = (props: { organisationId: string; appId: string
)}
</div>
</div>
<code className="text-xs break-all text-teal-500">{serviceToken}</code>
<code className="text-xs break-all text-teal-500 ph-mask">
{serviceToken}
</code>
</div>
</div>
) : (
Expand Down
2 changes: 1 addition & 1 deletion frontend/components/auth/UnlockKeyringDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export default function UnlockKeyringDialog(props: { organisationId: string }) {
minLength={16}
required
autoFocus
className="custom w-full text-zinc-800 font-mono dark:text-white bg-zinc-100 dark:bg-zinc-800 rounded-md"
className="custom w-full text-zinc-800 font-mono dark:text-white bg-zinc-100 dark:bg-zinc-800 rounded-md ph-mask"
/>
<button
className="bg-zinc-100 dark:bg-zinc-800 px-4 text-neutral-500 rounded-md"
Expand Down
6 changes: 3 additions & 3 deletions frontend/components/environments/SecretPropertyDiffs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const SecretPropertyDiffs = (props: {
{historyItem!.key !== previousItem.key && (
<div className="pl-3 font-mono">
<span className="text-neutral-500 mr-2">KEY:</span>
<s className="bg-red-200 dark:bg-red-950 text-red-500">{previousItem.key}</s>
<s className="bg-red-200 dark:bg-red-950 text-red-500 ph-mask">{previousItem.key}</s>
<span className="bg-emerald-100 dark:bg-emerald-950 text-emerald-500">
{historyItem!.key}
</span>
Expand All @@ -40,7 +40,7 @@ export const SecretPropertyDiffs = (props: {
{historyItem!.value !== previousItem.value && (
<div className="pl-3 font-mono">
<span className="text-neutral-500 mr-2">VALUE:</span>
<s className="bg-red-200 dark:bg-red-950 text-red-500">{previousItem.value}</s>
<s className="bg-red-200 dark:bg-red-950 text-red-500 ph-mask">{previousItem.value}</s>
<span className="bg-emerald-100 dark:bg-emerald-950 text-emerald-500">
{historyItem!.value}
</span>
Expand All @@ -50,7 +50,7 @@ export const SecretPropertyDiffs = (props: {
{historyItem!.comment !== previousItem.comment && (
<div className="pl-3 font-mono">
<span className="text-neutral-500 mr-2">COMMENT:</span>
<s className="bg-red-200 dark:bg-red-950 text-red-500">{previousItem.comment}</s>
<s className="bg-red-200 dark:bg-red-950 text-red-500 ph-mask">{previousItem.comment}</s>
<span className="bg-emerald-100 dark:bg-emerald-950 text-emerald-500">
{historyItem!.comment}
</span>
Expand Down
8 changes: 1 addition & 7 deletions frontend/components/logs/SecretLogs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,6 @@ export default function SecretLogs(props: { app: string }) {
// Decrypt event fields
decryptedEvent!.key = await decryptAsymmetric(event!.key, privateKey, publicKey)

// decryptedEvent!.value = await decryptAsymmetric(event!.value, privateKey, publicKey)

// if (decryptedEvent!.comment !== '') {
// decryptedEvent!.comment = await decryptAsymmetric(event!.comment, privateKey, publicKey)
// }

setDecryptedEvent(decryptedEvent)
}

Expand Down Expand Up @@ -319,7 +313,7 @@ export default function SecretLogs(props: { app: string }) {

<div className="grid grid-cols-1 md:grid-cols-2 w-full gap-4 text-sm">
<LogField label="Key">
<div className="flex items-center gap-2">{decryptedEvent?.key}</div>
<div className="flex items-center gap-2 ph-mask">{decryptedEvent?.key}</div>
</LogField>

<LogField label="IP address"> {log.ipAddress}</LogField>
Expand Down
2 changes: 1 addition & 1 deletion frontend/components/onboarding/AccountPassword.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const AccountPassword = (props: AccountPasswordProps) => {
type={showPw2 ? 'text' : 'password'}
minLength={16}
required
className="w-full"
className="w-full ph-mask"
/>
<button
className="absolute inset-y-0 right-4 text-neutral-500"
Expand Down

0 comments on commit 1274c04

Please sign in to comment.