Conversation
|
@abhimehro Unfortunately, I hit an error while trying to use the custom Copilot setup steps configured for this repository and had to close this PR. The error I am seeing is: Once you or someone with the necessary access fixes the problem, please unassign and then reassign issue #0 to me and I'll retry. Thanks! |
|
😎 Merged manually by @abhimehro - details. |
…itization, add dry-run plan details Incorporates the best changes from 36 Jules PRs, addressing review feedback: Bolt (Performance) - from PR #173: - Pre-compile PROFILE_ID_PATTERN and RULE_PATTERN at module level - Use compiled patterns in is_valid_profile_id_format, validate_profile_id, and is_valid_rule - Supersedes PRs: #140, #143, #152, #155, #158, #161, #167, #170, #173 Sentinel (Security) - from PR #172 with review feedback: - Enhance sanitize_for_log to redact Basic Auth credentials in URLs - Redact sensitive query parameters (token, key, secret, password, etc.) - Handle fragment separators (#) per Gemini Code Assist review - Use [^&#\s]* pattern per Copilot reviewer suggestion - Update docstring per reviewer suggestion - Supersedes PRs: #142, #145, #148, #151, #154, #157, #160, #169, #172 Palette (UX) - from PR #174 with lint fixes: - Add print_plan_details function for dry-run visibility - Fix duplicate render_progress_bar definition bug - Supersedes PRs: #139, #141, #144, #147, #150, #153, #156, #159, #162, #165, #168, #171, #174 Also: #146, #149, #164 (parallel folder deletion) and #166 (auto-fix .env perms) are independent features not consolidated here. Co-authored-by: abhimehro <84992105+abhimehro@users.noreply.github.com>
…odule level Co-authored-by: abhimehro <84992105+abhimehro@users.noreply.github.com>
|
👋 Development Partner is reviewing this PR. Will provide feedback shortly. |
| captured = capsys.readouterr() | ||
| output = captured.out | ||
|
|
||
| assert "Plan Details for test_profile:" in output |
Check notice
Code scanning / Bandit
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
| output = captured.out | ||
|
|
||
| assert "Plan Details for test_profile:" in output | ||
| assert " - Folder A: 10 rules" in output |
Check notice
Code scanning / Bandit
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
|
|
||
| assert "Plan Details for test_profile:" in output | ||
| assert " - Folder A: 10 rules" in output | ||
| assert " - Folder B: 5 rules" in output |
Check notice
Code scanning / Bandit
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
| assert " - Folder A: 10 rules" in output | ||
| assert " - Folder B: 5 rules" in output | ||
| # Verify alphabetical ordering (A before B) | ||
| assert output.index("Folder A") < output.index("Folder B") |
Check notice
Code scanning / Bandit
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
| captured = capsys.readouterr() | ||
| output = captured.out | ||
|
|
||
| assert "Plan Details for test_profile:" in output |
Check notice
Code scanning / Bandit
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
| output = captured.out | ||
|
|
||
| assert "Plan Details for test_profile:" in output | ||
| assert "No folders to sync." in output |
Check notice
Code scanning / Bandit
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
| captured = capsys.readouterr() | ||
| output = captured.out | ||
|
|
||
| assert "📝 Plan Details for test_profile:" in output |
Check notice
Code scanning / Bandit
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
| output = captured.out | ||
|
|
||
| assert "📝 Plan Details for test_profile:" in output | ||
| assert "Folder A" in output |
Check notice
Code scanning / Bandit
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
|
|
||
| assert "📝 Plan Details for test_profile:" in output | ||
| assert "Folder A" in output | ||
| assert "10 rules" in output |
Check notice
Code scanning / Bandit
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
| s = s.replace(TOKEN, "[REDACTED]") | ||
|
|
||
| # Redact Basic Auth in URLs (e.g. https://user:pass@host) | ||
| s = _BASIC_AUTH_PATTERN.sub("://[REDACTED]@", s) |
Check warning
Code scanning / Pylintpython3 (reported by Codacy)
Variable name "s" doesn't conform to snake_case naming style Warning
| s = _BASIC_AUTH_PATTERN.sub("://[REDACTED]@", s) | ||
|
|
||
| # Redact sensitive query parameters (handles ?, &, and # separators) | ||
| s = _SENSITIVE_PARAM_PATTERN.sub(r"\1\2=[REDACTED]", s) |
Check warning
Code scanning / Pylintpython3 (reported by Codacy)
Variable name "s" doesn't conform to snake_case naming style Warning
| s = s.replace(TOKEN, "[REDACTED]") | ||
|
|
||
| # Redact Basic Auth in URLs (e.g. https://user:pass@host) | ||
| s = _BASIC_AUTH_PATTERN.sub("://[REDACTED]@", s) |
Check warning
Code scanning / Pylint (reported by Codacy)
Variable name "s" doesn't conform to snake_case naming style Warning
| s = _BASIC_AUTH_PATTERN.sub("://[REDACTED]@", s) | ||
|
|
||
| # Redact sensitive query parameters (handles ?, &, and # separators) | ||
| s = _SENSITIVE_PARAM_PATTERN.sub(r"\1\2=[REDACTED]", s) |
Check warning
Code scanning / Pylint (reported by Codacy)
Variable name "s" doesn't conform to snake_case naming style Warning
| captured = capsys.readouterr() | ||
| output = captured.out | ||
|
|
||
| assert "Plan Details for test_profile:" in output |
Check notice
Code scanning / Bandit (reported by Codacy)
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
| output = captured.out | ||
|
|
||
| assert "Plan Details for test_profile:" in output | ||
| assert " - Folder A: 10 rules" in output |
Check notice
Code scanning / Bandit (reported by Codacy)
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
|
|
||
| assert "Plan Details for test_profile:" in output | ||
| assert " - Folder A: 10 rules" in output | ||
| assert " - Folder B: 5 rules" in output |
Check notice
Code scanning / Bandit (reported by Codacy)
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
| assert " - Folder A: 10 rules" in output | ||
| assert " - Folder B: 5 rules" in output | ||
| # Verify alphabetical ordering (A before B) | ||
| assert output.index("Folder A") < output.index("Folder B") |
Check notice
Code scanning / Bandit (reported by Codacy)
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
| captured = capsys.readouterr() | ||
| output = captured.out | ||
|
|
||
| assert "Plan Details for test_profile:" in output |
Check notice
Code scanning / Bandit (reported by Codacy)
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
| output = captured.out | ||
|
|
||
| assert "Plan Details for test_profile:" in output | ||
| assert "No folders to sync." in output |
Check notice
Code scanning / Bandit (reported by Codacy)
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
| captured = capsys.readouterr() | ||
| output = captured.out | ||
|
|
||
| assert "📝 Plan Details for test_profile:" in output |
Check notice
Code scanning / Bandit (reported by Codacy)
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
| output = captured.out | ||
|
|
||
| assert "📝 Plan Details for test_profile:" in output | ||
| assert "Folder A" in output |
Check notice
Code scanning / Bandit (reported by Codacy)
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
|
|
||
| assert "📝 Plan Details for test_profile:" in output | ||
| assert "Folder A" in output | ||
| assert "10 rules" in output |
Check notice
Code scanning / Bandit (reported by Codacy)
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
There was a problem hiding this comment.
Pull request overview
This PR consolidates prior overlapping changes into a single update that improves runtime efficiency and security of log output, and enhances --dry-run UX by showing a folder/rule breakdown.
Changes:
- Pre-compiles hot-path validation regexes and log-sanitization regexes at module scope and switches call sites to reuse them.
- Hardens
sanitize_for_log()to redact Basic Auth credentials in URLs and sensitive query parameters (in addition to TOKEN), while continuing to escape control characters. - Adds
print_plan_details()and calls it during--dry-run, plus adds/extends tests covering dry-run output and new sanitization behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| main.py | Adds pre-compiled regex constants, strengthens sanitize_for_log, introduces print_plan_details, and wires it into dry-run flow. |
| tests/test_plan_details.py | New pytest tests validating dry-run plan detail output ordering and no-folder behavior. |
| tests/test_log_sanitization.py | Adds unittest coverage for Basic Auth and sensitive query parameter redaction in sanitize_for_log. |
Jules generated 36 overlapping PRs across three categories (Bolt/Sentinel/Palette) with heavy duplication. This PR cherry-picks the best change from each category, incorporates bot review feedback (Gemini Code Assist, Copilot reviewer, CodeQL), and consolidates into a single mergeable PR.
⚡ Performance: Pre-compile regex (from PR #173)
Moved
PROFILE_ID_PATTERN,RULE_PATTERN, and two sanitization patterns to module-level compiled constants. Used inis_valid_rule,is_valid_profile_id_format,validate_profile_id, andsanitize_for_log.🛡️ Security: Redact credentials from logs (from PR #172 + review feedback)
sanitize_for_log()now strips Basic Auth (://user:pass@host) and sensitive query params before logging. Handles#fragment separators per Gemini review. Uses[^&#\s]*to avoid consuming trailing punctuation per Copilot review.🎨 UX: Dry-run plan details + fix duplicate function (from PR #174)
print_plan_details()showing per-folder rule counts during--dry-runrender_progress_bardefinition (first copy was dead code shadowed by second)PRs superseded (close these)
Keep open (independent features): #146, #149, #164 (parallel deletion), #163 (RTLO fix), #166 (.env perms), #170 (combined API calls).
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.