eBPF-based security platform
bpm: drop the Content-Type the registry client never reads
Daniel Borkmann0fe0393ed910
diff --git a/Documentation/contribute/testing/proof-coverage.rst b/Documentation/contribute/testing/proof-coverage.rstindex 57192df4..b1da8ff7 100644--- a/Documentation/contribute/testing/proof-coverage.rst+++ b/Documentation/contribute/testing/proof-coverage.rst@@ -242,9 +242,9 @@ or shorter, and "lengths 0 to 6" every input of each of those lengths.and the challenge's field set to 24 and 4 bytes for their 4096and 2048- The whole line taken, and one too long for the copy read not at- all; values terminated, without a leading blank, a media type- without parameters, a location without CR or LF; a challenge- that fits kept whole, a longer one dropped rather than cut+ all; values terminated, without a leading blank, a location+ without CR or LF; a challenge that fits kept whole, a longer one+ dropped rather than cut* - ``bpm-oci-buffer``- ``bpm_buffer_append()``- A buffer of 0, 3, 8, 12 and 15 bytes holding any shorter body,diff --git a/testing/proofs/cbmc/bpm-oci-header.c b/testing/proofs/cbmc/bpm-oci-header.cindex e837bd31..e92bdedf 100644--- a/testing/proofs/cbmc/bpm-oci-header.c+++ b/testing/proofs/cbmc/bpm-oci-header.c@@ -4,12 +4,12 @@** bpm_header() of util/bpm_oci.c, libcurl's header callback, for every* header line of up to LINE_MAX bytes, NULs included: it takes the whole- * line, reads none longer than its copy, and the challenge, media type and- * location it keeps are terminated inside their fields, the media type- * without parameters, neither with a line break, a challenge longer than- * its field dropped rather than cut. The copy and the challenge's field- * are of 24 and 4 bytes here, for 4096 and 2048, which are past what- * CBMC can hold: the checks against them are the same expressions.+ * line, reads none longer than its copy, and the challenge and location+ * it keeps are terminated inside their fields, the location without a+ * line break, a challenge longer than its field dropped rather than cut.+ * The copy and the challenge's field are of 24 and 4 bytes here, for 4096+ * and 2048, which are past what CBMC can hold: the checks against them+ * are the same expressions.*/#define BPM_OCI_HEADER_LINE_MAX 24@@ -87,21 +87,16 @@ void harness(void)__CPROVER_assert(bpm_header(line, 1, n, &r) == n,"the whole line taken");if (n >= BPM_OCI_HEADER_LINE_MAX) {- __CPROVER_assert(!r.www_auth[0] && !r.content_type[0] &&- !r.location[0],+ __CPROVER_assert(!r.www_auth[0] && !r.location[0],"a line longer than the copy read not at all");return;}__CPROVER_assert(short_string(r.www_auth, sizeof(r.www_auth)) &&- short_string(r.content_type, sizeof(r.content_type)) &&short_string(r.location, sizeof(r.location)),"every value terminated inside its field");- __CPROVER_assert(!has_any(r.content_type, " ;\r\n"),- "a media type alone");__CPROVER_assert(!has_any(r.location, "\r\n"),"a location without its line break");__CPROVER_assert(!isspace((__u8)r.www_auth[0]) &&- !isspace((__u8)r.content_type[0]) &&!isspace((__u8)r.location[0]),"no value starts with a blank");if (named(line, n, "WWW-Authenticate:"))diff --git a/util/bpm_oci.c b/util/bpm_oci.cindex 06ee8f63..f4ccd038 100644--- a/util/bpm_oci.c+++ b/util/bpm_oci.c@@ -171,11 +171,6 @@ static size_t bpm_header(void *ptr, size_t size, size_t nmemb, void *ud)v++;if (strscpy(r->www_auth, v, sizeof(r->www_auth)) < 0)r->www_auth[0] = '\0';- } else if (str_skip_prefix_nocase(&v, "Content-Type:")) {- while (isspace((__u8)*v))- v++;- v[span_until(v, strlen(v), " ;\r\n")] = '\0';- bpm_copy_string(r->content_type, sizeof(r->content_type), v);} else if (str_skip_prefix_nocase(&v, "Location:")) {while (isspace((__u8)*v))v++;diff --git a/util/bpm_oci.h b/util/bpm_oci.hindex abf6bdf8..1f563709 100644--- a/util/bpm_oci.h+++ b/util/bpm_oci.h@@ -79,7 +79,6 @@ struct bpm_buffer {struct bpm_http_response {struct bpm_buffer body;char www_auth[BPM_OCI_CHALLENGE_MAX];- char content_type[BPM_MAX_MEDIA];char location[PATH_MAX];long status;};