-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
104 additions
and
224 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
-- Copyright 2024 Specter Ops, Inc. | ||
-- | ||
-- Licensed under the Apache License, Version 2.0 | ||
-- you may not use this file except in compliance with the License. | ||
-- You may obtain a copy of the License at | ||
-- | ||
-- http://www.apache.org/licenses/LICENSE-2.0 | ||
-- | ||
-- Unless required by applicable law or agreed to in writing, software | ||
-- distributed under the License is distributed on an "AS IS" BASIS, | ||
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
-- See the License for the specific language governing permissions and | ||
-- limitations under the License. | ||
-- | ||
-- SPDX-License-Identifier: Apache-2.0 | ||
|
||
-- Feature Flags | ||
INSERT INTO feature_flags (created_at, updated_at, key, name, description, enabled, user_updatable) VALUES (current_timestamp, current_timestamp, 'adcs', 'Enable collection and processing of Active Directory Certificate Services Data', 'Enables the ability to collect, analyze, and explore Active Directory Certificate Services data and previews new attack paths.', false, true) ON CONFLICT DO NOTHING; | ||
INSERT INTO feature_flags (created_at, updated_at, key, name, description, enabled, user_updatable) VALUES (current_timestamp, current_timestamp, 'clear_graph_data', 'Clear Graph Data', 'Enables the ability to delete all nodes and edges from the graph database.', true, false) ON CONFLICT DO NOTHING; | ||
INSERT INTO feature_flags (created_at, updated_at, key, name, description, enabled, user_updatable) VALUES (current_timestamp, current_timestamp, 'risk_exposure_new_calculation', 'Use new tier zero risk exposure calculation', 'Enables the use of new tier zero risk exposure metatree metrics.', false, false) ON CONFLICT DO NOTHING; | ||
INSERT INTO feature_flags (created_at, updated_at, key, name, description, enabled, user_updatable) VALUES (current_timestamp, current_timestamp, 'fedramp_eula', 'FedRAMP EULA', 'Enables showing the FedRAMP EULA on every login. (Enterprise only)', false, false) ON CONFLICT DO NOTHING; | ||
|
||
-- Note - order matters permissions and roles ops must come before roles permissions ops | ||
-- Permissions | ||
INSERT INTO permissions (authority, name, created_at, updated_at) VALUES ('saved_queries', 'Read', current_timestamp, current_timestamp) ON CONFLICT DO NOTHING; | ||
INSERT INTO permissions (authority, name, created_at, updated_at) VALUES ('saved_queries', 'Write', current_timestamp, current_timestamp) ON CONFLICT DO NOTHING; | ||
INSERT INTO permissions (authority, name, created_at, updated_at) VALUES ('clients', 'Read', current_timestamp, current_timestamp) ON CONFLICT DO NOTHING; | ||
INSERT INTO permissions (authority, name, created_at, updated_at) VALUES ('db', 'Wipe', current_timestamp, current_timestamp) ON CONFLICT DO NOTHING; | ||
INSERT INTO permissions (authority, name, created_at, updated_at) VALUES ('graphdb', 'Mutate', current_timestamp, current_timestamp) ON CONFLICT DO NOTHING; | ||
|
||
-- Roles | ||
INSERT INTO roles (name, description, created_at, updated_at) VALUES ('Power User', 'Can upload data, manage clients, and perform any action a User can', current_timestamp, current_timestamp) ON CONFLICT DO NOTHING; | ||
|
||
-- Roles Permissions | ||
INSERT INTO roles_permissions (role_id, permission_id) VALUES ((SELECT id FROM roles WHERE roles.name = 'Administrator'), (SELECT id FROM permissions WHERE permissions.authority = 'saved_queries' and permissions.name = 'Read')) ON CONFLICT DO NOTHING; | ||
INSERT INTO roles_permissions (role_id, permission_id) VALUES ((SELECT id FROM roles WHERE roles.name = 'Administrator'), (SELECT id FROM permissions WHERE permissions.authority = 'saved_queries' and permissions.name = 'Write')) ON CONFLICT DO NOTHING; | ||
INSERT INTO roles_permissions (role_id, permission_id) VALUES ((SELECT id FROM roles WHERE roles.name = 'Administrator'), (SELECT id FROM permissions WHERE permissions.authority = 'clients' and permissions.name = 'Read')) ON CONFLICT DO NOTHING; | ||
INSERT INTO roles_permissions (role_id, permission_id) VALUES ((SELECT id FROM roles WHERE roles.name = 'Administrator'), (SELECT id FROM permissions WHERE permissions.authority = 'db' and permissions.name = 'Wipe')) ON CONFLICT DO NOTHING; | ||
INSERT INTO roles_permissions (role_id, permission_id) VALUES ((SELECT id FROM roles WHERE roles.name = 'Administrator'), (SELECT id FROM permissions WHERE permissions.authority = 'graphdb' AND permissions.name = 'Mutate')) ON CONFLICT DO NOTHING; | ||
|
||
INSERT INTO roles_permissions (role_id, permission_id) VALUES ((SELECT id FROM roles WHERE roles.name = 'User'), (SELECT id FROM permissions WHERE permissions.authority = 'saved_queries' and permissions.name = 'Read')) ON CONFLICT DO NOTHING; | ||
INSERT INTO roles_permissions (role_id, permission_id) VALUES ((SELECT id FROM roles WHERE roles.name = 'User'), (SELECT id FROM permissions WHERE permissions.authority = 'saved_queries' and permissions.name = 'Write')) ON CONFLICT DO NOTHING; | ||
-- Swap user clients manage for clients read permission | ||
DELETE FROM roles_permissions WHERE role_id = (SELECT id FROM roles WHERE roles.name = 'User') AND permission_id = (SELECT id FROM permissions WHERE permissions.authority = 'clients' and permissions.name = 'Manage'); | ||
INSERT INTO roles_permissions (role_id, permission_id) VALUES ((SELECT id FROM roles WHERE roles.name = 'User'), (SELECT id FROM permissions WHERE permissions.authority = 'clients' and permissions.name = 'Read')) ON CONFLICT DO NOTHING; | ||
|
||
INSERT INTO roles_permissions (role_id, permission_id) VALUES ((SELECT id FROM roles WHERE roles.name = 'Read-Only'), (SELECT id FROM permissions WHERE permissions.authority = 'auth' and permissions.name = 'CreateToken')) ON CONFLICT DO NOTHING; | ||
|
||
INSERT INTO roles_permissions (role_id, permission_id) VALUES ((SELECT id FROM roles WHERE roles.name = 'Power User'), (SELECT id FROM permissions WHERE permissions.authority = 'app' and permissions.name = 'ReadAppConfig')) ON CONFLICT DO NOTHING; | ||
INSERT INTO roles_permissions (role_id, permission_id) VALUES ((SELECT id FROM roles WHERE roles.name = 'Power User'), (SELECT id FROM permissions WHERE permissions.authority = 'app' and permissions.name = 'WriteAppConfig')) ON CONFLICT DO NOTHING; | ||
INSERT INTO roles_permissions (role_id, permission_id) VALUES ((SELECT id FROM roles WHERE roles.name = 'Power User'), (SELECT id FROM permissions WHERE permissions.authority = 'risks' and permissions.name = 'GenerateReport')) ON CONFLICT DO NOTHING; | ||
INSERT INTO roles_permissions (role_id, permission_id) VALUES ((SELECT id FROM roles WHERE roles.name = 'Power User'), (SELECT id FROM permissions WHERE permissions.authority = 'risks' and permissions.name = 'ManageRisks')) ON CONFLICT DO NOTHING; | ||
INSERT INTO roles_permissions (role_id, permission_id) VALUES ((SELECT id FROM roles WHERE roles.name = 'Power User'), (SELECT id FROM permissions WHERE permissions.authority = 'auth' and permissions.name = 'CreateToken')) ON CONFLICT DO NOTHING; | ||
INSERT INTO roles_permissions (role_id, permission_id) VALUES ((SELECT id FROM roles WHERE roles.name = 'Power User'), (SELECT id FROM permissions WHERE permissions.authority = 'auth' and permissions.name = 'ManageSelf')) ON CONFLICT DO NOTHING; | ||
INSERT INTO roles_permissions (role_id, permission_id) VALUES ((SELECT id FROM roles WHERE roles.name = 'Power User'), (SELECT id FROM permissions WHERE permissions.authority = 'clients' and permissions.name = 'Manage')) ON CONFLICT DO NOTHING; | ||
INSERT INTO roles_permissions (role_id, permission_id) VALUES ((SELECT id FROM roles WHERE roles.name = 'Power User'), (SELECT id FROM permissions WHERE permissions.authority = 'clients' and permissions.name = 'Read')) ON CONFLICT DO NOTHING; | ||
INSERT INTO roles_permissions (role_id, permission_id) VALUES ((SELECT id FROM roles WHERE roles.name = 'Power User'), (SELECT id FROM permissions WHERE permissions.authority = 'clients' and permissions.name = 'Tasking')) ON CONFLICT DO NOTHING; | ||
INSERT INTO roles_permissions (role_id, permission_id) VALUES ((SELECT id FROM roles WHERE roles.name = 'Power User'), (SELECT id FROM permissions WHERE permissions.authority = 'collection' and permissions.name = 'ManageJobs')) ON CONFLICT DO NOTHING; | ||
INSERT INTO roles_permissions (role_id, permission_id) VALUES ((SELECT id FROM roles WHERE roles.name = 'Power User'), (SELECT id FROM permissions WHERE permissions.authority = 'graphdb' and permissions.name = 'Write')) ON CONFLICT DO NOTHING; | ||
INSERT INTO roles_permissions (role_id, permission_id) VALUES ((SELECT id FROM roles WHERE roles.name = 'Power User'), (SELECT id FROM permissions WHERE permissions.authority = 'graphdb' and permissions.name = 'Read')) ON CONFLICT DO NOTHING; | ||
INSERT INTO roles_permissions (role_id, permission_id) VALUES ((SELECT id FROM roles WHERE roles.name = 'Power User'), (SELECT id FROM permissions WHERE permissions.authority = 'saved_queries' and permissions.name = 'Read')) ON CONFLICT DO NOTHING; | ||
INSERT INTO roles_permissions (role_id, permission_id) VALUES ((SELECT id FROM roles WHERE roles.name = 'Power User'), (SELECT id FROM permissions WHERE permissions.authority = 'saved_queries' and permissions.name = 'Write')) ON CONFLICT DO NOTHING; | ||
INSERT INTO roles_permissions (role_id, permission_id) VALUES ((SELECT id FROM roles WHERE roles.name = 'Power User'), (SELECT id FROM permissions WHERE permissions.authority = 'graphdb' AND permissions.name = 'Mutate')) ON CONFLICT DO NOTHING; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters