Skip to content

Integrating TruffleHog secret detection patterns - #16

Merged
amrelsagaei merged 7 commits into
mainfrom
ae-pr-7-trufflehug-patts
Apr 27, 2026
Merged

Integrating TruffleHog secret detection patterns#16
amrelsagaei merged 7 commits into
mainfrom
ae-pr-7-trufflehug-patts

Conversation

@amrelsagaei

@amrelsagaei amrelsagaei commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Batch Search: run searches across all secret patterns with a modal warning, start/cancel flow, and category-aware results filtering
    • Pattern Library & Filtering: large secret-pattern catalog, category/subcategory filters, and enhanced pattern search UI
  • Bug Fixes

    • More robust handling of optional/empty values and improved stop/search behavior to reduce unexpected errors
  • Tests

    • Frontend test runner added and comprehensive secret-pattern validation tests
  • Chores

    • Linting/config updates, dev tooling bumps, and project version bumped to 1.2.4; added a validation task to run checks before release

@socket-security

socket-security Bot commented Apr 15, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​caido/​eslint-config@​0.9.0751006893100
Addedglobals@​17.5.01001008693100
Addedeslint@​9.39.48910010095100

View full report

Comment thread package.json Outdated
@f8thl3ss

Copy link
Copy Markdown

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Apr 16, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Apr 16, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8dd882a2-a8cb-4d43-a331-cc479128efbe

📥 Commits

Reviewing files that changed from the base of the PR and between 1194c95 and a5d0a10.

📒 Files selected for processing (4)
  • packages/frontend/src/components/results/Results.vue
  • packages/frontend/src/data/secret-patterns.test.ts
  • packages/frontend/src/data/secret-patterns.ts
  • packages/frontend/src/stores/batchSearchStore.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/frontend/src/data/secret-patterns.ts
  • packages/frontend/src/components/results/Results.vue

📝 Walkthrough

Walkthrough

Added a batch-search feature plus supporting data, tests, and tooling. Introduced a new Pinia store and dialog, a large secret-patterns dataset and test suite, multiple frontend UI changes, backend/utility typing and null->undefined normalization, ESLint/Vitest configs, and package.json ESM and dependency updates.

Changes

