Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keylime-agent/src: update API version to 2.1 to consistent with https//github.com/keylime/keylime/blob/master/docs/rest_apis.rst #588

Merged
merged 1 commit into from
May 29, 2023
Merged
Show file tree
Hide file tree
Changes from all 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 keylime-agent/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use tss_esapi::{
/*
* Constants and static variables
*/
pub const API_VERSION: &str = "v2.0";
pub const API_VERSION: &str = "v2.1";
pub const TPM_DATA_PCR: usize = 16;
pub const IMA_PCR: usize = 10;
pub static RSA_PUBLICKEY_EXPORTABLE: &str = "rsa placeholder";
Expand Down
12 changes: 6 additions & 6 deletions keylime-agent/src/errors_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,10 +395,10 @@ mod tests {
.error_handler(path_parser_error),
)
.service(
web::resource("/v2.0/ok").route(web::get().to(dummy)),
web::resource("/v2.1/ok").route(web::get().to(dummy)),
)
.service(
web::resource("/v2.0/ok/{number}/{string}")
web::resource("/v2.1/ok/{number}/{string}")
.route(web::get().to(dummy_with_path)),
)
.service(
Expand All @@ -410,7 +410,7 @@ mod tests {

// Sanity well formed request
let req = test::TestRequest::get()
.uri("/v2.0/ok?param=Test")
.uri("/v2.1/ok?param=Test")
.set_json(&DummyPayload { field: 42 })
.to_request();

Expand All @@ -432,7 +432,7 @@ mod tests {

// Test JSON parsing error
let req = test::TestRequest::get()
.uri("/v2.0/ok?param=Test")
.uri("/v2.1/ok?param=Test")
.insert_header(http::header::ContentType::json())
.set_payload("Not JSON")
.to_request();
Expand All @@ -445,7 +445,7 @@ mod tests {

// Test Query parsing error
let req = test::TestRequest::get()
.uri("/v2.0/ok?test=query")
.uri("/v2.1/ok?test=query")
.set_json(&DummyPayload { field: 42 })
.to_request();
let resp = test::call_service(&app, req).await;
Expand All @@ -457,7 +457,7 @@ mod tests {

// Test Path parsing error
let req = test::TestRequest::get()
.uri("/v2.0/ok/something/42?test=query")
.uri("/v2.1/ok/something/42?test=query")
.set_json(&DummyPayload { field: 42 })
.to_request();
let resp = test::call_service(&app, req).await;
Expand Down
8 changes: 4 additions & 4 deletions keylime-agent/src/quotes_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ pub async fn integrity(
param: web::Query<Integ>,
data: web::Data<QuoteData>,
) -> impl Responder {
// nonce, mask, vmask can only be in alphanumerical format
// nonce, mask can only be in alphanumerical format
if !param.nonce.chars().all(char::is_alphanumeric) {
warn!("Get quote returning 400 response. Parameters should be strictly alphanumeric: {}", param.nonce);
return HttpResponse::BadRequest().json(JsonWrapper::error(
Expand Down Expand Up @@ -396,7 +396,7 @@ mod tests {

let req = test::TestRequest::get()
.uri(&format!(
"/{API_VERSION}/quotes/integrity?nonce=1234567890ABCDEFHIJ&mask=0x408000&vmask=0x808000&partial=0",
"/{API_VERSION}/quotes/integrity?nonce=1234567890ABCDEFHIJ&mask=0x408000&partial=0",
))
.to_request();

Expand Down Expand Up @@ -454,7 +454,7 @@ mod tests {

let req = test::TestRequest::get()
.uri(&format!(
"/{API_VERSION}/quotes/integrity?nonce=1234567890ABCDEFHIJ&mask=0x408000&vmask=0x808000&partial=1",
"/{API_VERSION}/quotes/integrity?nonce=1234567890ABCDEFHIJ&mask=0x408000&partial=1",
))
.to_request();

Expand Down Expand Up @@ -510,7 +510,7 @@ mod tests {

let req = test::TestRequest::get()
.uri(&format!(
"/{API_VERSION}/quotes/integrity?nonce=1234567890ABCDEFHIJ&mask=0x408000&vmask=0x808000&partial=0",
"/{API_VERSION}/quotes/integrity?nonce=1234567890ABCDEFHIJ&mask=0x408000&partial=0",
))
.to_request();

Expand Down