Skip to content

Commit 1ee5f7c

Browse files
committed
fix: missing certification object in CEL expressions
1 parent e7eb8ff commit 1ee5f7c

File tree

2 files changed

+130
-108
lines changed

2 files changed

+130
-108
lines changed

packages/ic-http-certification/src/cel/create_cel_expr.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ fn create_default_cel_expr(certification: &Option<DefaultCertification>) -> Stri
1818
match certification {
1919
None => cel_expr.push_str("no_certification:Empty{}"),
2020
Some(certification) => {
21+
cel_expr.push_str("certification:Certification{");
2122
create_request_cel_expr(&mut cel_expr, certification.request_certification.as_ref());
2223
create_response_cel_expr(&mut cel_expr, &certification.response_certification);
24+
cel_expr.push_str("}");
2325
}
2426
}
2527

packages/ic-http-certification/src/cel/fixtures.rs

Lines changed: 128 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,18 @@ pub(super) fn no_request_response_inclusions_cel() -> String {
1616
remove_whitespace(
1717
r#"default_certification(
1818
ValidationArgs {
19-
no_request_certification: Empty {},
20-
response_certification: ResponseCertification {
21-
certified_response_headers: ResponseHeaderList {
22-
headers: [
23-
"Cache-Control",
24-
"ETag",
25-
"Content-Length",
26-
"Content-Type",
27-
"Content-Encoding"
28-
]
19+
certification: Certification {
20+
no_request_certification: Empty {},
21+
response_certification: ResponseCertification {
22+
certified_response_headers: ResponseHeaderList {
23+
headers: [
24+
"Cache-Control",
25+
"ETag",
26+
"Content-Length",
27+
"Content-Type",
28+
"Content-Encoding"
29+
]
30+
}
2931
}
3032
}
3133
}
@@ -38,14 +40,16 @@ pub(super) fn no_request_response_exclusions_cel() -> String {
3840
remove_whitespace(
3941
r#"default_certification(
4042
ValidationArgs {
41-
no_request_certification: Empty {},
42-
response_certification: ResponseCertification {
43-
response_header_exclusions: ResponseHeaderList {
44-
headers: [
45-
"Date",
46-
"Cookie",
47-
"Set-Cookie"
48-
]
43+
certification: Certification {
44+
no_request_certification: Empty {},
45+
response_certification: ResponseCertification {
46+
response_header_exclusions: ResponseHeaderList {
47+
headers: [
48+
"Date",
49+
"Cookie",
50+
"Set-Cookie"
51+
]
52+
}
4953
}
5054
}
5155
}
@@ -58,10 +62,12 @@ pub(super) fn no_request_empty_response_inclusions_cel() -> String {
5862
remove_whitespace(
5963
r#"default_certification(
6064
ValidationArgs {
61-
no_request_certification: Empty {},
62-
response_certification: ResponseCertification {
63-
certified_response_headers: ResponseHeaderList {
64-
headers: []
65+
certification: Certification {
66+
no_request_certification: Empty {},
67+
response_certification: ResponseCertification {
68+
certified_response_headers: ResponseHeaderList {
69+
headers: []
70+
}
6571
}
6672
}
6773
}
@@ -74,10 +80,12 @@ pub(super) fn no_request_empty_response_exclusions_cel() -> String {
7480
remove_whitespace(
7581
r#"default_certification(
7682
ValidationArgs {
77-
no_request_certification: Empty {},
78-
response_certification: ResponseCertification {
79-
response_header_exclusions: ResponseHeaderList {
80-
headers: []
83+
certification: Certification {
84+
no_request_certification: Empty {},
85+
response_certification: ResponseCertification {
86+
response_header_exclusions: ResponseHeaderList {
87+
headers: []
88+
}
8189
}
8290
}
8391
}
@@ -90,27 +98,29 @@ pub(super) fn include_request_response_header_inclusions_cel() -> String {
9098
remove_whitespace(
9199
r#"default_certification(
92100
ValidationArgs {
93-
request_certification: RequestCertification {
94-
certified_request_headers: [
95-
"Accept",
96-
"Accept-Encoding",
97-
"If-Match"
98-
],
99-
certified_query_parameters: [
100-
"foo",
101-
"bar",
102-
"baz"
103-
]
104-
},
105-
response_certification: ResponseCertification {
106-
certified_response_headers: ResponseHeaderList {
107-
headers: [
108-
"Cache-Control",
109-
"ETag",
110-
"Content-Length",
111-
"Content-Type",
112-
"Content-Encoding"
101+
certification: Certification {
102+
request_certification: RequestCertification {
103+
certified_request_headers: [
104+
"Accept",
105+
"Accept-Encoding",
106+
"If-Match"
107+
],
108+
certified_query_parameters: [
109+
"foo",
110+
"bar",
111+
"baz"
113112
]
113+
},
114+
response_certification: ResponseCertification {
115+
certified_response_headers: ResponseHeaderList {
116+
headers: [
117+
"Cache-Control",
118+
"ETag",
119+
"Content-Length",
120+
"Content-Type",
121+
"Content-Encoding"
122+
]
123+
}
114124
}
115125
}
116126
}
@@ -123,25 +133,27 @@ pub(super) fn include_request_response_header_exclusions_cel() -> String {
123133
remove_whitespace(
124134
r#"default_certification(
125135
ValidationArgs {
126-
request_certification: RequestCertification {
127-
certified_request_headers: [
128-
"Accept",
129-
"Accept-Encoding",
130-
"If-Match"
131-
],
132-
certified_query_parameters: [
133-
"foo",
134-
"bar",
135-
"baz"
136-
]
137-
},
138-
response_certification: ResponseCertification {
139-
response_header_exclusions: ResponseHeaderList {
140-
headers: [
141-
"Date",
142-
"Cookie",
143-
"Set-Cookie"
136+
certification: Certification {
137+
request_certification: RequestCertification {
138+
certified_request_headers: [
139+
"Accept",
140+
"Accept-Encoding",
141+
"If-Match"
142+
],
143+
certified_query_parameters: [
144+
"foo",
145+
"bar",
146+
"baz"
144147
]
148+
},
149+
response_certification: ResponseCertification {
150+
response_header_exclusions: ResponseHeaderList {
151+
headers: [
152+
"Date",
153+
"Cookie",
154+
"Set-Cookie"
155+
]
156+
}
145157
}
146158
}
147159
}
@@ -154,21 +166,23 @@ pub(super) fn include_request_empty_response_inclusions_cel() -> String {
154166
remove_whitespace(
155167
r#"default_certification(
156168
ValidationArgs {
157-
request_certification: RequestCertification {
158-
certified_request_headers: [
159-
"Accept",
160-
"Accept-Encoding",
161-
"If-Match"
162-
],
163-
certified_query_parameters: [
164-
"foo",
165-
"bar",
166-
"baz"
167-
]
168-
},
169-
response_certification: ResponseCertification {
170-
certified_response_headers: ResponseHeaderList {
171-
headers: []
169+
certification: Certification {
170+
request_certification: RequestCertification {
171+
certified_request_headers: [
172+
"Accept",
173+
"Accept-Encoding",
174+
"If-Match"
175+
],
176+
certified_query_parameters: [
177+
"foo",
178+
"bar",
179+
"baz"
180+
]
181+
},
182+
response_certification: ResponseCertification {
183+
certified_response_headers: ResponseHeaderList {
184+
headers: []
185+
}
172186
}
173187
}
174188
}
@@ -181,21 +195,23 @@ pub(super) fn include_request_empty_response_exclusions_cel() -> String {
181195
remove_whitespace(
182196
r#"default_certification(
183197
ValidationArgs {
184-
request_certification: RequestCertification {
185-
certified_request_headers: [
186-
"Accept",
187-
"Accept-Encoding",
188-
"If-Match"
189-
],
190-
certified_query_parameters: [
191-
"foo",
192-
"bar",
193-
"baz"
194-
]
195-
},
196-
response_certification: ResponseCertification {
197-
response_header_exclusions: ResponseHeaderList {
198-
headers: []
198+
certification: Certification {
199+
request_certification: RequestCertification {
200+
certified_request_headers: [
201+
"Accept",
202+
"Accept-Encoding",
203+
"If-Match"
204+
],
205+
certified_query_parameters: [
206+
"foo",
207+
"bar",
208+
"baz"
209+
]
210+
},
211+
response_certification: ResponseCertification {
212+
response_header_exclusions: ResponseHeaderList {
213+
headers: []
214+
}
199215
}
200216
}
201217
}
@@ -208,13 +224,15 @@ pub(super) fn empty_request_response_inclusions_cel() -> String {
208224
remove_whitespace(
209225
r#"default_certification(
210226
ValidationArgs {
211-
request_certification: RequestCertification {
212-
certified_request_headers: [],
213-
certified_query_parameters: []
214-
},
215-
response_certification: ResponseCertification {
216-
certified_response_headers: ResponseHeaderList {
217-
headers: []
227+
certification: Certification {
228+
request_certification: RequestCertification {
229+
certified_request_headers: [],
230+
certified_query_parameters: []
231+
},
232+
response_certification: ResponseCertification {
233+
certified_response_headers: ResponseHeaderList {
234+
headers: []
235+
}
218236
}
219237
}
220238
}
@@ -227,13 +245,15 @@ pub(super) fn empty_request_response_exclusions_cel() -> String {
227245
remove_whitespace(
228246
r#"default_certification(
229247
ValidationArgs {
230-
request_certification: RequestCertification {
231-
certified_request_headers: [],
232-
certified_query_parameters: []
233-
},
234-
response_certification: ResponseCertification {
235-
response_header_exclusions: ResponseHeaderList {
236-
headers: []
248+
certification: Certification {
249+
request_certification: RequestCertification {
250+
certified_request_headers: [],
251+
certified_query_parameters: []
252+
},
253+
response_certification: ResponseCertification {
254+
response_header_exclusions: ResponseHeaderList {
255+
headers: []
256+
}
237257
}
238258
}
239259
}

0 commit comments

Comments
 (0)