Skip to content

Commit

Permalink
[Pal/Linux-SGX] Warn about "allowed_files" usage
Browse files Browse the repository at this point in the history
"allowed_files" is an insecure feature, which cannot be safely used in
production environments.

Signed-off-by: Borys Popławski <borysp@invisiblethingslab.com>
  • Loading branch information
boryspoplawski committed Sep 23, 2021
1 parent ff5a2da commit e637fab
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Pal/src/host/Linux-SGX/enclave_framework.c
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,16 @@ static int init_trusted_files_from_toml_array(void) {
return ret;
}

static void maybe_warn_about_allowed_files_usage(void) {
static bool g_allowed_files_warned = false;

if (!g_pal_state.parent_process && !g_allowed_files_warned) {
log_always("WARNING! \"allowed_files\" is an insecure feature designed for debugging and "
"prototyping, it must never be used in production!");
g_allowed_files_warned = true;
}
}

static int init_allowed_files_from_toml_table(void) {
int ret;

Expand All @@ -770,6 +780,8 @@ static int init_allowed_files_from_toml_table(void) {
if (!toml_allowed_files)
return 0;

maybe_warn_about_allowed_files_usage();

ssize_t toml_allowed_files_cnt = toml_table_nkval(toml_allowed_files);
if (toml_allowed_files_cnt < 0)
return -PAL_ERROR_DENIED;
Expand Down Expand Up @@ -825,6 +837,8 @@ static int init_allowed_files_from_toml_array(void) {
if (!toml_allowed_files)
return 0;

maybe_warn_about_allowed_files_usage();

ssize_t toml_allowed_files_cnt = toml_array_nelem(toml_allowed_files);
if (toml_allowed_files_cnt < 0)
return -PAL_ERROR_DENIED;
Expand Down

0 comments on commit e637fab

Please sign in to comment.