core: Sanitize error text validating refs (e.g. against HTML)
See: https://github.com/projectatomic/rpm-ostree/issues/885 If we get a successful Apache directory listing HTML when fetching what we intend to be a ref, we'd dump the HTML into the error. I did some scanning of the pull code, and this was the only case I saw offhand where we were dumping text out into an error. Which makes sense, since most of our formats are binary, the exeptions I think are just `repo/config` and `repo/refs/`. Closes: #1015 Approved by: mbarnes
This commit is contained in:
1 parent
bed931c91f
commit
c740b7f6d2
4 files changed
+59
-5
No files matched your search
@@ -876,6 +876,7 @@ scan_dirtree_object (OtPullData *pull_data,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Given a @ref, fetch its contents (should be a SHA256 ASCII string) */
|
||||
static gboolean
|
||||
fetch_ref_contents (OtPullData *pull_data,
|
||||
const char *main_collection_id,
|
||||
@@ -901,7 +902,7 @@ fetch_ref_contents (OtPullData *pull_data,
|
||||
g_strchomp (ret_contents);
|
||||
|
||||
if (!ostree_validate_checksum_string (ret_contents, error))
|
||||
return FALSE;
|
||||
return glnx_prefix_error (error, "Fetching %s", filename);
|
||||
|
||||
ot_transfer_out_value (out_contents, &ret_contents);
|
||||
return TRUE;
|
||||
@@ -1992,7 +1993,7 @@ load_remote_repo_config (OtPullData *pull_data,
|
||||
g_autoptr(GKeyFile) ret_keyfile = g_key_file_new ();
|
||||
if (!g_key_file_load_from_data (ret_keyfile, contents, strlen (contents),
|
||||
0, error))
|
||||
return FALSE;
|
||||
return glnx_prefix_error (error, "Parsing config");
|
||||
|
||||
ot_transfer_out_value (out_keyfile, &ret_keyfile);
|
||||
return TRUE;
|
||||
|
||||
Reference in new issue
Block a user