diff --git a/DESCRIPTION b/DESCRIPTION index 8e5ab79..21b1a0c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: audit.base Title: Base package for Posit Checks -Version: 0.6.14 +Version: 0.6.15 Authors@R: person("Jumping", "Rivers", , "info@jumpingrivers.com", role = c("aut", "cre")) Description: Base package for sharing classes between posit audit diff --git a/NEWS.md b/NEWS.md index ede656e..13fb2d4 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,8 @@ +# audit.base 0.6.15 _2024-06-06_ +- feat: Add support for Centos +- fix: Update software version numbers +- fix: Fix output for Posit drivers + # audit.base 0.6.14 _2024-04-04_ - fix: Improve feedback when checking sys deps diff --git a/R/check_server_headers.R b/R/check_server_headers.R index 87efeeb..37b2cef 100644 --- a/R/check_server_headers.R +++ b/R/check_server_headers.R @@ -1,6 +1,6 @@ #' Check server headers #' -#' In addition to the checks made by {serverHeaders} we also check +#' In addition to the checks made by serverHeaders we also check #' that Posit isn't in one of the headers. #' @param server URL of server #' @export diff --git a/R/check_sys_deps.R b/R/check_sys_deps.R index 06ecf02..69066c8 100644 --- a/R/check_sys_deps.R +++ b/R/check_sys_deps.R @@ -38,10 +38,12 @@ get_os_sys_deps = function(os_release) { } else if (is_redhat(os_release_df)) { id = "redhat" version_id = stringr::str_remove(version_id, "\\..*") + } else if (is_centos(os_release_df)) { + id = "centos" + version_id = stringr::str_remove(version_id, "\\..*") } else { - stop("Not supported") + cli::cli_abort("This OS isn't supported") } - reqs = get_pkg_requirements(distribution = id, release = version_id) reqs[!is.na(reqs$sys_libs), ] } @@ -57,7 +59,7 @@ get_installed_libs = function() { if (is_ubuntu(os_release_df)) { libs = processx::run("apt", args = c("list", "--installed")) libs = stringr::str_split(libs$stdout, "\n")[[1]][-1] - } else if (is_redhat(os_release_df)) { + } else if (is_redhat(os_release_df) || is_centos(os_release_df)) { libs = processx::run("yum", args = c("list", "installed"))$stdout libs = stringr::str_split(libs, "\n")[[1]][-(1:2)] } else { @@ -75,7 +77,7 @@ clean_libs = function(os_release, libs) { os_release_df = os_release_to_df(os_release) if (is_ubuntu(os_release_df)) { libs = stringr::str_match(libs, "^[^/]*")[, 1] - } else if (is_redhat(os_release_df)) { + } else if (is_redhat(os_release_df) || is_centos(os_release_df)) { libs = stringr::str_match(libs, "^[^\\.]*")[, 1] } else { cli::cli_abort("We don't support this OS yet") diff --git a/R/get_pkg_requirements.R b/R/get_pkg_requirements.R index cf84553..ac0d192 100644 --- a/R/get_pkg_requirements.R +++ b/R/get_pkg_requirements.R @@ -1,5 +1,5 @@ # https://packagemanager.rstudio.com/__api__/swagger/index.html#/default/get_repos -get_pkg_requirements = function(distribution = c("ubuntu", "redhat"), +get_pkg_requirements = function(distribution = c("ubuntu", "redhat", "centos"), release = c("18.04", "20.04", "22.04", "7", "8", "9"), base_url = "https://packagemanager.rstudio.com/__api__/repos/", repo_id = 2) { diff --git a/R/os-helper-functions.R b/R/os-helper-functions.R index 884f520..71ef569 100644 --- a/R/os-helper-functions.R +++ b/R/os-helper-functions.R @@ -8,6 +8,11 @@ is_redhat = function(os_release_df) { stringr::str_detect(os_name, pattern = "red hat") } +is_centos = function(os_release_df) { + os_name = os_release_df[os_release_df$name == "name", ]$value + stringr::str_detect(os_name, pattern = "centos") +} + get_os_release = function() { os_release = readr::read_lines("/etc/os-release") os_release diff --git a/R/software-versions.R b/R/software-versions.R index 4c6ffd1..4f27444 100644 --- a/R/software-versions.R +++ b/R/software-versions.R @@ -1,6 +1,6 @@ #' Augments installed software columns #' @param installed A tibble with columns software and installed_version -#' @param verbose Default TRUE. Out a {cli} summary +#' @param verbose Default TRUE. #' @export augment_installed = function(installed, verbose = TRUE) { installed$installed_major = get_major(installed$installed_version) @@ -24,10 +24,11 @@ print_colour_versions = function(installed) { } print_colour_version = function(row) { - software_name = glue::glue("{stringr::str_to_title(row$software)} v{row$major}") - latest_version = glue::glue("latest v{row$version}") + major = if ("major" %in% colnames(row)) paste0(" v", row$major) else "" + software_name = glue::glue("{stringr::str_to_title(row$software)}{major}") + latest_version = glue::glue("v{row$version}") if (is.na(row$installed_version)) { - cli::cli_alert_danger("{software_name}: {latest_version} not installed") + cli::cli_alert_danger("{software_name}: latest {latest_version} not installed") return(invisible(NULL)) } diff --git a/inst/extdata/versions/connect.csv b/inst/extdata/versions/connect.csv index ec0a5bc..9e6a8d3 100644 --- a/inst/extdata/versions/connect.csv +++ b/inst/extdata/versions/connect.csv @@ -1,5 +1,16 @@ #https://docs.posit.co/connect/news/ version,date,cve +2024.05.0,2024-05-31,CVE-2024-24787 +2024.05.0,2024-05-31,CVE-2024-24788 +2024.04.1,2024-05-07, +2024.04.0,2024-04-29,CVE-2023-39320 +2024.04.0,2024-04-29,CVE-2023-39320 +2024.04.0,2024-04-29,CVE-2023-39319 +2024.04.0,2024-04-29,CVE-2023-39321 +2024.04.0,2024-04-29,CVE-2023-45288 +2024.04.0,2024-04-29,CVE-2023-45857 +2024.04.0,2024-04-29,CVE-2024-31207 +2024.03.0,2024-03-28, 2024.02.0,2024-02-27,CVE-2023-7104 2024.01.0,2024-01-25,CVE-2023-48795 2024.01.0,2024-01-25,CVE-2023-45683 diff --git a/inst/extdata/versions/software.csv b/inst/extdata/versions/software.csv index b085880..b7fcad4 100644 --- a/inst/extdata/versions/software.csv +++ b/inst/extdata/versions/software.csv @@ -1,14 +1,15 @@ software,version -python,3.12.2 -python,3.11.8 +python,3.12.3 +python,3.11.9 python,3.10.14 python,3.9.19 python,3.8.19 python,3.7.17 -quarto,1.4.552 +quarto,1.4.555 quarto,1.2.475 quarto,1.1.189 quarto,1.0.38 +r,4.4.0 r,4.3.3 r,4.2.3 r,4.1.3 diff --git a/inst/extdata/versions/workbench.csv b/inst/extdata/versions/workbench.csv index 876f716..66337fc 100644 --- a/inst/extdata/versions/workbench.csv +++ b/inst/extdata/versions/workbench.csv @@ -1,5 +1,7 @@ # https://docs.posit.co/ide/news/ version,date,cve +2024.04.1,2024-05-13, +2024.04.0,2024-04-29, 2023.12.1,2024-01-29, 2023.12.0,2023-12-15, 2023.09.1,2023-10-17, diff --git a/man/augment_installed.Rd b/man/augment_installed.Rd index 4aa0c47..11da973 100644 --- a/man/augment_installed.Rd +++ b/man/augment_installed.Rd @@ -12,7 +12,7 @@ print_colour_versions(installed) \arguments{ \item{installed}{A tibble with columns software and installed_version} -\item{verbose}{Default TRUE. Out a {cli} summary} +\item{verbose}{Default TRUE.} } \description{ Augments installed software columns diff --git a/man/check_server_headers.Rd b/man/check_server_headers.Rd index e41baad..2419381 100644 --- a/man/check_server_headers.Rd +++ b/man/check_server_headers.Rd @@ -10,6 +10,6 @@ check_server_headers(server) \item{server}{URL of server} } \description{ -In addition to the checks made by {serverHeaders} we also check +In addition to the checks made by serverHeaders we also check that Posit isn't in one of the headers. }