mirror of
https://github.com/Infisical/infisical.git
synced 2026-01-09 15:38:03 -05:00
Finishing touches + undo RE2 removal
This commit is contained in:
9
.github/workflows/check-non-re2-regex.yml
vendored
9
.github/workflows/check-non-re2-regex.yml
vendored
@@ -15,29 +15,24 @@ jobs:
|
||||
|
||||
- name: Get diff of backend/*
|
||||
run: |
|
||||
echo "Fetching base ref: ${{ github.base_ref }}"
|
||||
|
||||
echo "Generating diff for backend/ directory against origin/${{ github.base_ref }}"
|
||||
git diff --unified=0 "origin/${{ github.base_ref }}"...HEAD -- backend/ > diff.txt
|
||||
|
||||
- name: Scan backend diff for non-RE2 regex
|
||||
run: |
|
||||
echo "Scanning added/modified lines in backend/ for raw regex literals..."
|
||||
grep '^+' diff.txt | grep -v '^+++' | sed 's/^\+//' > added_lines.txt
|
||||
|
||||
if [ ! -s added_lines.txt ]; then
|
||||
echo "No relevant lines added or modified in backend/ found in the diff."
|
||||
echo "✅ No raw regex literals to check in backend."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
raw_regex_pattern='(^|[^A-Za-z0-9_])\/[^\/]+\/[gimsuy]*'
|
||||
|
||||
# First, find all added lines that contain the raw_regex_pattern.
|
||||
# Find all added lines that contain the raw_regex_pattern.
|
||||
grep -E "$raw_regex_pattern" added_lines.txt > potential_violations.txt
|
||||
|
||||
if [ -s potential_violations.txt ]; then # If any lines match the raw regex pattern
|
||||
# From these potential violations, filter out lines that also contain the string 'new RE2'.
|
||||
# Filter out lines that also contain the string 'new RE2'.
|
||||
grep -v 'new RE2' potential_violations.txt > actual_violations.txt
|
||||
|
||||
if [ -s actual_violations.txt ]; then # If there are lines left after filtering out 'new RE2'
|
||||
|
||||
@@ -23,7 +23,7 @@ const HCVaultSyncDestinationConfigSchema = z.object({
|
||||
.trim()
|
||||
.min(1, "Path required")
|
||||
.max(128)
|
||||
.transform((val) => val.replace(/^\/+|\/+$/g, "")) // removes leading/trailing slashes
|
||||
.transform((val) => new RE2("^/+|/+$", "g").replace(val, "")) // removes leading/trailing slashes
|
||||
.refine((val) => new RE2("^([a-zA-Z0-9._-]+/)*[a-zA-Z0-9._-]+$").test(val), {
|
||||
message:
|
||||
"Invalid Vault path format. Use alphanumerics, dots, dashes, underscores, and single slashes between segments."
|
||||
|
||||
Reference in New Issue
Block a user