Skip to content

Commit 65c6ccd

Browse files
synthesis: add backup key examples
1 parent 5fc6990 commit 65c6ccd

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

rust/modality/src/cmds/synthesize.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,8 @@ const FORMULA_EXAMPLE_GROUPS: &[FormulaExampleGroup] = &[
505505
r#"always([+REVOKE_VAULT_TOKEN] true -> eventually(<+NOTIFY_SECRETS_OWNER> true))"#,
506506
r#"always([+CI_VARIABLE_SECRET_LEAKED] true -> (<+ROTATE_CI_VARIABLE_SECRET> true | <+DISABLE_CI_PIPELINE> true))"#,
507507
r#"always([+ROTATE_CI_VARIABLE_SECRET] true -> eventually(<+NOTIFY_PIPELINE_OWNER> true))"#,
508+
r#"always([+BACKUP_ENCRYPTION_KEY_LEAKED] true -> (<+ROTATE_BACKUP_ENCRYPTION_KEY> true | <+QUARANTINE_BACKUPS> true))"#,
509+
r#"always([+ROTATE_BACKUP_ENCRYPTION_KEY] true -> eventually(<+NOTIFY_BACKUP_OWNER> true))"#,
508510
r#"next(<+APPROVE> true)"#,
509511
r#"next((<+APPROVE> true | [<+REJECT>] true))"#,
510512
r#"<+WAIT> true until <+APPROVE> true"#,
@@ -5089,6 +5091,18 @@ F2: formula generated_2 {
50895091
));
50905092
}
50915093

5094+
#[test]
5095+
fn synthesis_list_includes_backup_encryption_key_leak_prompt_examples() {
5096+
let output = synthesis_list_text();
5097+
5098+
assert!(output.contains(
5099+
"always([+BACKUP_ENCRYPTION_KEY_LEAKED] true -> (<+ROTATE_BACKUP_ENCRYPTION_KEY> true | <+QUARANTINE_BACKUPS> true))"
5100+
));
5101+
assert!(output.contains(
5102+
"always([+ROTATE_BACKUP_ENCRYPTION_KEY] true -> eventually(<+NOTIFY_BACKUP_OWNER> true))"
5103+
));
5104+
}
5105+
50925106
#[test]
50935107
fn synthesis_list_includes_escrow_progression_prompt_examples() {
50945108
let output = synthesis_list_text();
@@ -15128,6 +15142,22 @@ gfp(X, []((X)) & ([<+ARCHIVE>] true))
1512815142
verify_synthesized_model(&model, &formulas).unwrap();
1512915143
}
1513015144

15145+
#[test]
15146+
fn verify_synthesized_model_accepts_backup_encryption_key_leak_prompt_examples() {
15147+
let formulas = parse_formula_strings(&[
15148+
"always([+BACKUP_ENCRYPTION_KEY_LEAKED] true -> (<+ROTATE_BACKUP_ENCRYPTION_KEY> true | <+QUARANTINE_BACKUPS> true))"
15149+
.to_string(),
15150+
"always([+ROTATE_BACKUP_ENCRYPTION_KEY] true -> eventually(<+NOTIFY_BACKUP_OWNER> true))"
15151+
.to_string(),
15152+
]);
15153+
let model = modality_lang::formula_synthesis::synthesize_from_formulas(
15154+
"BackupEncryptionKeyLeak",
15155+
&formulas,
15156+
);
15157+
15158+
verify_synthesized_model(&model, &formulas).unwrap();
15159+
}
15160+
1513115161
#[test]
1513215162
fn verify_synthesized_model_accepts_mixed_alternatives_with_signer_requirement() {
1513315163
let formulas = parse_formula_strings(&[

0 commit comments

Comments
 (0)