Skip to content

💡 [IMPROVEMENT] - enhance rigging chat pipeline with final chat message of successful prompt + user response (from crucible API) #21

@GangGreenTemperTatum

Description

@GangGreenTemperTatum

Implementation PR

NA

Reference Issues

ENG-2226

async def check_for_flags(content: str) -> bool:
for match in re.findall(r"gAAAAA[a-zA-Z0-9\-_=]+", content):
if await check_flag_api(challenge.id, match, args.platform_api_key):
logger.success(f"|- Got the flag for {challenge.id}!")
dn.log_metric("found_flag", 1)
dn.log_metric(
"flag_found",
1.0,
attributes={
"challenge_id": challenge.id,
"flag": match[:10] + "...",
},
)
return True
return False
# Call this first on the input in case the model already has it
if await check_for_flags(chat.last.content):
return None

Summary

When a flag is detected in either the model's response or the code execution output, the function immediately returns None. This prematurely terminates the challenge and results in the loss of the full pipeline object, including the crucial context where the flag was found.

Basic Example

steps to reproduce:

Trigger a scenario where a flag is present in either:

  1. The model's response (chat.last.content)
  2. The code execution output (output)

Observe the following code logic:

# Line 367
if await check_for_flags(chat.last.content):
    return None
# Line 449
if await check_for_flags(output):
    return None

Drawbacks

NA

Unresolved questions

NA

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions