Running evaluation on mini-bc-agent - #11
Merged
Merged
Conversation
Co-authored-by: haoranpb <27280733+haoranpb@users.noreply.github.com>
…nsitive information Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Sun Haoran (haoranpb)
marked this pull request as ready for review
October 9, 2025 06:50
| if len(command) > 100: | ||
| logger.debug(f"Full command: {command}") | ||
| if len(redacted_command) > 100: | ||
| logger.debug(f"Full command: {redacted_command}") |
Check failure
Code scanning / CodeQL
Clear-text logging of sensitive information High
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 11 months ago
To robustly prevent logging of sensitive command contents, especially those containing passwords, avoid logging any command that contains $password = ConvertTo-SecureString or similar secret-setting operations.
Specifically:
- In
_execute_powershell, enhance the logic so that anytime the command contains the pattern for setting$password, both INFO and DEBUG logging of the command or its preview/full content must be suppressed, regardless of the logging level or redaction. - Optionally, you can log a generic message, e.g., "Executing sensitive command (redacted)", but never the command itself.
- The change should be made in
src/bcbench/agent/mini/bc_environment.pyin the block covering lines 103–119. - No additional imports are needed; use existing logging and re functionalities.
Suggested changeset
1
src/bcbench/agent/mini/bc_environment.py
| @@ -111,12 +111,15 @@ | ||
| cmd, | ||
| ) | ||
|
|
||
| redacted_command = redact_passwords(command) | ||
| command_preview: str = redacted_command if len(redacted_command) <= 100 else redacted_command[:97] + "..." | ||
| logger.info(f"Executing:\n{command_preview}") | ||
| if len(redacted_command) > 100: | ||
| logger.debug(f"Full command: {redacted_command}") | ||
|
|
||
| if re.search(r"\$password\s*=\s*ConvertTo-SecureString", command): | ||
| logger.info("Executing sensitive PowerShell command (command redacted)") | ||
| logger.debug("Sensitive PowerShell command detected. Full command redacted from logs.") | ||
| else: | ||
| redacted_command = redact_passwords(command) | ||
| command_preview: str = redacted_command if len(redacted_command) <= 100 else redacted_command[:97] + "..." | ||
| logger.info(f"Executing:\n{command_preview}") | ||
| if len(redacted_command) > 100: | ||
| logger.debug(f"Full command: {redacted_command}") | ||
| try: | ||
| result = subprocess.run( | ||
| ["pwsh", "-NoProfile", "-NonInteractive", "-Command", command], cwd=working_dir, capture_output=True, text=True, timeout=timeout, env={**os.environ, **self.config.env} |
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
Collaborator
Author
There was a problem hiding this comment.
Can you see the handling I have done in the logger util?
Marko Aleksandric (AleksandricMarko)
added a commit
that referenced
this pull request
Jul 31, 2026
…ding Applies Haoran's review feedback for the extensibility-request categories: - Rename to explicit `extensibility-request-implement` / `extensibility-request-triage` across category ids, enum members, classes, dataset files and module files (#1/#2/#4). - Slim both prompt templates to reflect real-world usage; category-specific rules now live in the ai-ext-fix / argus-triage skills (#3). - Merge duplicate `bcbench.results` import in commands/evaluate.py (#5). - Uptake #761: both ext entries subclass `RepoGroundedEntry` (#6/#7). - Triage `patch` defaults to None; stripped from the dataset (#8). - Constrain triage label fields with a `ManagedLabel` Literal to catch dataset typos (#9). - Move the ext dataset classes into dataset/extensibility_request.py, like code review (#10). - Drop `fetch_commit_if_missing` from both ext pipelines to match the other pipelines (#11). - Keep ext-implement judge-only for now; container build/publish noted as future work (#12). - Grade triage with the NL2AL LMChecklist instead of the code-review-style hybrid: `ExtRequestTriageResult` removed in favour of `JudgeBasedEvaluationResult`, expected_* fields replaced by an `expected` checklist, evaluators `lm_checklist`, core score `test_passed`; 17 triage entries migrated (#13/#14/#15/#16). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: fb712366-b026-470c-9d09-1bd9e9f52a31
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.
Potential fix for https://github.com/microsoft/BC-Bench/security/code-scanning/7
The logging of PowerShell commands should never include sensitive information such as passwords in cleartext.
To fix:
_execute_powershell, scan for the relevant password assignment (ConvertTo-SecureString ... -AsPlainText -Force) and redact the password value from the string being logged.$password(or other credentials) in the stringified command with a placeholder such as'******'.src/bcbench/agent/mini/bc_environment.py, within the_execute_powershellmethod.re) should be added at the top of the file if not already present.Suggested fixes powered by Copilot Autofix. Review carefully before merging.