Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: client/site_tests/security_ProfilePermissions/security_ProfilePermissions.py

Issue 6677093: add Profile Permissions test (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: Fix copyright dates Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « client/site_tests/security_ProfilePermissions/control ('k') | server/site_tests/suites/control.security » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/site_tests/security_ProfilePermissions/security_ProfilePermissions.py
diff --git a/client/site_tests/security_ProfilePermissions/security_ProfilePermissions.py b/client/site_tests/security_ProfilePermissions/security_ProfilePermissions.py
new file mode 100644
index 0000000000000000000000000000000000000000..5077405720bb2a71dce89ebd2fbcea7740a2a40d
--- /dev/null
+++ b/client/site_tests/security_ProfilePermissions/security_ProfilePermissions.py
@@ -0,0 +1,44 @@
+# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import logging
+import os
+import stat
+
+from autotest_lib.client.bin import test, utils
+from autotest_lib.client.common_lib import error
+from autotest_lib.client.cros import constants, cros_ui_test, login
+
+class security_ProfilePermissions(cros_ui_test.UITest):
+ version = 1
+ _HOMEDIR_MODE = 040700
+ auto_login = False
+ username = None
+ password = None
+
+ def run_once(self, creds=None):
+ """
+ Check permissions within cryptohome for anything too permissive.
+ """
+ if creds:
+ self.username = constants.CREDENTIALS[creds][0]
+ self.password = constants.CREDENTIALS[creds][1]
+
+ self.login(self.username, self.password)
+ login.wait_for_initial_chrome_window()
+
+ homepath = constants.CRYPTOHOME_MOUNT_PT
+ homemode = os.stat(homepath)[stat.ST_MODE]
+
+ if (homemode != self._HOMEDIR_MODE):
+ raise error.TestFail('%s permissions were %s' % (homepath,
+ oct(homemode)))
+
+ # Writable by anyone else is bad, as is owned by anyone else.
+ cmd = 'find -L "%s" -perm /022 -o \\! -user chronos -ls' % homepath
+ cmd_output = utils.system_output(cmd, ignore_status=True)
+
+ if (cmd_output != '') :
+ logging.error(cmd_output)
+ raise error.TestFail('Bad permissions found on cryptohome files')
« no previous file with comments | « client/site_tests/security_ProfilePermissions/control ('k') | server/site_tests/suites/control.security » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698