#endif
#include "apparmor-support.h"
+#include "utils.h"
#include <string.h>
#include <errno.h>
}
debug("apparmor label on snap-confine is: %s", label);
debug("apparmor mode is: %s", mode);
- // The label has a special value "unconfined" that is applied to all
- // processes without a dedicated profile. If that label is used then the
- // current process is not confined. All other labels imply confinement.
- if (label != NULL && strcmp(label, SC_AA_UNCONFINED_STR) == 0) {
- apparmor->is_confined = false;
- } else {
+ // expect to be confined by a profile with the name of a valid
+ // snap-confine binary since if not we may be executed under a
+ // profile with more permissions than expected
+ if (label != NULL && sc_is_expected_path(label)) {
apparmor->is_confined = true;
+ } else {
+ apparmor->is_confined = false;
}
// There are several possible results for the confinement type (mode) that
// are checked for below.