Skip to content

feat: configure required tag findings - #316

Merged
YoungJinJung merged 4 commits into
mainfrom
feature/issue-312-required-tags
Aug 25, 2026
Merged

feat: configure required tag findings#316
YoungJinJung merged 4 commits into
mainfrom
feature/issue-312-required-tags

Conversation

@YoungJinJung

@YoungJinJung YoungJinJung commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add inspector.required_tags to the global configuration and thread it into Security Inspector scans
  • disable missing-tag findings when no policy is configured and report only missing required keys when enabled
  • add config and cost-rule regressions and update README plus English/Korean overview and architecture docs

Related Issues

Closes #312

Validation

  • make test
  • make build
  • git diff --check

Checklist

  • Scope is focused
  • Branch name follows docs/branch-naming-harness.md
  • Documentation harness reviewed (docs/documentation-harness.md)
  • README updated if user-facing behavior changed
  • Relevant docs/ pages updated if architecture, auth, config, or workflow changed
  • Tests/validation included
  • Breaking changes documented (none)

Summary by CodeRabbit

  • New Features

    • Added optional required-tag policies for Inspector scans.
    • Cost and waste findings now identify specifically missing configured tags and report their names.
    • Missing-tag checks can be disabled by leaving the required-tag policy empty.
    • Added a 30-day ACM certificate expiry configuration example.
  • Documentation

    • Updated English and Korean configuration, architecture, and project documentation to describe required-tag policies and their behavior.

- make cost tag findings opt in through inspector.required_tags
- report only missing policy keys and document the configuration
@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: fe825d0b-c613-4858-bcf6-4351e0a3afa3

📥 Commits

Reviewing files that changed from the base of the PR and between f75bb40 and b9b2490.

📒 Files selected for processing (7)
  • README.md
  • docs/project-overview.en.md
  • docs/project-overview.ko.md
  • internal/app/screen_inspector.go
  • internal/inspector/inspector.go
  • internal/inspector/inspector_rules_cost.go
  • internal/inspector/inspector_rules_cost_test.go

Walkthrough

The change adds inspector.required_tags configuration, propagates it through Inspector scans, and reports missing configured tags for supported cost/waste resources. The rule remains disabled when no required tags are configured. Documentation and tests reflect the new behavior.

Changes

Inspector required-tag policy

Layer / File(s) Summary
Configuration and scan-option wiring
internal/config/config.go, internal/config/config_test.go, internal/inspector/inspector.go, internal/app/screen_inspector.go
The configuration loads inspector.required_tags, preserves the values across named contexts, and passes them through SecurityScanOptions. Tests cover defaults and propagation.
Required-tag cost findings
internal/inspector/inspector_rules_cost.go, internal/inspector/inspector_rules_cost_test.go
Cost/waste checks validate required tags for Elastic IPs, EBS volumes, EC2 instances, and EBS snapshots. Blank and duplicate requirements are ignored. Findings list missing keys, and the check is disabled without configured requirements.
Configuration and behavior documentation
README.md, docs/architecture.en.md, docs/architecture.ko.md, docs/project-overview.en.md, docs/project-overview.ko.md
Documentation describes the optional required-tag policy, its configuration example, and conditional missing-tag findings.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: nathanhuh

Sequence Diagram(s)

sequenceDiagram
  participant InspectorScreen
  participant SecurityScanOptions
  participant CostWasteScanner
  participant AWSResource
  participant untaggedCostFinding
  InspectorScreen->>SecurityScanOptions: Set configured RequiredTags
  SecurityScanOptions->>CostWasteScanner: Run configured scan
  CostWasteScanner->>AWSResource: Inspect resource tags
  AWSResource->>untaggedCostFinding: Provide tags and required tags
  untaggedCostFinding-->>CostWasteScanner: Return missing-tag finding or no finding
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title uses the required feat: prefix and clearly describes configurable required-tag findings.
Description check ✅ Passed The description includes the required summary, issue, validation, and checklist sections with relevant details.
Linked Issues check ✅ Passed The changes implement all requirements from issue #312, including configuration, propagation, conditional rule execution, and missing-tag reporting.
Out of Scope Changes check ✅ Passed The configuration, tests, implementation, README, and English/Korean documentation changes are directly related to issue #312.
Docstring Coverage ✅ Passed Docstring check was indeterminate for this PR — some files could not be analyzed in time. Not blocking.
✨ 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 feature/issue-312-required-tags

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.

