fix: grant blue training flag when malicious file is removed (#167)#184
Merged
fix: grant blue training flag when malicious file is removed (#167)#184
Conversation
The AutonomousBlue2 ("Malicious file on system") flag was never granted
because of two issues:
1. The flag class file existed at app/blue_2.py but was missing from
app/flags/autonomous/blue_2.py where the certification YAML expected
to import it from.
2. The flag entry was commented out in the Blue Certificate YAML
(8da8f0b3-194a-4eed-95b0-43c1f1b64091.yml), so it was never loaded
into the training system.
Also removed the spurious visible=False attribute that no other flag has.
There was a problem hiding this comment.
Pull request overview
Fixes Blue autonomous training progression by properly registering and loading the “Malicious file on system” flag so it can be granted after the malicious file is removed.
Changes:
- Add
AutonomousBlue2flag implementation at the expected import path (app/flags/autonomous/blue_2.py). - Register/uncomment the flag in the Blue Certificate certification YAML.
- Add unit tests covering importability, YAML registration, and verify() behavior.
Reviewed changes
Copilot reviewed 3 out of 5 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
app/flags/autonomous/blue_2.py |
Adds the AutonomousBlue2 flag at the correct module path used by the certification loader. |
data/certifications/8da8f0b3-194a-4eed-95b0-43c1f1b64091.yml |
Uncomments/registers the AutonomousBlue2 flag for the autonomous badge. |
tests/app/flags/autonomous/test_blue_2.py |
Adds tests for flag import path, YAML registration, and verify logic. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+19
to
+23
| """The flag must be uncommented and listed in the Blue Certificate YAML.""" | ||
| with open('plugins/training/data/certifications/8da8f0b3-194a-4eed-95b0-43c1f1b64091.yml') as f: | ||
| cert = yaml.safe_load(f) | ||
| autonomous_flags = cert['badges']['autonomous'] | ||
| assert 'flags.autonomous.blue_2.AutonomousBlue2' in autonomous_flags |
Comment on lines
+5
to
+10
| class AutonomousBlue2(Flag): | ||
| name = 'Malicious file on system' | ||
| challenge = 'Write a file on the Windows machine under the C:\\Users\\Public directory. Get the SHA256 hash of ' \ | ||
| 'this file, and write it to C:\\Users\\Public\\malicious_files.txt. The autonomous defender should ' \ | ||
| 'automatically find and delete the file.' | ||
| extra_info = """""" |
Comment on lines
+1
to
+2
| import asyncio | ||
| from unittest.mock import AsyncMock, MagicMock, patch |
- test_blue_2.py: replace hard-coded path with Path(__file__)-derived path, remove unused asyncio and patch imports - app/blue_2.py: replace dead-code duplicate with a stub that re-exports the canonical class from app/flags/autonomous/blue_2.py
Contributor
Author
|
@github-copilot review |
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.
Summary
AutonomousBlue2flag class file was missing fromapp/flags/autonomous/(it only existed at the wrong pathapp/blue_2.py), and the flag entry was commented out in the Blue Certificate YAMLapp/flags/autonomous/blue_2.py)data/certifications/8da8f0b3-194a-4eed-95b0-43c1f1b64091.ymlvisible = Falseattribute not present on any other flagTest plan