|
| 1 | +# Contentful CLI - `sec-check` command |
| 2 | + |
| 3 | +This command runs a series of security checks on a Contentful Organization. |
| 4 | + |
| 5 | +| Check | Description | |
| 6 | +|-------|-------------| |
| 7 | +| `permission_check` | Validates user has sufficient privileges (owner/admin) to perform security checks | |
| 8 | +| `security_contact_set` | Ensures ≥1 security contact is configured | |
| 9 | +| `audit_logging_configured` | Confirms audit logging is enabled | |
| 10 | +| `active_tokens_with_long_expiry` | Flags active access tokens whose expiration date is more than 1 year in the future | |
| 11 | +| `sso_enabled` | Validates SSO is enabled | |
| 12 | +| `sso_enforced` | Validates SSO restricted mode is on | |
| 13 | +| `sso_exempt_users` | Flags users exempt from SSO enforcement | |
| 14 | +| `sso_exempt_users_with_mfa_disabled` | Flags SSO-exempt users without MFA | |
| 15 | + |
| 16 | + |
| 17 | +## Usage |
| 18 | +``` |
| 19 | +Usage: contentful organization sec-check --organization-id <organization-id> |
| 20 | +
|
| 21 | +Options: |
| 22 | + -h, --help Show help [boolean] |
| 23 | + --organization-id, --oid Contentful organization ID [string] [required] |
| 24 | + --management-token, --mt Contentful management API token (overrides stored |
| 25 | + context token) [string] |
| 26 | + --header, -H Pass an additional HTTP Header [string] |
| 27 | + --output-file, -o Write JSON results to a file. If used without a |
| 28 | + filename, a default file |
| 29 | + ./data/<timestamp>-<org-id>-sec-check.json is |
| 30 | + created. [string] |
| 31 | +``` |
| 32 | + |
| 33 | +## Prerequisites |
| 34 | +- A Contentful Management API token with org admin/owner permissions to read organization settings. |
| 35 | + |
| 36 | + |
| 37 | +## Example |
| 38 | + |
| 39 | +``` |
| 40 | +contentful organization sec-check --organization-id 123456789 -o |
| 41 | +``` |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | +Outputs JSON with fields: |
| 47 | +``` |
| 48 | +{ |
| 49 | + "permission_check": { |
| 50 | + "description": "User has owner or admin role in the organization", |
| 51 | + "pass": true |
| 52 | + }, |
| 53 | + "security_contact_set": { |
| 54 | + "description": "Security contact is configured for the organization", |
| 55 | + "pass": true, |
| 56 | + "data": { |
| 57 | + "contactCount": 1 |
| 58 | + } |
| 59 | + }, |
| 60 | + "audit_logging_configured": { |
| 61 | + "description": "Audit logging is configured for the organization", |
| 62 | + "pass": true, |
| 63 | + "data": { |
| 64 | + "itemCount": 1 |
| 65 | + } |
| 66 | + }, |
| 67 | + "active_tokens_with_long_expiry": { |
| 68 | + "description": "Active (not revoked) access tokens whose expiration date is more than 1 year in the future.", |
| 69 | + "pass": false, |
| 70 | + "data": { |
| 71 | + "offendingCount": 6 |
| 72 | + } |
| 73 | + }, |
| 74 | + "sso_enabled": { |
| 75 | + "description": "SSO is enabled for the organization", |
| 76 | + "pass": true |
| 77 | + }, |
| 78 | + "sso_enforced": { |
| 79 | + "description": "SSO is enforced (restricted) for the organization", |
| 80 | + "pass": true |
| 81 | + }, |
| 82 | + "sso_exempt_users": { |
| 83 | + "description": "Check if users are exempted from SSO restricted mode (bypass SSO).", |
| 84 | + "pass": false, |
| 85 | + "data": { |
| 86 | + "exemptUserIds": [ |
| 87 | + "2qEuWkv9GLQ8ypPK96xjZk" |
| 88 | + ], |
| 89 | + "exemptCount": 1 |
| 90 | + } |
| 91 | + }, |
| 92 | + "sso_exempt_users_with_mfa_disabled": { |
| 93 | + "description": "Exempt users have MFA (2FA) enabled (reports users without MFA).", |
| 94 | + "pass": false, |
| 95 | + "data": { |
| 96 | + "mfaDisabledUsers": [ |
| 97 | + { |
| 98 | + "id": "2qEuWkv9GLQ8ypPK96xjZk", |
| 99 | + "email": "hussam.khrais+test@foo.com" |
| 100 | + } |
| 101 | + ], |
| 102 | + "mfaDisabledCount": 1 |
| 103 | + } |
| 104 | + } |
| 105 | +} |
| 106 | +``` |
| 107 | +A check with pass:false indicates action required. |
0 commit comments