-
Notifications
You must be signed in to change notification settings - Fork 1
User N8N workflows [WIP] #599
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
de5fcae
bb801bd
4f3830b
6172ec4
4d10a40
cd9a346
fb961ff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -5,9 +5,6 @@ object_relationships: | |||||||||||
| - name: complexityEnum | ||||||||||||
| using: | ||||||||||||
| foreign_key_constraint_on: default_complexity | ||||||||||||
| - name: department | ||||||||||||
| using: | ||||||||||||
| foreign_key_constraint_on: department_id | ||||||||||||
| - name: lengthEnum | ||||||||||||
| using: | ||||||||||||
| foreign_key_constraint_on: default_length | ||||||||||||
|
|
@@ -39,13 +36,6 @@ array_relationships: | |||||||||||
| table: | ||||||||||||
| name: chatbot_domain | ||||||||||||
| schema: public | ||||||||||||
| - name: organization_chatbots | ||||||||||||
| using: | ||||||||||||
| foreign_key_constraint_on: | ||||||||||||
| column: chatbot_id | ||||||||||||
| table: | ||||||||||||
| name: organization_chatbot | ||||||||||||
| schema: public | ||||||||||||
| - name: prompts | ||||||||||||
| using: | ||||||||||||
| foreign_key_constraint_on: | ||||||||||||
|
|
@@ -66,6 +56,7 @@ select_permissions: | |||||||||||
| columns: | ||||||||||||
| - avatar | ||||||||||||
| - chatbot_id | ||||||||||||
| - chatbot_id | ||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove duplicate column entry. The 🔎 Proposed fix columns:
- avatar
- chatbot_id
- - chatbot_id
- created_by📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||
| - created_by | ||||||||||||
| - default_complexity | ||||||||||||
| - default_length | ||||||||||||
|
|
@@ -84,20 +75,20 @@ select_permissions: | |||||||||||
| - role: moderator | ||||||||||||
| permission: | ||||||||||||
| columns: | ||||||||||||
| - disabled | ||||||||||||
| - is_pro | ||||||||||||
| - pro_exclusive | ||||||||||||
| - avatar | ||||||||||||
| - chatbot_id | ||||||||||||
| - department_id | ||||||||||||
| - order | ||||||||||||
| - avatar | ||||||||||||
| - created_by | ||||||||||||
| - default_complexity | ||||||||||||
| - default_length | ||||||||||||
| - default_tone | ||||||||||||
| - default_type | ||||||||||||
| - department_id | ||||||||||||
| - description | ||||||||||||
| - disabled | ||||||||||||
| - name | ||||||||||||
| - order | ||||||||||||
| filter: {} | ||||||||||||
| allow_aggregations: true | ||||||||||||
| comment: "" | ||||||||||||
|
|
||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| table: | ||
| name: n8n_credentials | ||
| schema: public | ||
|
Comment on lines
+1
to
+3
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical: Add strict permissions for credential data. This table stores n8n credentials, which are highly sensitive. This MUST have proper permissions before merging to any non-development environment:
🔎 Example with strict security controlstable:
name: n8n_credentials
schema: public
object_relationships:
- name: user
using:
foreign_key_constraint_on: user_id
select_permissions:
- role: user
permission:
columns:
- id
- user_id
- provider
- service
- n8n_credential_id
- created_at
filter:
user_id:
_eq: X-Hasura-User-Id
insert_permissions:
- role: user
permission:
check:
user_id:
_eq: X-Hasura-User-Id
columns:
- provider
- service
- n8n_credential_id
delete_permissions:
- role: user
permission:
filter:
user_id:
_eq: X-Hasura-User-Id🤖 Prompt for AI Agents |
||
| insert_permissions: | ||
| - role: moderator | ||
| permission: | ||
| check: | ||
| user_id: | ||
| _eq: X-Hasura-User-Id | ||
| columns: | ||
| - n8n_credential_id | ||
| - provider | ||
| - service | ||
| - created_at | ||
| - id | ||
| - user_id | ||
| comment: "" | ||
| - role: user | ||
| permission: | ||
| check: | ||
| user_id: | ||
| _eq: X-Hasura-User-Id | ||
| columns: | ||
| - n8n_credential_id | ||
| - provider | ||
| - service | ||
| - created_at | ||
| - id | ||
| - user_id | ||
| comment: "" | ||
| select_permissions: | ||
| - role: moderator | ||
| permission: | ||
| columns: | ||
| - n8n_credential_id | ||
| - provider | ||
| - service | ||
| - created_at | ||
| - id | ||
| - user_id | ||
| filter: | ||
| user_id: | ||
| _eq: X-Hasura-User-Id | ||
| comment: "" | ||
| - role: user | ||
| permission: | ||
| columns: | ||
| - n8n_credential_id | ||
| - provider | ||
| - service | ||
| - created_at | ||
| - id | ||
| - user_id | ||
| filter: | ||
| user_id: | ||
| _eq: X-Hasura-User-Id | ||
| comment: "" | ||
| update_permissions: | ||
| - role: moderator | ||
| permission: | ||
| columns: | ||
| - n8n_credential_id | ||
| - provider | ||
| - service | ||
| filter: | ||
| user_id: | ||
| _eq: X-Hasura-User-Id | ||
| check: null | ||
| comment: "" | ||
| - role: user | ||
| permission: | ||
| columns: | ||
| - created_at | ||
| - n8n_credential_id | ||
| - provider | ||
| - service | ||
| filter: | ||
| user_id: | ||
| _eq: X-Hasura-User-Id | ||
| check: null | ||
| comment: "" | ||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -36,11 +36,7 @@ insert_permissions: | |||||||||
| comment: "" | ||||||||||
| - role: user | ||||||||||
| permission: | ||||||||||
| check: | ||||||||||
| user_id: | ||||||||||
| _eq: X-Hasura-User-Id | ||||||||||
| set: | ||||||||||
| user_id: X-Hasura-User-Id | ||||||||||
| check: {} | ||||||||||
|
||||||||||
| check: {} | |
| check: | |
| user_id: | |
| _eq: X-Hasura-User-Id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical security vulnerability: Empty check allows privilege escalation.
The empty check: {} for the user role permits any authenticated user to insert preferences with any user_id, effectively allowing users to create or modify preferences for other users.
This should enforce row-level security:
check:
user_id:
_eq: X-Hasura-User-Id🔎 Proposed fix
- role: user
permission:
- check: {}
+ check:
+ user_id:
+ _eq: X-Hasura-User-Id
columns:🤖 Prompt for AI Agents
In apps/hasura/metadata/databases/masterbots/tables/public_preference.yaml
around line 36, the `check: {}` for the `user` role allows any authenticated
user to insert or modify rows for arbitrary `user_id`; replace the empty check
with a row-level security condition that enforces user_id equals the Hasura
session variable (X-Hasura-User-Id) for inserts/updates (e.g. set check to
require user_id _eq to the X-Hasura-User-Id session variable), ensuring the
comparison type matches the column type (cast the session var if needed) and
keep the rest of the permission block intact.
Copilot
AI
Dec 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The filter: {} permission allows any authenticated user to read all preferences from all users, which is a privacy violation. The original permission with user_id filter should be restored to ensure users can only access their own preferences.
| filter: {} | |
| filter: | |
| user_id: | |
| _eq: X-Hasura-User-Id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical security vulnerability: Empty filter exposes all user preferences.
The empty filter: {} for the user role allows any authenticated user to query all preferences across all users, leaking sensitive user data.
This should enforce row-level security to restrict users to their own preferences.
🔎 Proposed fix
- role: user
permission:
columns:
- deep_expertise
- favorite
- font_size
- lang
- preference_id
- preferred_complexity
- preferred_length
- preferred_tone
- preferred_type
- user_id
- web_search
- filter: {}
+ filter:
+ user_id:
+ _eq: X-Hasura-User-Id
comment: ""🤖 Prompt for AI Agents
In apps/hasura/metadata/databases/masterbots/tables/public_preference.yaml
around line 94, the permission filter is currently empty (filter: {}), exposing
all preferences; replace it with a row-level filter that restricts results to
the logged-in user by comparing the preference's user_id to the Hasura session
variable (for example: set filter to {"user_id": {"_eq": "X-Hasura-User-Id"}} or
to the correct JWT claim/key your app uses, e.g. "x-hasura-user-id"), ensuring
the permission only returns rows where user_id equals the session user id.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| table: | ||
| name: user_oauth_connections | ||
| schema: public | ||
|
Comment on lines
+1
to
+3
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major Add permissions and relationships with privacy controls. This table stores OAuth connection data, which is sensitive user information. Before merging, you should add:
🔎 Example with privacy controlstable:
name: user_oauth_connections
schema: public
object_relationships:
- name: user
using:
foreign_key_constraint_on: user_id
select_permissions:
- role: user
permission:
columns:
- id
- user_id
- provider
- service
- scopes
- status
- connected_at
- revoked_at
filter:
user_id:
_eq: X-Hasura-User-Id
insert_permissions:
- role: user
permission:
check:
user_id:
_eq: X-Hasura-User-Id
columns:
- provider
- service
- scopes
- status
update_permissions:
- role: user
permission:
columns:
- status
- revoked_at
filter:
user_id:
_eq: X-Hasura-User-Id🤖 Prompt for AI Agents |
||
| insert_permissions: | ||
| - role: moderator | ||
| permission: | ||
| check: | ||
| user_id: | ||
| _eq: X-Hasura-User-Id | ||
| columns: | ||
| - provider | ||
| - scopes | ||
| - service | ||
| - status | ||
| - connected_at | ||
| - revoked_at | ||
| - id | ||
| - user_id | ||
| comment: "" | ||
| - role: user | ||
| permission: | ||
| check: | ||
| user_id: | ||
| _eq: X-Hasura-User-Id | ||
| columns: | ||
| - provider | ||
| - scopes | ||
| - service | ||
| - status | ||
| - connected_at | ||
| - revoked_at | ||
| - id | ||
| - user_id | ||
| comment: "" | ||
| select_permissions: | ||
| - role: moderator | ||
| permission: | ||
| columns: | ||
| - connected_at | ||
| - id | ||
| - provider | ||
| - revoked_at | ||
| - scopes | ||
| - service | ||
| - status | ||
| - user_id | ||
| filter: | ||
| user_id: | ||
| _eq: X-Hasura-User-Id | ||
| comment: "" | ||
| - role: user | ||
| permission: | ||
| columns: | ||
| - connected_at | ||
| - id | ||
| - provider | ||
| - revoked_at | ||
| - scopes | ||
| - service | ||
| - status | ||
| - user_id | ||
| filter: | ||
| user_id: | ||
| _eq: X-Hasura-User-Id | ||
| comment: "" | ||
| update_permissions: | ||
| - role: moderator | ||
| permission: | ||
| columns: | ||
| - provider | ||
| - revoked_at | ||
| - scopes | ||
| - service | ||
| - status | ||
| filter: | ||
| user_id: | ||
| _eq: X-Hasura-User-Id | ||
| check: null | ||
| comment: "" | ||
| - role: user | ||
| permission: | ||
| columns: | ||
| - provider | ||
| - revoked_at | ||
| - scopes | ||
| - service | ||
| - status | ||
| filter: | ||
| user_id: | ||
| _eq: X-Hasura-User-Id | ||
| check: null | ||
| comment: "" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate column
chatbot_idappears twice in the select permissions. This appears to be an accidental duplication that should be removed.