feat: new variable postfix_secure_logging defaulting to true - #234
Merged
Merged
Conversation
- Replace literal no_log: true with postfix_secure_logging variable - Add postfix_secure_logging: true to defaults/main.yml - Document postfix_secure_logging variable in README.md This change allows users to control logging of potentially sensitive information by setting postfix_secure_logging: false for debugging, while maintaining secure defaults. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Reviewer's guide (collapsed on small PRs)Reviewer's GuideIntroduces a configurable Flow diagram for conditional no_log behavior using postfix_secure_loggingflowchart TD
A[Start_postfix_role_tasks] --> B[Evaluate_postfix_secure_logging]
B -->|true| C[Set_no_log_true_on_sensitive_tasks]
B -->|false| D[Set_no_log_false_on_sensitive_tasks]
C --> E[Execute_sensitive_tasks_with_suppressed_output]
D --> F[Execute_sensitive_tasks_with_full_output]
E --> G[Ansible_logs_hide_credentials]
F --> H[Ansible_logs_show_credentials_for_debugging]
G --> I[Finish_role_execution]
H --> I[Finish_role_execution]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- Consider casting
postfix_secure_loggingto a boolean in theno_logexpressions (e.g.no_log: "{{ postfix_secure_logging | bool }}") to avoid unexpected behavior if the variable is ever passed as a string via inventory or extra-vars.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider casting `postfix_secure_logging` to a boolean in the `no_log` expressions (e.g. `no_log: "{{ postfix_secure_logging | bool }}"`) to avoid unexpected behavior if the variable is ever passed as a string via inventory or extra-vars.
## Individual Comments
### Comment 1
<location path="tasks/main.yml" line_range="146" />
<code_context>
loop: "{{ postfix_files }}"
register: __postfix_postmap_files
- no_log: true
+ no_log: "{{ postfix_secure_logging }}"
loop_control:
loop_var: file
</code_context>
<issue_to_address>
**suggestion (bug_risk):** Coerce `postfix_secure_logging` to a boolean when using it for `no_log`.
To handle cases where `postfix_secure_logging` is defined as a string in inventory/group vars (e.g. `'false'`), please coerce it explicitly: `no_log: "{{ postfix_secure_logging | bool }}"` so `no_log` always receives a proper boolean.
Suggested implementation:
```
loop: "{{ postfix_files }}"
register: __postfix_postmap_files
no_log: "{{ postfix_secure_logging | bool }}"
loop_control:
```
```
when:
- result["changed"]
- result["file"]["postmap"] | d(false)
no_log: "{{ postfix_secure_logging | bool }}"
changed_when: true
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| loop: "{{ postfix_files }}" | ||
| register: __postfix_postmap_files | ||
| no_log: true | ||
| no_log: "{{ postfix_secure_logging }}" |
There was a problem hiding this comment.
suggestion (bug_risk): Coerce postfix_secure_logging to a boolean when using it for no_log.
To handle cases where postfix_secure_logging is defined as a string in inventory/group vars (e.g. 'false'), please coerce it explicitly: no_log: "{{ postfix_secure_logging | bool }}" so no_log always receives a proper boolean.
Suggested implementation:
loop: "{{ postfix_files }}"
register: __postfix_postmap_files
no_log: "{{ postfix_secure_logging | bool }}"
loop_control:
when:
- result["changed"]
- result["file"]["postmap"] | d(false)
no_log: "{{ postfix_secure_logging | bool }}"
changed_when: true
richm
approved these changes
May 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Feature: Introduce the
postfix_secure_loggingvariable that defaults totrue.Reason: Currently, all sensitive tasks use hard-coded no_log: true, which makes debugging difficult. Users cannot see credential-related output even when troubleshooting authentication or secret management issues.
Result:
🤖 Generated with Claude Code
Summary by Sourcery
Introduce a configurable secure logging toggle for sensitive Postfix role tasks, defaulting to secure behavior while allowing opt-out for debugging.
New Features:
Enhancements:
Documentation: