@cxbuilder/flow-config 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,132 @@
1
+ # Amazon Connect Flow Configs - Permissions Management (v1 - Initial Release)
2
+
3
+ ## Overview
4
+
5
+ This document outlines the permissions management strategy for the Amazon Connect Flow Configs initial release. Permissions are managed using Amazon Cognito User Groups with a simplified role-based access control (RBAC) model.
6
+
7
+ ## Authentication Flow
8
+
9
+ 1. Users are initially granted access to the Flow Configs via the Amazon Connect Admin Console
10
+ 2. Authentication is handled via Amazon Cognito, which is federated with the same SSO provider as Amazon Connect
11
+ 3. Users are assigned to appropriate Cognito User Groups based on their role
12
+ 4. API endpoints validate user group membership from Cognito tokens to enforce permissions
13
+
14
+ ## Authorization with Cognito User Groups
15
+
16
+ ### Core Concepts
17
+
18
+ - **Cognito User Groups**: Users are assigned to groups that determine their access levels
19
+ - **Access Levels**: Three permission tiers implemented via group membership
20
+ - **Global Permissions**: All permissions apply to all flow configs (no per-config restrictions in initial release)
21
+
22
+ ### Authorization Flow
23
+
24
+ 1. When a user authenticates, Cognito includes their group memberships in the JWT token
25
+ 2. API endpoints extract group information from the token
26
+ 3. Each API endpoint validates required group membership before processing requests
27
+ 4. Frontend UI adjusts based on user's group membership (disables controls for restricted users)
28
+
29
+ ### Cognito User Groups
30
+
31
+ The application uses three Cognito User Groups:
32
+
33
+ | Group Name | Permissions | Description |
34
+ | ----------------- | ------------------------------------------------------------ | ---------------------------------------------------- |
35
+ | `FlowConfigAdmin` | Create, Read, Update, Delete flow configs and all properties | Full administrative access to all flow configs |
36
+ | `FlowConfigEdit` | Read flow configs, Edit variable values and prompt content | Can modify existing values but not add/remove fields |
37
+ | `FlowConfigRead` | Read-only access to all flow configs | View-only access for reporting and reference |
38
+
39
+ ### Access Level Details
40
+
41
+ 1. **FlowConfigAdmin Group**:
42
+
43
+ - Create new flow configs
44
+ - Read all flow configs
45
+ - Update any property of flow configs (description, variables, prompts)
46
+ - Delete flow configs
47
+ - Add/remove variables and prompts
48
+ - Modify variable and prompt values
49
+
50
+ 2. **FlowConfigEdit Group**:
51
+
52
+ - Read all flow configs
53
+ - Update variable values in existing flow configs
54
+ - Update prompt content in existing flow configs
55
+ - Add new languages to existing prompts
56
+ - Add/remove channels (voice/chat) for existing prompts
57
+ - **Cannot** create new flow configs
58
+ - **Cannot** delete flow configs
59
+ - **Cannot** add new variables or prompts
60
+ - **Cannot** remove existing variables or prompts
61
+ - **Cannot** remove existing languages from prompts
62
+ - **Cannot** modify flow config descriptions
63
+
64
+ 3. **FlowConfigRead Group**:
65
+ - Read all flow configs
66
+ - **Cannot** modify any data
67
+
68
+ ## Permission Evaluation
69
+
70
+ When evaluating access, the system follows these rules:
71
+
72
+ 1. Users must be members of at least one FlowConfig group to access the application
73
+ 2. If a user is in multiple groups, they get the highest level of permissions
74
+ 3. Group hierarchy (highest to lowest): FlowConfigAdmin > FlowConfigEdit > FlowConfigRead
75
+ 4. Users not in any FlowConfig group are denied access
76
+
77
+ ## Implementation Details
78
+
79
+ ### Cognito User Group Management
80
+
81
+ Cognito User Groups will be:
82
+
83
+ 1. Created during CDK deployment
84
+ 2. Managed by administrators through the AWS Console or CLI
85
+ 3. Users assigned to groups based on their role in the organization
86
+
87
+ ### API Integration
88
+
89
+ The backend API will:
90
+
91
+ 1. Extract group memberships from the Cognito JWT token
92
+ 2. Validate required group membership for each endpoint:
93
+ - GET endpoints: Require FlowConfigRead, FlowConfigEdit, or FlowConfigAdmin
94
+ - POST/PUT (create/full update): Require FlowConfigAdmin
95
+ - PATCH (value-only updates): Require FlowConfigEdit or FlowConfigAdmin
96
+ - DELETE endpoints: Require FlowConfigAdmin
97
+ 3. Return appropriate HTTP status codes (403 Forbidden) for insufficient permissions
98
+
99
+ ### Frontend Considerations
100
+
101
+ The frontend will:
102
+
103
+ 1. Read user group memberships from the Cognito token
104
+ 2. Show/hide UI elements based on group membership:
105
+ - Create/Delete buttons: Only for FlowConfigAdmin
106
+ - Edit controls: For FlowConfigEdit and FlowConfigAdmin (with restrictions for Edit users)
107
+ - Read-only mode: For FlowConfigRead users
108
+ 3. Handle permission-related errors gracefully with user-friendly messages
109
+
110
+ ## API Endpoint Permissions
111
+
112
+ Below are the permission requirements for each API endpoint:
113
+
114
+ | HTTP Method | Endpoint Pattern | Required Group(s) | Description |
115
+ | ----------- | --------------------------- | ----------------------------------------------- | ---------------------------------- |
116
+ | GET | `/flow-configs` | FlowConfigRead, FlowConfigEdit, FlowConfigAdmin | List all flow configs |
117
+ | GET | `/flow-configs/{id}` | FlowConfigRead, FlowConfigEdit, FlowConfigAdmin | Get specific flow config |
118
+ | POST | `/flow-configs` | FlowConfigAdmin | Create new flow config |
119
+ | PUT | `/flow-configs/{id}` | FlowConfigAdmin | Replace entire flow config |
120
+ | PATCH | `/flow-configs/{id}/values` | FlowConfigEdit, FlowConfigAdmin | Update variable/prompt values only |
121
+ | DELETE | `/flow-configs/{id}` | FlowConfigAdmin | Delete flow config |
122
+
123
+ ## Migration Path to v2
124
+
125
+ This Cognito Groups approach is designed for the initial release. Future versions (v2) will migrate to Amazon Verified Permissions to support:
126
+
127
+ - Per-flow-config permissions using pattern matching
128
+ - More granular access control based on user attributes
129
+ - Dynamic permission evaluation
130
+ - Integration with Amazon Connect user tags
131
+
132
+ The current group-based model provides a foundation that can be extended without breaking existing functionality.
@@ -34,9 +34,9 @@ User tags follow a specific format to define access levels and targets:
34
34
 
35
35
  | Tag Format | Description | Example |
36
36
  | ----------------------------- | ------------------------------------------------------- | ------------------------------------------------ |
37
- | `AdminAppFull: [pattern]` | Grants full access to flow configs matching the pattern | `AdminAppFull: *` or `AdminAppFull: aci-ccaas-*` |
38
- | `AdminAppRead: [pattern]` | Grants read access to flow configs matching the pattern | `AdminAppRead: aci-ccaas-*` |
39
- | `AdminAppEdit: [specific-id]` | Grants edit access to a specific flow config | `AdminAppEdit: +18001234444` |
37
+ | `FlowConfigFull: [pattern]` | Grants full access to flow configs matching the pattern | `FlowConfigFull: *` or `FlowConfigFull: aci-ccaas-*` |
38
+ | `FlowConfigRead: [pattern]` | Grants read access to flow configs matching the pattern | `FlowConfigRead: aci-ccaas-*` |
39
+ | `FlowConfigEdit: [specific-id]` | Grants edit access to a specific flow config | `FlowConfigEdit: +18001234444` |
40
40
 
41
41
  ### Access Level Hierarchy
42
42
 
@@ -90,33 +90,33 @@ Below are examples of Cedar policies for Amazon Verified Permissions:
90
90
  // Grant full access to flow configs matching a pattern
91
91
  permit(
92
92
  principal,
93
- action == AdminApp::Action::"*",
94
- resource in AdminApp::FlowConfig
93
+ action == FlowConfig::Action::"*",
94
+ resource in FlowConfig::FlowConfig
95
95
  )
96
96
  when {
97
- principal has AdminAppFull &&
98
- (principal.AdminAppFull == "*" || resource.id like principal.AdminAppFull)
97
+ principal has FlowConfigFull &&
98
+ (principal.FlowConfigFull == "*" || resource.id like principal.FlowConfigFull)
99
99
  };
100
100
 
101
101
  // Grant read access to flow configs matching a pattern
102
102
  permit(
103
103
  principal,
104
- action == AdminApp::Action::"Read",
105
- resource in AdminApp::FlowConfig
104
+ action == FlowConfig::Action::"Read",
105
+ resource in FlowConfig::FlowConfig
106
106
  )
107
107
  when {
108
- principal has AdminAppRead &&
109
- resource.id like principal.AdminAppRead
108
+ principal has FlowConfigRead &&
109
+ resource.id like principal.FlowConfigRead
110
110
  };
111
111
 
112
112
  // Grant edit access to a specific flow config
113
113
  permit(
114
114
  principal,
115
- action in [AdminApp::Action::"Read", AdminApp::Action::"Edit"],
116
- resource in AdminApp::FlowConfig
115
+ action in [FlowConfig::Action::"Read", FlowConfig::Action::"Edit"],
116
+ resource in FlowConfig::FlowConfig
117
117
  )
118
118
  when {
119
- principal has AdminAppEdit &&
120
- resource.id == principal.AdminAppEdit
119
+ principal has FlowConfigEdit &&
120
+ resource.id == principal.FlowConfigEdit
121
121
  };
122
122
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cxbuilder/flow-config",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "license": "MIT",
5
5
  "description": "Amazon Connect third-party app for configuring variables and prompts in Connect contact flows",
6
6
  "author": {
@@ -55,7 +55,6 @@
55
55
  },
56
56
  "devDependencies": {
57
57
  "@aws-lambda-powertools/logger": "^2.21.0",
58
- "@aws-solutions-constructs/aws-openapigateway-lambda": "2.85.2",
59
58
  "@types/aws-lambda": "^8.10.149",
60
59
  "@types/jest": "^29.5.14",
61
60
  "@types/mime-types": "^2.1.4",
@@ -100,7 +99,6 @@
100
99
  "yaml"
101
100
  ],
102
101
  "peerDependencies": {
103
- "@aws-solutions-constructs/aws-openapigateway-lambda": "^2.85.2",
104
102
  "aws-cdk-lib": "2.194.0",
105
103
  "constructs": "^10.0.0"
106
104
  },