javi-forge 1.25.1 → 1.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,74 +0,0 @@
1
- #!/bin/bash
2
- # =============================================================================
3
- # SECURITY LAYER 1: Secret Scanning (pre-commit)
4
- # =============================================================================
5
- # Scans staged files for hardcoded secrets, API keys, and credentials.
6
- # Runs on every commit to prevent accidental secret leaks.
7
- #
8
- # Requires: git
9
- # To skip: git commit --no-verify (NOT recommended)
10
- # =============================================================================
11
-
12
- set -e
13
-
14
- RED='\033[0;31m'
15
- YELLOW='\033[1;33m'
16
- GREEN='\033[0;32m'
17
- NC='\033[0m'
18
-
19
- echo "SECURITY [1/6]: Secret scanning..."
20
-
21
- # Patterns that indicate hardcoded secrets
22
- SECRET_PATTERNS=(
23
- # AWS
24
- 'AKIA[0-9A-Z]{16}'
25
- # Generic API keys (long hex/base64 strings assigned to key-like vars)
26
- '(?i)(api[_-]?key|api[_-]?secret|access[_-]?token|auth[_-]?token)\s*[:=]\s*["\x27][A-Za-z0-9+/=_-]{20,}["\x27]'
27
- # Private keys
28
- '-----BEGIN (RSA |EC |DSA |OPENSSH )?PRIVATE KEY-----'
29
- # GitHub tokens
30
- 'gh[pousr]_[A-Za-z0-9_]{36,}'
31
- # Generic password assignments
32
- '(?i)(password|passwd|pwd)\s*[:=]\s*["\x27][^\s"'\'']{8,}["\x27]'
33
- # Slack tokens
34
- 'xox[baprs]-[0-9a-zA-Z-]+'
35
- # Stripe keys
36
- 'sk_live_[0-9a-zA-Z]{24,}'
37
- 'rk_live_[0-9a-zA-Z]{24,}'
38
- # SendGrid
39
- 'SG\.[A-Za-z0-9_-]{22}\.[A-Za-z0-9_-]{43}'
40
- )
41
-
42
- STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM)
43
-
44
- if [ -z "$STAGED_FILES" ]; then
45
- echo -e "${GREEN} No staged files to scan.${NC}"
46
- exit 0
47
- fi
48
-
49
- FOUND=0
50
- for pattern in "${SECRET_PATTERNS[@]}"; do
51
- # Use grep -P for perl-compatible regex, fall back to -E
52
- MATCHES=$(echo "$STAGED_FILES" | xargs git diff --cached -- | grep -nP "$pattern" 2>/dev/null || true)
53
- if [ -n "$MATCHES" ]; then
54
- if [ "$FOUND" -eq 0 ]; then
55
- echo -e "${RED} Potential secrets detected in staged changes:${NC}"
56
- fi
57
- echo -e "${YELLOW} Pattern: $pattern${NC}"
58
- echo "$MATCHES" | head -5 | while read -r line; do
59
- echo -e "${RED} $line${NC}"
60
- done
61
- FOUND=$((FOUND + 1))
62
- fi
63
- done
64
-
65
- if [ "$FOUND" -gt 0 ]; then
66
- echo -e ""
67
- echo -e "${RED}COMMIT BLOCKED: $FOUND secret pattern(s) detected.${NC}"
68
- echo -e "${YELLOW} Remove secrets and use environment variables instead.${NC}"
69
- echo -e "${YELLOW} If this is a false positive, add to .secret-scan-ignore${NC}"
70
- exit 1
71
- fi
72
-
73
- echo -e "${GREEN} No secrets found.${NC}"
74
- exit 0
@@ -1,62 +0,0 @@
1
- #!/bin/bash
2
- # =============================================================================
3
- # SECURITY LAYER 5: Branch Protection (pre-push)
4
- # =============================================================================
5
- # Prevents direct pushes to protected branches (main, master, release/*).
6
- # Forces use of pull requests for protected branches.
7
- #
8
- # To skip: git push --no-verify (NOT recommended)
9
- # =============================================================================
10
-
11
- set -e
12
-
13
- RED='\033[0;31m'
14
- YELLOW='\033[1;33m'
15
- GREEN='\033[0;32m'
16
- NC='\033[0m'
17
-
18
- echo "SECURITY [5/6]: Branch protection check..."
19
-
20
- # Protected branch patterns
21
- PROTECTED_BRANCHES=(
22
- "main"
23
- "master"
24
- "release/*"
25
- "production"
26
- "staging"
27
- )
28
-
29
- CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "")
30
-
31
- if [ -z "$CURRENT_BRANCH" ]; then
32
- echo -e "${YELLOW} Could not determine current branch. Skipping.${NC}"
33
- exit 0
34
- fi
35
-
36
- for pattern in "${PROTECTED_BRANCHES[@]}"; do
37
- # Support glob patterns
38
- if [[ "$CURRENT_BRANCH" == $pattern ]]; then
39
- # Check if we're on CI (allow CI pushes)
40
- if [ -n "$CI" ] || [ -n "$GITHUB_ACTIONS" ] || [ -n "$GITLAB_CI" ]; then
41
- echo -e "${GREEN} CI environment detected. Allowing push to $CURRENT_BRANCH.${NC}"
42
- exit 0
43
- fi
44
-
45
- echo -e ""
46
- echo -e "${RED}PUSH BLOCKED: Direct push to protected branch '$CURRENT_BRANCH'.${NC}"
47
- echo -e ""
48
- echo -e "${YELLOW} Protected branches require pull requests:${NC}"
49
- for b in "${PROTECTED_BRANCHES[@]}"; do
50
- echo -e "${YELLOW} - $b${NC}"
51
- done
52
- echo -e ""
53
- echo -e "${YELLOW} Create a feature branch and open a PR instead:${NC}"
54
- echo -e "${GREEN} git checkout -b feat/my-feature${NC}"
55
- echo -e "${GREEN} git push -u origin feat/my-feature${NC}"
56
- echo -e "${GREEN} gh pr create${NC}"
57
- exit 1
58
- fi
59
- done
60
-
61
- echo -e "${GREEN} Branch '$CURRENT_BRANCH' is not protected. OK.${NC}"
62
- exit 0
@@ -1,83 +0,0 @@
1
- #!/bin/bash
2
- # =============================================================================
3
- # SECURITY LAYER 2: Dependency Audit (pre-push)
4
- # =============================================================================
5
- # Runs dependency vulnerability audit before pushing.
6
- # Checks for known CVEs in project dependencies.
7
- #
8
- # Supports: npm/pnpm/yarn, pip-audit, cargo audit, govulncheck
9
- # To skip: git push --no-verify (NOT recommended)
10
- # =============================================================================
11
-
12
- set -e
13
-
14
- RED='\033[0;31m'
15
- YELLOW='\033[1;33m'
16
- GREEN='\033[0;32m'
17
- NC='\033[0m'
18
-
19
- echo "SECURITY [2/6]: Dependency audit..."
20
-
21
- # Auto-detect stack and run appropriate audit
22
- if [ -f "package.json" ]; then
23
- if [ -f "pnpm-lock.yaml" ]; then
24
- echo -e "${YELLOW} Running: pnpm audit${NC}"
25
- pnpm audit --audit-level=high 2>/dev/null || {
26
- echo -e "${RED} High/critical vulnerabilities found in dependencies.${NC}"
27
- echo -e "${YELLOW} Run 'pnpm audit' for details, 'pnpm audit --fix' to auto-fix.${NC}"
28
- exit 1
29
- }
30
- elif [ -f "yarn.lock" ]; then
31
- echo -e "${YELLOW} Running: yarn npm audit${NC}"
32
- yarn npm audit --severity high 2>/dev/null || {
33
- echo -e "${RED} High/critical vulnerabilities found in dependencies.${NC}"
34
- echo -e "${YELLOW} Run 'yarn npm audit' for details.${NC}"
35
- exit 1
36
- }
37
- else
38
- echo -e "${YELLOW} Running: npm audit${NC}"
39
- npm audit --audit-level=high 2>/dev/null || {
40
- echo -e "${RED} High/critical vulnerabilities found in dependencies.${NC}"
41
- echo -e "${YELLOW} Run 'npm audit' for details, 'npm audit fix' to auto-fix.${NC}"
42
- exit 1
43
- }
44
- fi
45
- elif [ -f "requirements.txt" ] || [ -f "pyproject.toml" ]; then
46
- if command -v pip-audit &>/dev/null; then
47
- echo -e "${YELLOW} Running: pip-audit${NC}"
48
- pip-audit 2>/dev/null || {
49
- echo -e "${RED} Vulnerabilities found in Python dependencies.${NC}"
50
- echo -e "${YELLOW} Run 'pip-audit' for details.${NC}"
51
- exit 1
52
- }
53
- else
54
- echo -e "${YELLOW} pip-audit not installed. Skipping. Install: pip install pip-audit${NC}"
55
- fi
56
- elif [ -f "Cargo.toml" ]; then
57
- if command -v cargo-audit &>/dev/null; then
58
- echo -e "${YELLOW} Running: cargo audit${NC}"
59
- cargo audit 2>/dev/null || {
60
- echo -e "${RED} Vulnerabilities found in Rust dependencies.${NC}"
61
- echo -e "${YELLOW} Run 'cargo audit' for details.${NC}"
62
- exit 1
63
- }
64
- else
65
- echo -e "${YELLOW} cargo-audit not installed. Skipping. Install: cargo install cargo-audit${NC}"
66
- fi
67
- elif [ -f "go.mod" ]; then
68
- if command -v govulncheck &>/dev/null; then
69
- echo -e "${YELLOW} Running: govulncheck${NC}"
70
- govulncheck ./... 2>/dev/null || {
71
- echo -e "${RED} Vulnerabilities found in Go dependencies.${NC}"
72
- echo -e "${YELLOW} Run 'govulncheck ./...' for details.${NC}"
73
- exit 1
74
- }
75
- else
76
- echo -e "${YELLOW} govulncheck not installed. Skipping. Install: go install golang.org/x/vuln/cmd/govulncheck@latest${NC}"
77
- fi
78
- else
79
- echo -e "${YELLOW} No supported dependency manifest found. Skipping.${NC}"
80
- fi
81
-
82
- echo -e "${GREEN} Dependency audit passed.${NC}"
83
- exit 0
@@ -1,67 +0,0 @@
1
- #!/bin/bash
2
- # =============================================================================
3
- # SECURITY LAYER 4: Code Signing Verification (pre-push)
4
- # =============================================================================
5
- # Checks that commits being pushed are GPG/SSH signed (if configured).
6
- # Warns but does not block if signing is not configured.
7
- #
8
- # To skip: git push --no-verify (NOT recommended)
9
- # =============================================================================
10
-
11
- set -e
12
-
13
- RED='\033[0;31m'
14
- YELLOW='\033[1;33m'
15
- GREEN='\033[0;32m'
16
- CYAN='\033[0;36m'
17
- NC='\033[0m'
18
-
19
- echo "SECURITY [4/6]: Code signing check..."
20
-
21
- # Check if commit signing is configured
22
- SIGN_KEY=$(git config --get user.signingkey 2>/dev/null || echo "")
23
- GPG_SIGN=$(git config --get commit.gpgsign 2>/dev/null || echo "false")
24
- GPG_FORMAT=$(git config --get gpg.format 2>/dev/null || echo "openpgp")
25
-
26
- if [ -z "$SIGN_KEY" ] || [ "$GPG_SIGN" != "true" ]; then
27
- echo -e "${YELLOW} Commit signing not configured. Skipping verification.${NC}"
28
- echo -e "${CYAN} To enable: git config --global commit.gpgsign true${NC}"
29
- echo -e "${CYAN} GPG: git config --global user.signingkey <KEY_ID>${NC}"
30
- echo -e "${CYAN} SSH: git config --global gpg.format ssh && git config --global user.signingkey ~/.ssh/id_ed25519.pub${NC}"
31
- exit 0
32
- fi
33
-
34
- # Verify recent commits are signed
35
- REMOTE="$1"
36
- URL="$2"
37
-
38
- while read -r LOCAL_REF LOCAL_OID REMOTE_REF REMOTE_OID; do
39
- if [ "$LOCAL_OID" = "0000000000000000000000000000000000000000" ]; then
40
- continue # Branch deletion
41
- fi
42
-
43
- # Check last 10 commits (or all new ones)
44
- RANGE=""
45
- if [ "$REMOTE_OID" = "0000000000000000000000000000000000000000" ]; then
46
- RANGE="$LOCAL_OID"
47
- else
48
- RANGE="$REMOTE_OID..$LOCAL_OID"
49
- fi
50
-
51
- UNSIGNED=$(git log --format='%H %G?' "$RANGE" 2>/dev/null | grep -E ' N$' | head -5 || true)
52
-
53
- if [ -n "$UNSIGNED" ]; then
54
- echo -e "${YELLOW} Warning: unsigned commits detected:${NC}"
55
- echo "$UNSIGNED" | while read -r hash status; do
56
- MSG=$(git log --format='%s' -1 "$hash" 2>/dev/null)
57
- echo -e "${YELLOW} ${hash:0:8} $MSG${NC}"
58
- done
59
- echo -e "${YELLOW} Signing is configured but some commits are unsigned.${NC}"
60
- echo -e "${CYAN} To sign: git commit -S -m 'message'${NC}"
61
- echo -e "${CYAN} To amend: git commit --amend -S${NC}"
62
- # Warning only, don't block
63
- fi
64
- done
65
-
66
- echo -e "${GREEN} Signing check complete.${NC}"
67
- exit 0