Skip to content

Conversation

@rtrofimenkov-ssdlc
Copy link
Contributor

@rtrofimenkov-ssdlc rtrofimenkov-ssdlc commented Nov 24, 2025

What

Implements centralized Gitleaks configuration distribution for GitHub Actions, enabling consistent secret scanning rules across all repositories without config duplication.

Changes

  • Add gitleaks/config/gitleaks.base.toml with base rules
  • Copy centralized config to ${RUNNER_TEMP}/gitleaks.base.toml during action execution (safe for Werf/giterminism)
  • Update config detection logic to use centralized config by default
  • Support local .gitleaks.toml for repository-specific customization via [extend] mechanism

How it works

  1. Action copies base config from modules-actions to ${RUNNER_TEMP}/gitleaks.base.toml
  2. If local .gitleaks.toml exists → uses it (should extend base config via [extend])
  3. Otherwise → uses centralized config directly
  4. Config is stored outside git working directory (Werf-safe, no dirty state)
  5. If local .gitleaks.toml exists without [extend] section > prints warning, ignores local config and uses base one.

Benefits

  • ✅ Centralized rule management across all repos
  • ✅ No config duplication in consumer repositories
  • ✅ Safe for Werf (config outside working directory, no giterminism issues)
  • ✅ Flexible: supports both centralized-only and extended configs
  • ✅ Automatic updates: repos get new rules when action version is updated
  • ✅ Repository-specific rules still possible via local .gitleaks.toml

Testing

Tested:

  • ✅ Scenario 1: No local config (uses centralized only)
  • ✅ Scenario 2: Local config with [extend]
  • ✅ Scenario 3: Local config without [extend]

@rtrofimenkov-ssdlc rtrofimenkov-ssdlc force-pushed the feature/gitleaks-centralized-config branch from b97d648 to 15a91a4 Compare November 27, 2025 12:02
@rtrofimenkov-ssdlc rtrofimenkov-ssdlc marked this pull request as draft November 28, 2025 10:06
- Add gitleaks.base.toml with base rules from deckhouse/deckhouse
- Copy centralized config to ${RUNNER_TEMP} (safe for Werf/giterminism)
- Update config detection logic to use centralized config by default
- Support local .gitleaks.toml for repository-specific customization

This enables centralized rule management while keeping git state clean.

Signed-off-by: Roman Trofimenkov <roman.trofimenkov@flant.com>
Signed-off-by: Roman Trofimenkov <roman.trofimenkov@flant.com>
Signed-off-by: Roman Trofimenkov <roman.trofimenkov@flant.com>
Signed-off-by: Roman Trofimenkov <roman.trofimenkov@flant.com>
Signed-off-by: Roman Trofimenkov <roman.trofimenkov@flant.com>
@rtrofimenkov-ssdlc rtrofimenkov-ssdlc force-pushed the feature/gitleaks-centralized-config branch from e6efac5 to db099c0 Compare November 28, 2025 10:08
@rtrofimenkov-ssdlc rtrofimenkov-ssdlc marked this pull request as ready for review November 28, 2025 10:15
@Nikolay1224 Nikolay1224 merged commit 41e0db0 into main Nov 28, 2025
4 checks passed
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.

4 participants