Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cedar-policy-formatter/src/pprint/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ pub fn remove_empty_lines(text: &str) -> String {
let comment_regex = Regex::new(r"//[^\n]*").unwrap();
// PANIC SAFETY: this regex pattern is valid
#[allow(clippy::unwrap_used)]
let string_regex = Regex::new(r#""(\\.|[^"\\])*"[^\n]*"#).unwrap();
let string_regex = Regex::new(r#""(\\.|[^"\\])*""#).unwrap();

let mut index = 0;
let mut final_text = String::new();
Expand Down
19 changes: 19 additions & 0 deletions cedar-policy-formatter/tests/blank_lines.cedar
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,23 @@ with a newline") when // trailing comment

// shouldn't matter "

};

// A fuzzer-generated policy that wasn't correctly formatter with the original fix
permit(
principal is User in Group::"friends",
action,
resource is Photo in Album::"vacation"
) when {
(User::"alice" is User) && (User::"alice" in
Group::"








friends")
};
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,21 @@ when // trailing comment
// Quotes in comments "
// shouldn't matter "
};

// A fuzzer-generated policy that wasn't correctly formatter with the original fix
permit (
principal is User in Group::"friends",
action,
resource is Photo in Album::"vacation"
)
when
{ (User::"alice" is User) && (User::"alice" in Group::"








friends") };
4 changes: 2 additions & 2 deletions cedar-wasm/build-wasm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# Without this, the built wasm still works, but the Typescript definitions made by tsify don't.
set -e
cargo build
wasm-pack build --scope amzn --target bundler
wasm-pack build --scope cedar-policy --target bundler

sed -i "s/[{]\s*!: /{ \"!\": /g" pkg/cedar_wasm.d.ts
sed -i "s/[{]\s*==: /{ \"==\": /g" pkg/cedar_wasm.d.ts
Expand All @@ -40,4 +40,4 @@ echo "type Name = string;" >> pkg/cedar_wasm.d.ts
echo "type Id = string;" >> pkg/cedar_wasm.d.ts
echo "export type TypeOfAttribute = SchemaType & { required?: boolean };" >> pkg/cedar_wasm.d.ts
echo "export type Context = Record<string, CedarValueJson>;" >> pkg/cedar_wasm.d.ts
echo "Finished post-processing types file"
echo "Finished post-processing types file"