@amazon-q-developer amazon-q-developer Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The implementation correctly adds configurable required tag enforcement to the Security Inspector. The feature properly threads inspector.required_tags from global configuration through the cost-waste scanner, disables missing-tag findings when no policy is configured, and reports only missing required keys when enabled. The config loading uses defensive copying for the RequiredTags slice, and the inspection logic handles edge cases appropriately (empty policies, duplicate tags, empty strings). Tests validate both configuration parsing and the inspection behavior. No blocking issues found.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

@YoungJinJung YoungJinJung left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Findings

  1. [P2] Preserve exact AWS tag keys during policy matchinginternal/inspector/inspector_rules_cost.go:278-280

    The new membership map stores strings.TrimSpace(awssdk.ToString(tag.Key)). EC2 tag keys are case-sensitive strings, so surrounding whitespace is part of the key: a resource tagged " Owner " will currently satisfy a configured required key of Owner, suppressing the finding even though the resource does not have that exact policy key. Keep the AWS-returned key unchanged when populating present (while trimming configured entries if that is the intended config normalization), and add a regression case proving that a whitespace-different resource tag remains missing.

Reviewed head: f75bb40

- keep AWS tag keys unchanged during policy comparison
- cover whitespace-different resource keys with a regression
@YoungJinJung

Copy link
Copy Markdown
Contributor Author

Applied the exact tag-key matching feedback in d5aecf7.

  • preserve AWS-returned tag keys verbatim during required-policy comparison
  • add a regression proving " Owner " does not satisfy required key "Owner"
  • focused regression: passed
  • make test: passed
  • make build: passed
  • git diff --check: passed

Docs remain unchanged because this corrects the implementation to match the documented exact required-key behavior.

@YoungJinJung

Copy link
Copy Markdown
Contributor Author

/q review

@amazon-q-developer amazon-q-developer Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This PR successfully implements configurable required tag findings for the Security Inspector. The implementation is solid with proper threading of configuration, correct disable-by-default behavior when no tags are configured, and comprehensive test coverage. The changes follow established patterns and integrate cleanly with the existing codebase.

Key Strengths:

  • Proper configuration flow from YAML → Config → SecurityScanOptions
  • Correct conditional logic: rule is disabled when required_tags list is empty
  • Thorough test coverage for both config loading and inspector rule logic
  • Clear, specific finding messages that list the actual missing tag names

No blocking issues found. Ready for merge.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

@YoungJinJung YoungJinJung left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Findings

  1. [P2] State the actual required-tag coverageREADME.md:344 (also docs/project-overview.en.md:36 and docs/project-overview.ko.md:36)

    The changed text says generic “resources missing configured required tags,” but requiredTags is only evaluated from inspectElasticIPs, inspectEBSVolumes, inspectEC2InstancesForWaste, and inspectEBSSnapshotsForWaste; target groups and resources handled by the other Inspector rule packs are not checked. This can give operators a false impression that inspector.required_tags enforces an account-wide tagging policy. Keep the documentation scoped to Elastic IPs, EBS volumes/snapshots, and EC2 instances (or extend the implementation if broader coverage is intended).

Reviewed head: d5aecf7

@YoungJinJung YoungJinJung left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reviewed head: 70e6b9f

No actionable findings. The documentation-only follow-up accurately limits required-tag coverage to Elastic IPs, EBS volumes and snapshots, and EC2 instances, resolving the prior review finding. The full diff remains aligned with issue #312.

Validation passed: make test, make build, focused config and Inspector regressions, and git diff --check. CI and CodeRabbit are green. The PR is mergeable but still requires an independent approval.

@YoungJinJung

Copy link
Copy Markdown
Contributor Author

/q review

@amazon-q-developer amazon-q-developer Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This PR successfully implements configurable required-tag policies for Security Inspector scans. The implementation is clean and well-integrated:

Key strengths:

  • Properly threads RequiredTags configuration from config file through to scan execution
  • Correctly disables missing-tag findings when no policy is configured (empty slice check)
  • Reports specific missing tag names when policy is enabled
  • Includes comprehensive test coverage including edge cases (duplicates, whitespace, empty values)
  • Maintains backward compatibility - existing configs without required_tags continue to work

Implementation quality:

  • Defensive programming with proper empty checks and deduplication
  • Clean API design using SecurityScanOptions struct for configuration
  • Proper separation between old generic "untagged" behavior and new specific missing-tag detection
  • Good test coverage validating the policy behavior

The code is ready to merge.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

…uired-tags

# Conflicts:
#	docs/project-overview.en.md
#	docs/project-overview.ko.md
@YoungJinJung
YoungJinJung merged commit dbee17a into main Aug 25, 2026
1 of 2 checks passed
@YoungJinJung
YoungJinJung deleted the feature/issue-312-required-tags branch August 25, 2026 04:33
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.

feat: make the cost/waste untagged-resource rule configurable

1 participant