Skip to content

Commit fb0db13

Browse files
synthesis: add database password examples
1 parent 76902ae commit fb0db13

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
@@ -487,6 +487,8 @@ const FORMULA_EXAMPLE_GROUPS: &[FormulaExampleGroup] = &[
487487
r#"always([+ROTATE_TLS_CERTIFICATE] true -> eventually(<+NOTIFY_CERTIFICATE_OWNER> true))"#,
488488
r#"always([+SSH_PRIVATE_KEY_COMPROMISED] true -> (<+REVOKE_SSH_KEY> true | <+DISABLE_SSH_ACCESS> true))"#,
489489
r#"always([+REVOKE_SSH_KEY] true -> eventually(<+NOTIFY_SYSTEM_OWNER> true))"#,
490+
r#"always([+DATABASE_PASSWORD_LEAKED] true -> (<+ROTATE_DATABASE_PASSWORD> true | <+ISOLATE_DATABASE> true))"#,
491+
r#"always([+ROTATE_DATABASE_PASSWORD] true -> eventually(<+NOTIFY_DATABASE_OWNER> true))"#,
490492
r#"next(<+APPROVE> true)"#,
491493
r#"next((<+APPROVE> true | [<+REJECT>] true))"#,
492494
r#"<+WAIT> true until <+APPROVE> true"#,
@@ -4963,6 +4965,18 @@ F2: formula generated_2 {
49634965
));
49644966
}
49654967

4968+
#[test]
4969+
fn synthesis_list_includes_database_password_leak_prompt_examples() {
4970+
let output = synthesis_list_text();
4971+
4972+
assert!(output.contains(
4973+
"always([+DATABASE_PASSWORD_LEAKED] true -> (<+ROTATE_DATABASE_PASSWORD> true | <+ISOLATE_DATABASE> true))"
4974+
));
4975+
assert!(output.contains(
4976+
"always([+ROTATE_DATABASE_PASSWORD] true -> eventually(<+NOTIFY_DATABASE_OWNER> true))"
4977+
));
4978+
}
4979+
49664980
#[test]
49674981
fn synthesis_list_includes_escrow_progression_prompt_examples() {
49684982
let output = synthesis_list_text();
@@ -14860,6 +14874,22 @@ gfp(X, []((X)) & ([<+ARCHIVE>] true))
1486014874
verify_synthesized_model(&model, &formulas).unwrap();
1486114875
}
1486214876

14877+
#[test]
14878+
fn verify_synthesized_model_accepts_database_password_leak_prompt_examples() {
14879+
let formulas = parse_formula_strings(&[
14880+
"always([+DATABASE_PASSWORD_LEAKED] true -> (<+ROTATE_DATABASE_PASSWORD> true | <+ISOLATE_DATABASE> true))"
14881+
.to_string(),
14882+
"always([+ROTATE_DATABASE_PASSWORD] true -> eventually(<+NOTIFY_DATABASE_OWNER> true))"
14883+
.to_string(),
14884+
]);
14885+
let model = modality_lang::formula_synthesis::synthesize_from_formulas(
14886+
"DatabasePasswordLeak",
14887+
&formulas,
14888+
);
14889+
14890+
verify_synthesized_model(&model, &formulas).unwrap();
14891+
}
14892+
1486314893
#[test]
1486414894
fn verify_synthesized_model_accepts_mixed_alternatives_with_signer_requirement() {
1486514895
let formulas = parse_formula_strings(&[

0 commit comments

Comments
 (0)