Skip to content

config: add extends key for config inheritance - #939

Open
Paranoa-dev wants to merge 1 commit into
SorobanGuard:mainfrom
Paranoa-dev:fix/issue-910-extends-config
Open

Paranoa-dev wants to merge 1 commit into
SorobanGuard:mainfrom
Paranoa-dev:fix/issue-910-extends-config

Conversation

@Paranoa-dev

Copy link
Copy Markdown

Summary

Addresses issue #910 by adding an extends key to soroban-guard.toml that allows inheriting from a base configuration file.

Changes

  • Added extends: Option<String> field to GuardConfig in crates/cli/src/config.rs
  • Modified load_from_path to load base config and merge with child config
  • Added merge_scan_config and merge_checks_config helper functions
  • Merging strategy: child values override base, arrays are combined (deduplicated)

Example Usage

# base.toml
[scan]
min_severity = "low"

[checks]
disabled = ["forbidden-std-imports"]

# soroban-guard.toml
extends = "base.toml"

[scan]
min_severity = "high"  # overrides base

[checks]
disabled = ["hardcoded-address"]  # adds to base
sensitive_names.extra = ["custom_admin"]  # adds to base

Testing

Added comprehensive tests in config.rs:

  • extends_loads_base_config_and_merges: verifies merge behavior for scan and checks
  • extends_with_relative_path: verifies relative path resolution
  • extends_nonexistent_file_returns_error: error handling for missing base
  • load_from_path_handles_extends: explicit path loading with extends

Closes #910

Addresses issue SorobanGuard#910 by adding an  key to soroban-guard.toml
that allows inheriting from a base configuration file.

Changes:
- Added  field to GuardConfig
- Modified load_from_path to load base config and merge with child
- Added merge_scan_config and merge_checks_config helpers
- Merging strategy: child values override base, arrays are combined (deduplicated)

Added tests:
- extends_loads_base_config_and_merges: verifies merge behavior
- extends_with_relative_path: verifies relative path resolution
- extends_nonexistent_file_returns_error: error handling
- load_from_path_handles_extends: explicit path loading

Example usage:

Closes SorobanGuard#910
@drips-wave

drips-wave Bot commented Oct 22, 2026

Copy link
Copy Markdown

@Paranoa-dev Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

cli: add an extends key to soroban-guard.toml for sharing config across a monorepo

1 participant