Skip to content
Merged
Show file tree
Hide file tree
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/signals/redaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
// intentionally NOT collapsed onto `PUBLIC_UNSAFE_TERMS`.
export const PUBLIC_UNSAFE_TERMS = String.raw`(?:reward|score|wallet|hotkey|coldkey|mnemonic|payout|ranking)\w*|farming|raw[-_\s]?trust|trust[-_\s]?score|private[-_\s]?reviewability|reviewability`;

export const PUBLIC_UNSAFE_PATTERN = new RegExp(String.raw`\b(${PUBLIC_UNSAFE_TERMS})\b|/Users/|/home/|/root/|/tmp/|[A-Z]:[\\/]Users[\\/]`, "i");
export const PUBLIC_UNSAFE_PATTERN = new RegExp(String.raw`\b(${PUBLIC_UNSAFE_TERMS})\b|/Users/|/home/|/root/|/var/|/tmp/|[A-Z]:[\\/]Users[\\/]`, "i");

/** True iff `text` contains nothing that must stay private — i.e. it is safe to surface on a public GitHub surface. */
export function isPublicSafeText(text: string): boolean {
Expand Down
2 changes: 2 additions & 0 deletions test/unit/redaction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ describe("isPublicSafeText (#542 shared public/private boundary)", () => {
expect(isPublicSafeText("/home/bob/repo")).toBe(false);
expect(isPublicSafeText("/root/project/src")).toBe(false);
expect(isPublicSafeText("clone failed at /root/work/repo")).toBe(false);
expect(isPublicSafeText("/var/log/app.log")).toBe(false);
expect(isPublicSafeText("/var/folders/alice/work/private-repo/cache.ts")).toBe(false);
expect(isPublicSafeText("/tmp/scratch")).toBe(false);
expect(isPublicSafeText("C:\\Users\\carol\\repo")).toBe(false);
expect(isPublicSafeText("C:/Users/carol/repo")).toBe(false);
Expand Down
Loading