Skip to content

Commit 33ca5ff

Browse files
committed
style: apply rustfmt and gofmt
Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
1 parent 948b19e commit 33ca5ff

2 files changed

Lines changed: 18 additions & 19 deletions

File tree

crates/apl-core/src/parser.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2082,17 +2082,6 @@ fn parse_stage(src: &str) -> Result<Stage, ParseError> {
20822082
("redact", None) => Ok(Stage::Redact { condition: None }),
20832083
("omit", None) => Ok(Stage::Omit),
20842084
("hash", None) => Ok(Stage::Hash),
2085-
// Scan placeholders parse as bare identifiers.
2086-
("pii.redact", None) => Ok(Stage::Scan {
2087-
kind: ScanKind::PiiRedact,
2088-
}),
2089-
("pii.detect", None) => Ok(Stage::Scan {
2090-
kind: ScanKind::PiiDetect,
2091-
}),
2092-
("injection.scan", None) => Ok(Stage::Scan {
2093-
kind: ScanKind::InjectionScan,
2094-
}),
2095-
20962085
("mask", Some(a)) => parse_stage_mask(a, &bad),
20972086
("redact", Some(a)) => parse_stage_redact_cond(a, src),
20982087
("hash", Some(_)) => Err(bad("hash takes no arguments")),
@@ -2103,10 +2092,20 @@ fn parse_stage(src: &str) -> Result<Stage, ParseError> {
21032092
("enum", Some(a)) => parse_stage_enum(a, &bad),
21042093
("regex", Some(a)) => Ok(parse_stage_regex(a)),
21052094
("validate", Some(a)) => Err(parse_stage_validate_rejected(a, &bad)),
2106-
// `run` is an alias for `plugin` (mirrors the policy-step alias).
21072095
("plugin" | "run", Some(a)) => parse_stage_plugin(head, a, &bad),
21082096
("taint", Some(a)) => parse_taint(a, src),
21092097

2098+
// Scan placeholders parse as bare identifiers.
2099+
("pii.redact", None) => Ok(Stage::Scan {
2100+
kind: ScanKind::PiiRedact,
2101+
}),
2102+
("pii.detect", None) => Ok(Stage::Scan {
2103+
kind: ScanKind::PiiDetect,
2104+
}),
2105+
("injection.scan", None) => Ok(Stage::Scan {
2106+
kind: ScanKind::InjectionScan,
2107+
}),
2108+
21102109
(other, _) => Err(bad(&format!("unknown stage `{}`", other))),
21112110
}
21122111
}

go/cpex/manager_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,13 +1187,13 @@ func TestLoadConfigInvalidYAML(t *testing.T) {
11871187
// handle survives.
11881188
//
11891189
// This test:
1190-
// 1. Performs a successful invoke to get a real ContextTable.
1191-
// 2. Calls InvokeByName again with that ContextTable PLUS an
1192-
// invalid payload_type that forces Rust to return RC_PARSE_ERROR
1193-
// AFTER the consumption point.
1194-
// 3. Confirms the second call errored (sanity).
1195-
// 4. Calls Close() on the original ContextTable — must NOT crash.
1196-
// Pre-fix this was a UAF (free of already-freed memory).
1190+
// 1. Performs a successful invoke to get a real ContextTable.
1191+
// 2. Calls InvokeByName again with that ContextTable PLUS an
1192+
// invalid payload_type that forces Rust to return RC_PARSE_ERROR
1193+
// AFTER the consumption point.
1194+
// 3. Confirms the second call errored (sanity).
1195+
// 4. Calls Close() on the original ContextTable — must NOT crash.
1196+
// Pre-fix this was a UAF (free of already-freed memory).
11971197
func TestInvokeByNameErrorDoesNotUAFContextTable(t *testing.T) {
11981198
mgr, err := NewPluginManagerDefault()
11991199
if err != nil {

0 commit comments

Comments
 (0)