Cohort / File(s) Summary
Repository & Tooling
/.mise.toml, package.json, eslint.config.js, caido.config.ts
Added validate task; switched package to ESM ("type":"module"), added lint/test scripts and ESLint deps; added ESLint flat config; bumped caido version.
Frontend test config & deps
packages/frontend/package.json, packages/frontend/vitest.config.ts
Added Vitest dependency and test scripts; added Vitest config to include src/**/*.test.ts.
Frontend data & tests
packages/frontend/src/data/secret-patterns.ts, packages/frontend/src/data/secret-patterns.test.ts
Added large SECRET_PATTERNS dataset, types, and comprehensive tests validating patterns and samples.
New batch search feature
packages/frontend/src/stores/batchSearchStore.ts, packages/frontend/src/components/search/batch/BatchSearchDialog.vue, packages/frontend/src/stores/index.ts
Added useBatchSearchStore, warning dialog component, store re-export; store orchestrates sequential pattern searches, category mapping, cancellation, and UI toasts.
Frontend stores & pattern UX
packages/frontend/src/stores/patternsStore.ts, packages/frontend/src/stores/grepStore.ts, packages/frontend/src/stores/patternsStore.ts
Refactored patterns store to include categories/filteredPatterns, added currentPatternName to grep store, adapted pattern application and filtering behavior.
Frontend components (search/results/patterns)
packages/frontend/src/components/search/..., packages/frontend/src/components/results/..., packages/frontend/src/components/search/patterns/..., packages/frontend/src/components/...
Wired batch-search UI: new buttons, controls, dialog, category filters, adapted search behavior, added category filtering in results, multiple template/import reorderings and prop kebab-case fixes.
Frontend repositories & utils
packages/frontend/src/repositories/grep.ts, packages/frontend/src/repositories/customRegex.ts, packages/frontend/src/utils/*, packages/frontend/src/plugins/sdk.ts, packages/frontend/src/utils/clipboard.ts
Standardized error checks to error !== undefined, removed console.error logs, switched some imports to type-only, and adjusted toast messages/formatting.
Frontend exports / entry
packages/frontend/src/index.ts, packages/frontend/src/components/index.ts
Minor import reorderings and whitespace; moved stylesheet import location; changed quote style in component exports.
Frontend UI small fixes & reorders
multiple packages/frontend/src/components/* (Container.vue, None.vue, MatchViewer.vue, Results.vue, Searching.vue, Form.vue, Options.vue, Search.vue, TransformScriptDialog.vue, AIDialog.vue, etc.)
Numerous refinements: prop casing, input handling (v-model -> explicit handlers), null->undefined tightening, import reorderings, template formatting, new BatchSearchDialog usage, and UI controls for category/filtering.
Frontend repositories & stores integration
packages/frontend/src/stores/aiStore.ts, packages/frontend/src/stores/patternsStore.ts, packages/frontend/src/stores/grepStore.ts
Minor import/logic tightening; updated getters/setters to use definedness checks and undefined-based defaults; patterns store now merges secret + predefined + custom with filtering.
Backend typing & services
packages/backend/src/services/grep.ts, packages/backend/src/services/storage.ts, packages/backend/src/api/index.ts, packages/backend/src/utils/grep.ts, packages/backend/src/validation/schemas.ts, packages/backend/src/index.ts, packages/backend/src/types.ts
Normalized nullable -> optional/undefined semantics across services and schemas; replaced null sentinels with undefined, adjusted function signatures/returns (notable: downloadResults/getLastRequestID typing), cleaned up error handling and formatting.
Shared types
packages/shared/src/results.ts
Converted several fields from `T
Backend tests & package
packages/backend/package.json, packages/backend/src/services/grep.test.ts
Pinned Vitest version; updated Vitest tests with stricter mocks and undefined-vs-empty-string handling.
Miscellaneous
various small files listed in raw summary
Import reorderings, formatting-only changes, kebab-case prop fixes, and replacing null with undefined in numerous places.

Sequence Diagram(s)

sequenceDiagram
  participant User as "User (UI)"
  participant UI as "Frontend Components"
  participant Store as "BatchSearchStore"
  participant Repo as "Grep Repository"
  participant SDK as "Frontend SDK"
  participant Backend as "Backend API / GrepService"

  rect rgba(135,206,250,0.5)
    User->>UI: Click "Search All Secrets"
    UI->>Store: startBatchSearch(options)
    Store->>UI: show warning dialog
    User->>UI: Confirm start
    UI->>Store: confirmAndStart()
  end

  rect rgba(144,238,144,0.5)
    Store->>Store: iterate SECRET_PATTERNS sequentially
    Store->>Repo: searchGrepRequests(pattern, options)
    Repo->>SDK: call backend API (search request)
    SDK->>Backend: HTTP / IPC request
    Backend->>Backend: execute grep, return matches
    Backend-->>SDK: results
    SDK-->>Repo: results
    Repo-->>Store: results (with cancelled flag)
    Store->>Store: tag matches with pattern category
    Store->>UI: update results view/state
  end

  rect rgba(255,182,193,0.5)
    alt user cancels
      User->>UI: Cancel
      UI->>Store: cancelSearch()
      Store->>Repo: stopGrep()
      Repo->>SDK: stop request
      SDK->>Backend: stop
      Backend-->>SDK: stopped
      SDK-->>Repo: stopped
      Repo-->>Store: cancelled ack
      Store->>UI: show cancellation toast
    end
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

"I hopped through bytes and pattern streams,
I sniffed for secrets in regex dreams.
A batch of hops, a dialog bright,
I tag the matches through the night.
🐇✨ — A rabbit cheers the search's flight!"

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 13.04% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Integrating TruffleHog secret detection patterns' directly aligns with the primary changes, which introduce SECRET_PATTERNS data from TruffleHog and integrate them throughout the codebase with UI controls and batch search functionality.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ae-pr-7-trufflehug-patts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 12

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/backend/src/services/storage.ts (1)

13-24: ⚠️ Potential issue | 🟠 Major

Don’t silently suppress storage directory initialization failures.

Line 22 currently swallows all errors, which can hide real filesystem failures and make later errors harder to diagnose.

💡 Proposed fix
  constructor(sdk: CaidoBackendSDK) {
    this.sdk = sdk;
    this.regexesDir = path.join(this.sdk.meta.path(), "regexes");
-    this.ensureRegexesDirectory();
  }

  private async ensureRegexesDirectory(): Promise<void> {
-    try {
-      await mkdir(this.regexesDir, { recursive: true });
-    } catch {
-      // Directory might already exist
-    }
+    await mkdir(this.regexesDir, { recursive: true });
  }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/backend/src/services/storage.ts` around lines 13 - 24, The
ensureRegexesDirectory method is swallowing all errors which hides real
filesystem failures; update ensureRegexesDirectory (used from the constructor)
to handle errors explicitly by catching the error into a variable and either
rethrowing or logging it with context (including this.regexesDir and the caught
error) instead of an empty catch block; ensure the chosen behavior surfaces
initialization failures to callers (eg. rethrow after logging) so the
constructor/SDK initialization won't silently proceed on real disk errors.
🧹 Nitpick comments (4)
packages/frontend/src/components/results/None.vue (1)

19-29: Optional: extract repeated “no results” condition into a computed flag.

The same predicate appears twice, which makes future tweaks easier to miss.

♻️ Suggested refactor
<script setup lang="ts">
 import Card from "primevue/card";
+import { computed } from "vue";

 import { useGrepStore } from "@/stores";

 const store = useGrepStore();
+const hasNoResults = computed(
+  () => !!store.pattern.trim() && store.results.searchResults?.length === 0,
+);
</script>
-        <i
-          v-if="
-            store.pattern.trim() && store.results.searchResults?.length === 0
-          "
-          class="fas fa-search-minus text-gray-400 text-3xl"
-        ></i>
+        <i v-if="hasNoResults" class="fas fa-search-minus text-gray-400 text-3xl"></i>
         <i v-else class="fas fa-search text-gray-400 text-3xl"></i>

-        <div
-          v-if="
-            store.pattern.trim() && store.results.searchResults?.length === 0
-          "
-          class="text-gray-400 text-md"
-        >
+        <div v-if="hasNoResults" class="text-gray-400 text-md">
           No results found
         </div>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/frontend/src/components/results/None.vue` around lines 19 - 29, The
template repeats the predicate store.pattern.trim() &&
store.results.searchResults?.length === 0 twice; add a computed property (e.g.,
hasNoResults or isNoResults) in the None.vue component that returns that boolean
and replace both occurrences in the template with this computed flag to
centralize the logic and make future changes simpler; update references to use
the new computed name and ensure it imports/uses the same store instance as the
template.
.mise.toml (1)

8-8: Use a deterministic install command in validation.

pnpm i can mask lockfile drift. Prefer a frozen-lockfile install for reproducible validation runs.

♻️ Proposed change
 [tasks.validate]
 description = "Run all checks: install, lint, typecheck, test, build"
 run = """
-pnpm i
+pnpm install --frozen-lockfile
 pnpm lint
 pnpm typecheck
 pnpm test
 pnpm build
 """
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.mise.toml at line 8, The validation currently runs the non-deterministic
command "pnpm i" in .mise.toml; replace it with a frozen-lockfile install (e.g.,
"pnpm install --frozen-lockfile" or the equivalent CI-safe command for your pnpm
version) so the validation fails on lockfile drift and becomes reproducible;
update the command string in .mise.toml to the frozen-lockfile variant and
ensure any CI/validation runner that references the "pnpm i" entry now uses that
updated command.
packages/frontend/src/components/search/TransformScriptDialog.vue (1)

24-28: Minor: Avoid calling trim() twice.

localScript.value.trim() is evaluated twice when the script is non-empty. Consider storing the trimmed value first.

♻️ Proposed fix
 const save = () => {
-  grepStore.options.transformScript =
-    localScript.value.trim() === "" ? undefined : localScript.value.trim();
+  const trimmed = localScript.value.trim();
+  grepStore.options.transformScript = trimmed === "" ? undefined : trimmed;
   visible.value = false;
 };
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/frontend/src/components/search/TransformScriptDialog.vue` around
lines 24 - 28, In save(), avoid calling localScript.value.trim() twice: compute
a single const trimmed = localScript.value.trim() and then set
grepStore.options.transformScript = trimmed === "" ? undefined : trimmed,
finally set visible.value = false; this updates the function save and uses the
variables localScript.value, grepStore.options.transformScript, and
visible.value.
packages/frontend/src/components/search/patterns/PatternsList.vue (1)

38-47: Prefer a stable id for custom-pattern actions.

Edit/delete are keyed off pattern.name, not a stable identifier. If custom names ever collide, both actions will resolve the first match, and the delete path can fall back to "". Thread the custom pattern id through DisplayPattern and use that here directly.

Also applies to: 155-166

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/frontend/src/components/search/patterns/PatternsList.vue` around
lines 38 - 47, The edit/delete flows currently look up custom patterns by name
(getCustomPatternById and editCustomPattern) which is fragile — change these to
use the pattern's stable id: thread the custom pattern id through
DisplayPattern, update the functions (e.g., getCustomPatternById ->
getCustomPatternById(id: string) to find by p.id, and editCustomPattern to
accept id and call patternsStore.openCustomRegexDialog(foundPattern)), and
update the corresponding delete path (the code around the other occurrence at
lines 155-166) to use the id instead of name so actions always target the exact
custom pattern.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@eslint.config.js`:
- Line 22: Add a final newline at the end of the file so the trailing "];" line
ends with a newline to satisfy Prettier/formatting checks; locate the closing
array/semicolon token (the "];" line in eslint.config.js) and ensure the file
ends with a single newline character.

In `@packages/backend/src/services/grep.ts`:
- Line 152: Replace the native RegExp instantiation with the RE2 implementation:
import RE2 from 're2' at the top of packages/backend/src/services/grep.ts and
change the line that creates regex (currently const regex = new RegExp(pattern,
"is")) to use new RE2(pattern, "is") so user-supplied patterns are executed by
re2 (polynomial-time) instead of the native engine; keep the same variable name
(regex) and types where used so the rest of the grep logic (pattern matching
over request/response bodies) continues to work.

In `@packages/frontend/src/components/results/Results.vue`:
- Around line 170-175: The UI flips store.status.isSearching and
store.results.cancelled before the async stopGrep() completes, causing the UI to
show a stopped scan even if the backend stop fails; change stopSearch so it
awaits stopGrep() (or handles its Promise) and only set store.status.isSearching
= false and store.results.cancelled = true after stopGrep() resolves
successfully, and on rejection keep the searching state and surface the error
(so the Stop button remains available for retry); update the stopSearch function
to await stopGrep() and move the state mutations into the success path.

In `@packages/frontend/src/components/search/batch/BatchSearchDialog.vue`:
- Around line 12-18: The Dialog close paths must route through
batchSearchStore.closeWarningDialog so pendingOptions is always cleared; update
the Dialog in BatchSearchDialog.vue to disable built-in closing and bind the
hide event by setting :closable="false" and :close-on-escape="false" and adding
`@hide`="batchSearchStore.closeWarningDialog" (the v-model can remain bound to
batchSearchStore.showWarningDialog) so any user close (button/escape/other)
calls closeWarningDialog() and keeps startBatchSearch() consistent.

In `@packages/frontend/src/components/search/Form.vue`:
- Around line 33-35: handleSearch currently unconditionally calls
batchSearchStore.resetBatchState() and grepStore.searchGrepRequests(), which
allows a normal search to interrupt a running batch (and vice versa) because
both mutate the same grepStore; update handleSearch to first check a running
flag (e.g., grepStore.isRunning or batchSearchStore.isBatchRunning) and return
or disable starting a normal search if a batch run is active, and likewise
modify the batch-start path (the batch button handler referenced around lines
64-70) to check the same running flag and avoid calling
batchSearchStore.resetBatchState() or grepStore.searchGrepRequests() when the
other flow is active; use a single canonical running/mode flag on grepStore (or
batchSearchStore) to coordinate and prevent concurrent starts.

In `@packages/frontend/src/components/search/Search.vue`:
- Around line 8-12: The InputText for the search pattern needs to be disabled
during searches because handlePatternInput currently allows keystrokes to clear
batch search progress; update the InputText element to bind its disabled state
to the combined search statuses (use :disabled="grepStore.status.isSearching ||
batchSearchStore.status.isSearching") and leave handlePatternInput (which sets
grepStore.pattern and clears grepStore.currentPatternName) unchanged so user
input cannot interrupt in-progress searches.

In `@packages/frontend/src/data/secret-patterns.test.ts`:
- Around line 9-13: The testMatch helper ignores each pattern's configured
matchGroups and always prefers capture group 1; update testMatch to consult the
SecretPattern.matchGroups (e.g., use the first configured group index) when
selecting the returned capture: compute an index like const groupIndex =
Array.isArray(pattern.matchGroups) && pattern.matchGroups.length ?
pattern.matchGroups[0] : 1, validate it is a number within match.length, then
return match?.[groupIndex] ?? match?.[0] (falling back to the whole match if the
group is missing).

In `@packages/frontend/src/data/secret-patterns.ts`:
- Around line 166-168: The "JFrog Artifactory Key" detector (pattern
"\\b([a-zA-Z0-9]{64,73})\\b") and several other entries use overly broad,
context-free patterns (bare 64–73 alnum tokens, semver-like \d+\.\d+\.\d+, 44–80
char tokens, 6-digit numbers) that produce many false positives; update those
entries to either remove them or tighten them by requiring provider-specific
context/prefixes (e.g., repository/hostname, header names, known token prefixes)
or replace with stricter regexes that include surrounding keywords, or drop the
entries entirely—apply this change to the "JFrog Artifactory Key" entry and the
other context-free detectors referenced in the file so that only
provider-specific or contextual patterns remain.

In `@packages/frontend/src/stores/batchSearchStore.ts`:
- Around line 27-29: matchCategoryMap is keyed only by match.value which causes
collisions across requests and overlapping patterns; change the map to use a
stable per-match key (e.g., a generated stableMatchId or a composite key like
`${requestId}:${matchIndex}` or an inherent match.id) wherever entries are
created/updated (see matchCategoryMap usage and the code that populates it
around the existing mapping sites and the other occurrences noted). Update the
places that read/write this map (including the logic that sets and reads
selectedResultCategory) to use this stable key so categories are deterministic
across requests and overlaps, and ensure any helpers that produce keys are
consistently used in the three locations currently using match.value as the key.
- Around line 148-153: The cancelSearch() function currently flips
status.cancelled, grepStore.status.isSearching, and grepStore.results.cancelled
before calling grepRepository.stopGrep(); change this to await the asynchronous
stop operation first (await grepRepository.stopGrep()), and only set
grepStore.status.isSearching = false and grepStore.results.cancelled = true
after stopGrep resolves; also keep status.cancelled set immediately (or set it
before awaiting) so intent is recorded, and add a catch around await
grepRepository.stopGrep() to restore/adjust UI state
(grepStore.status.isSearching) or surface an error if stopping fails.

In `@packages/frontend/src/stores/grepStore.ts`:
- Around line 43-45: The code clears currentPatternName.value at the start of a
search which wipes out the label set by patternsStore; remove the line that sets
currentPatternName.value = "" so pattern-driven searches retain their label, but
keep the other initializations (results.searchResults = undefined and
status.isSearching = true) intact; locate and edit the search-starting code
where currentPatternName, results.searchResults, and status.isSearching are set
and delete only the currentPatternName reset.
- Around line 98-107: The truncation logic incorrectly treats exactly 25,000
results as truncated; update the check in the block that assigns
results.searchResults (the newResults/truncatedResults handling) to only treat
cases where newResults.length > 25000 as truncated, then slice to 25,000 and
append the synthetic warning row; ensure the condition uses > 25000 (not >=
25000) so an exact 25,000-result set is left unchanged and does not receive the
warning entry.

---

Outside diff comments:
In `@packages/backend/src/services/storage.ts`:
- Around line 13-24: The ensureRegexesDirectory method is swallowing all errors
which hides real filesystem failures; update ensureRegexesDirectory (used from
the constructor) to handle errors explicitly by catching the error into a
variable and either rethrowing or logging it with context (including
this.regexesDir and the caught error) instead of an empty catch block; ensure
the chosen behavior surfaces initialization failures to callers (eg. rethrow
after logging) so the constructor/SDK initialization won't silently proceed on
real disk errors.

---

Nitpick comments:
In @.mise.toml:
- Line 8: The validation currently runs the non-deterministic command "pnpm i"
in .mise.toml; replace it with a frozen-lockfile install (e.g., "pnpm install
--frozen-lockfile" or the equivalent CI-safe command for your pnpm version) so
the validation fails on lockfile drift and becomes reproducible; update the
command string in .mise.toml to the frozen-lockfile variant and ensure any
CI/validation runner that references the "pnpm i" entry now uses that updated
command.

In `@packages/frontend/src/components/results/None.vue`:
- Around line 19-29: The template repeats the predicate store.pattern.trim() &&
store.results.searchResults?.length === 0 twice; add a computed property (e.g.,
hasNoResults or isNoResults) in the None.vue component that returns that boolean
and replace both occurrences in the template with this computed flag to
centralize the logic and make future changes simpler; update references to use
the new computed name and ensure it imports/uses the same store instance as the
template.

In `@packages/frontend/src/components/search/patterns/PatternsList.vue`:
- Around line 38-47: The edit/delete flows currently look up custom patterns by
name (getCustomPatternById and editCustomPattern) which is fragile — change
these to use the pattern's stable id: thread the custom pattern id through
DisplayPattern, update the functions (e.g., getCustomPatternById ->
getCustomPatternById(id: string) to find by p.id, and editCustomPattern to
accept id and call patternsStore.openCustomRegexDialog(foundPattern)), and
update the corresponding delete path (the code around the other occurrence at
lines 155-166) to use the id instead of name so actions always target the exact
custom pattern.

In `@packages/frontend/src/components/search/TransformScriptDialog.vue`:
- Around line 24-28: In save(), avoid calling localScript.value.trim() twice:
compute a single const trimmed = localScript.value.trim() and then set
grepStore.options.transformScript = trimmed === "" ? undefined : trimmed,
finally set visible.value = false; this updates the function save and uses the
variables localScript.value, grepStore.options.transformScript, and
visible.value.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e922e980-0a33-453b-8154-9a555aa1583b

📥 Commits

Reviewing files that changed from the base of the PR and between 5d51de8 and d656ef0.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (48)
  • .mise.toml
  • caido.config.ts
  • eslint.config.js
  • package.json
  • packages/backend/src/api/index.ts
  • packages/backend/src/index.ts
  • packages/backend/src/services/grep.test.ts
  • packages/backend/src/services/grep.ts
  • packages/backend/src/services/storage.ts
  • packages/backend/src/types.ts
  • packages/backend/src/utils/grep.ts
  • packages/backend/src/validation/schemas.ts
  • packages/frontend/package.json
  • packages/frontend/src/components/guide/Container.vue
  • packages/frontend/src/components/index.ts
  • packages/frontend/src/components/results/Container.vue
  • packages/frontend/src/components/results/MatchViewer.vue
  • packages/frontend/src/components/results/None.vue
  • packages/frontend/src/components/results/Results.vue
  • packages/frontend/src/components/results/Searching.vue
  • packages/frontend/src/components/search/Container.vue
  • packages/frontend/src/components/search/Form.vue
  • packages/frontend/src/components/search/Options.vue
  • packages/frontend/src/components/search/Search.vue
  • packages/frontend/src/components/search/TransformScriptDialog.vue
  • packages/frontend/src/components/search/ai-dialog/AIDialog.vue
  • packages/frontend/src/components/search/ai-dialog/Container.vue
  • packages/frontend/src/components/search/batch/BatchSearchDialog.vue
  • packages/frontend/src/components/search/patterns/Container.vue
  • packages/frontend/src/components/search/patterns/CustomRegexDialog.vue
  • packages/frontend/src/components/search/patterns/PatternsList.vue
  • packages/frontend/src/data/secret-patterns.test.ts
  • packages/frontend/src/data/secret-patterns.ts
  • packages/frontend/src/index.ts
  • packages/frontend/src/plugins/sdk.ts
  • packages/frontend/src/repositories/customRegex.ts
  • packages/frontend/src/repositories/grep.ts
  • packages/frontend/src/stores/aiStore.ts
  • packages/frontend/src/stores/batchSearchStore.ts
  • packages/frontend/src/stores/grepStore.ts
  • packages/frontend/src/stores/index.ts
  • packages/frontend/src/stores/patternsStore.ts
  • packages/frontend/src/types.ts
  • packages/frontend/src/utils/ai.ts
  • packages/frontend/src/utils/clipboard.ts
  • packages/frontend/src/views/App.vue
  • packages/frontend/vitest.config.ts
  • packages/shared/src/results.ts

Comment thread eslint.config.js Outdated
Comment thread packages/backend/src/services/grep.ts
Comment thread packages/frontend/src/components/results/Results.vue Outdated
Comment thread packages/frontend/src/components/search/batch/BatchSearchDialog.vue
Comment thread packages/frontend/src/components/search/Form.vue
Comment thread packages/frontend/src/data/secret-patterns.ts Outdated
Comment thread packages/frontend/src/stores/batchSearchStore.ts Outdated
Comment thread packages/frontend/src/stores/batchSearchStore.ts
Comment thread packages/frontend/src/stores/grepStore.ts Outdated
Comment thread packages/frontend/src/stores/grepStore.ts Outdated
@amrelsagaei
amrelsagaei requested a review from f8thl3ss April 27, 2026 13:51

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/frontend/src/data/secret-patterns.test.ts`:
- Line 619: The test shows only the prefix because the Shopify regex
"\\b(shppa_|shpat_)([0-9A-Fa-f]{32})\\b" captures the prefix in group1 and the
hex body in group2; update the pattern in secret-patterns (the "Shopify Access
Token" regex) so the entire token is captured as a single group (e.g., wrap the
prefix+hex in one capturing group) or adjust the extraction logic to join groups
1+2; then update the test expectation to the full token (e.g., "token=shpat_"+
"a".repeat(32)) if you choose to change the test instead of the regex.

In `@packages/frontend/src/data/secret-patterns.ts`:
- Around line 875-879: There are two secret-pattern entries with the same name
"Terraform Cloud Token"; locate the object with name "Terraform Cloud Token",
pattern "\\btfp_[a-zA-Z0-9_]{40,59}\\b" and category "Other" and rename it to a
unique display name (for example "Terraform Cloud Team Token") or delete this
duplicate entry so the UI header store.currentPatternName and category filter
are unambiguous; ensure the remaining entry names are unique across categories.
- Around line 192-196: The regex for the "RubyGems API Key" secret entry uses
the character class [a-zA0-9], which accidentally omits uppercase letters B–Z;
update the pattern in the object named "RubyGems API Key" to include uppercase
A–Z as well (use a character class that contains both A-Z and a-z plus digits)
so RubyGems keys with uppercase letters are detected, then run the
secret-patterns tests to confirm detection.
- Around line 649-653: The regex for "Shopify Access Token" currently captures
the prefix and body in separate groups which, combined with the default
matchGroups behavior in testMatch and batchSearchStore, yields only the prefix;
change the pattern in secret-patterns.ts so the entire token is captured in a
single group (e.g., make the prefix + body one capture and any internal
alternation non-capturing), or alternatively set explicit matchGroups for this
pattern to return the full match; also update the test expectation in
secret-patterns.test.ts to assert the full token instead of just the prefix.
- Around line 711-720: The regexes for "Session Key" (name: "Session Key",
pattern: "(?:[^A-Za-z0-9+/]|\\A)...\\z") and the Azure DevOps Token pattern use
Go-style anchors `\A`/`\z` which are treated as literal characters in JS; update
the "Session Key" pattern to use JS lookarounds like `(?<![A-Za-z0-9+/])` for
the left boundary and `(?![A-Za-z0-9+/=])` for the right boundary, and update
the Azure DevOps Token pattern to replace the trailing `|\\z` with a negative
lookahead such as `(?![a-zA-Z0-9_~.-])` so boundaries work correctly in
JavaScript.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: be72fa5a-41a6-4863-ac27-490d6a8f9e68

📥 Commits

Reviewing files that changed from the base of the PR and between d656ef0 and 1194c95.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (11)
  • eslint.config.js
  • package.json
  • packages/backend/package.json
  • packages/frontend/package.json
  • packages/frontend/src/components/results/Results.vue
  • packages/frontend/src/components/search/Form.vue
  • packages/frontend/src/components/search/batch/BatchSearchDialog.vue
  • packages/frontend/src/data/secret-patterns.test.ts
  • packages/frontend/src/data/secret-patterns.ts
  • packages/frontend/src/stores/batchSearchStore.ts
  • packages/frontend/src/stores/grepStore.ts
✅ Files skipped from review due to trivial changes (1)
  • packages/backend/package.json
🚧 Files skipped from review as they are similar to previous changes (4)
  • packages/frontend/src/components/search/batch/BatchSearchDialog.vue
  • eslint.config.js
  • packages/frontend/package.json
  • package.json

Comment thread packages/frontend/src/data/secret-patterns.test.ts Outdated
Comment thread packages/frontend/src/data/secret-patterns.ts
Comment thread packages/frontend/src/data/secret-patterns.ts
Comment thread packages/frontend/src/data/secret-patterns.ts
Comment thread packages/frontend/src/data/secret-patterns.ts
f8thl3ss
f8thl3ss previously approved these changes Apr 27, 2026

@f8thl3ss f8thl3ss left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You can merge once the last coderabbit issues are fixed, they look legit

@amrelsagaei
amrelsagaei merged commit 95ddd26 into main Apr 27, 2026
4 checks passed
@amrelsagaei
amrelsagaei deleted the ae-pr-7-trufflehug-patts branch April 27, 2026 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants