Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/api/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ interface PluginIndex {
}

function maskValue(value: string): string {
if (value.length <= 8) return "****";
if (!value || value.length <= 8) return "****";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The current masking logic reveals 8 characters (4 at the start and 4 at the end). For secrets that are only slightly longer than the threshold (e.g., 9 to 12 characters), this reveals almost the entire sensitive value (e.g., 8 out of 9 characters), which constitutes inadequate redaction.

Additionally, while the !value check prevents a crash on nullish inputs, returning **** for a missing value can be misleading as it implies a secret is configured when it is not.

Furthermore, to fully address the risk of "unexpected config structures" causing a Denial of Service (as mentioned in the PR description), it is safer to explicitly check that value is a string before accessing .length or .slice().

Consider increasing the threshold to at least 16 characters and returning an empty string for non-string or empty inputs.

Suggested change
if (!value || value.length <= 8) return "****";
if (typeof value !== "string" || !value) return "";
if (value.length <= 16) return "****";

return `${value.slice(0, 4)}...${value.slice(-4)}`;
}

Expand Down
Loading