-
Notifications
You must be signed in to change notification settings - Fork 8
Logout API / SSO Enhancements #922
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
Open
shobhitupadhyayy
wants to merge
3
commits into
dev
Choose a base branch
from
feature/cmg-686
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,68 @@ | ||
| #!/usr/bin/env node | ||
|
|
||
| /** | ||
| * One-time script to encrypt sensitive fields in manifest.json. | ||
| * | ||
| * Usage: | ||
| * MANIFEST_ENCRYPT_KEY=<your-secret-key> node encrypt-manifest.js | ||
| * | ||
| * This will overwrite manifest.json with encrypted uid, client_id, and client_secret. | ||
| * Run once, then commit the encrypted manifest.json. | ||
| */ | ||
|
|
||
| const crypto = require("crypto"); | ||
| const fs = require("fs"); | ||
| const path = require("path"); | ||
|
|
||
| const ALGORITHM = "aes-256-gcm"; | ||
| const ENC_PREFIX = "enc:"; | ||
| const ENCRYPT_KEY = process.env.MANIFEST_ENCRYPT_KEY; | ||
| const ENCRYPT_SALT = process.env.MANIFEST_ENCRYPT_SALT; | ||
|
|
||
| if (!ENCRYPT_KEY || !ENCRYPT_SALT) { | ||
| console.error("Error: MANIFEST_ENCRYPT_KEY and MANIFEST_ENCRYPT_SALT environment variables are required."); | ||
| console.error("Usage: MANIFEST_ENCRYPT_KEY=<key> MANIFEST_ENCRYPT_SALT=<salt> node encrypt-manifest.js"); | ||
| process.exit(1); | ||
| } | ||
|
|
||
| function encrypt(plaintext) { | ||
| const key = crypto.scryptSync(ENCRYPT_KEY, ENCRYPT_SALT, 32); | ||
| const iv = crypto.randomBytes(12); | ||
| const cipher = crypto.createCipheriv(ALGORITHM, key, iv); | ||
| let encrypted = cipher.update(plaintext, "utf8", "hex"); | ||
| encrypted += cipher.final("hex"); | ||
| const authTag = cipher.getAuthTag().toString("hex"); | ||
| return `${ENC_PREFIX}${iv.toString("hex")}:${authTag}:${encrypted}`; | ||
| } | ||
|
|
||
| const manifestPath = path.join(__dirname, "manifest.json"); | ||
| const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8")); | ||
|
|
||
| let changed = false; | ||
|
|
||
| if (manifest.uid && !manifest.uid.startsWith(ENC_PREFIX)) { | ||
| console.log(`Encrypting uid: ${manifest.uid.substring(0, 8)}...`); | ||
| manifest.uid = encrypt(manifest.uid); | ||
| changed = true; | ||
| } | ||
|
|
||
| if (manifest.oauth?.client_id && !manifest.oauth.client_id.startsWith(ENC_PREFIX)) { | ||
| console.log(`Encrypting oauth.client_id: ${manifest.oauth.client_id.substring(0, 8)}...`); | ||
| manifest.oauth.client_id = encrypt(manifest.oauth.client_id); | ||
| changed = true; | ||
| } | ||
|
|
||
| if (manifest.oauth?.client_secret && !manifest.oauth.client_secret.startsWith(ENC_PREFIX)) { | ||
| console.log(`Encrypting oauth.client_secret: ${manifest.oauth.client_secret.substring(0, 8)}...`); | ||
| manifest.oauth.client_secret = encrypt(manifest.oauth.client_secret); | ||
| changed = true; | ||
| } | ||
|
|
||
| if (!changed) { | ||
| console.log("All sensitive fields are already encrypted. Nothing to do."); | ||
| process.exit(0); | ||
| } | ||
|
|
||
| fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 4) + "\n"); | ||
| console.log("\nmanifest.json updated with encrypted values."); | ||
| console.log("Make sure to store MANIFEST_ENCRYPT_KEY securely (e.g. in your .env file)."); |
This file contains hidden or 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,165 @@ | ||
| { | ||
| "uid": "enc:2328a77c3fccc2ea40ea89fa:6aa942508755fb0c12dfcf45fcd49ea7:187574417cb98ec8a40dddef7b210212a812e4f1e3adb0ce", | ||
| "name": "Migration Tool", | ||
| "description": "", | ||
| "target_type": "organization", | ||
| "visibility": "private", | ||
| "version": 2, | ||
| "icon": "", | ||
| "oauth": { | ||
| "client_id": "enc:3daed09564545513282e14fc:d624fbb2a4291cd3cd7a8a0a190de76b:08f0867848f185185a8bb1aae11d52df", | ||
| "client_secret": "enc:7e2ee2214ebb800a125beee0:a549969a5320938b45c0b2c8e41beac2:5917736a65336616dabbed509740309f336f4b580b4848f7e31b215d712cba7a", | ||
| "redirect_uri": "http://localhost:5001/v2/auth/save-token", | ||
| "user_token_config": { | ||
| "enabled": true, | ||
| "scopes": [ | ||
| "app.manifests:read", | ||
| "app.manifest:read", | ||
| "app.manifest:write", | ||
| "app.hosting:read", | ||
| "app.hosting:write", | ||
| "app.installations:read", | ||
| "app.installations.management:read", | ||
| "app.installations.management:write", | ||
| "app.authorizations:manage", | ||
| "app.authorizations.management:write", | ||
| "app.requests:write", | ||
| "app.requests.management:write", | ||
| "scim:manage", | ||
| "user.profile:read", | ||
| "user:read", | ||
| "user:write", | ||
| "user.tfa:write", | ||
| "user.assignments:read", | ||
| "user.assignments:write", | ||
| "user.notifications:read", | ||
| "user.notifications:write", | ||
| "organizations:read", | ||
| "organization:read", | ||
| "organization.roles:read", | ||
| "organization.share:read", | ||
| "organization.share:write", | ||
| "organization.ownership:write", | ||
| "organization.settings:write", | ||
| "organization.logs:read", | ||
| "organization.usage:read", | ||
| "organization.jobs:read", | ||
| "organization.jobs:write", | ||
| "cm.stacks.management:read", | ||
| "cm.stacks.management:write", | ||
| "cm.stack.management:read", | ||
| "cm.stack.management:write", | ||
| "cm.stack.settings:read", | ||
| "cm.stack.settings:write", | ||
| "cm.stack:share", | ||
| "cm.stack:unshare", | ||
| "cm.stack.users:read", | ||
| "cm.stack.users:write", | ||
| "cm.stack.delivery-tokens:read", | ||
| "cm.stack.delivery-tokens:write", | ||
| "cm.stack.management-tokens:read", | ||
| "cm.stack.management-tokens:write", | ||
| "cm.content-types.management:read", | ||
| "cm.content-types.management:write", | ||
| "cm.content-types:import", | ||
| "cm.content-types:export", | ||
| "cm.content-type:read", | ||
| "cm.content-type:write", | ||
| "cm.content-type:copy", | ||
| "cm.global-fields.management:read", | ||
| "cm.global-fields.management:write", | ||
| "cm.global-fields:import", | ||
| "cm.global-fields:export", | ||
| "cm.entries.management:read", | ||
| "cm.entries.management:write", | ||
| "cm.entries:import", | ||
| "cm.entries:export", | ||
| "cm.entry:read", | ||
| "cm.entry:write", | ||
| "cm.entry:publish", | ||
| "cm.entry:unpublish", | ||
| "cm.entry.workflow:write", | ||
| "cm.webhooks.management:read", | ||
| "cm.webhooks.management:write", | ||
| "cm.webhooks:import", | ||
| "cm.webhooks:export", | ||
| "cm.webhook:read", | ||
| "cm.webhook:write", | ||
| "cm.assets.management:read", | ||
| "cm.assets.management:write", | ||
| "cm.assets.rt:read", | ||
| "cm.assets.rt:write", | ||
| "cm.assets:download", | ||
| "cm.asset:read", | ||
| "cm.asset:write", | ||
| "cm.asset:publish", | ||
| "cm.asset:unpublish", | ||
| "cm.workflows.management:read", | ||
| "cm.workflows.management:write", | ||
| "cm.workflows.publishing-rules:read", | ||
| "cm.workflows.publishing-rules:write", | ||
| "cm.environments.management:read", | ||
| "cm.environments.management:write", | ||
| "cm.extensions.management:read", | ||
| "cm.extensions.management:write", | ||
| "cm.languages.management:read", | ||
| "cm.languages.management:write", | ||
| "cm.labels.management:read", | ||
| "cm.labels.management:write", | ||
| "cm.bulk-operations:publish", | ||
| "cm.bulk-operations:unpublish", | ||
| "cm.bulk-operations:add-to-release", | ||
| "cm.bulk-operations:delete", | ||
| "cm.bulk-operations:move-to-folder", | ||
| "cm.bulk-operations:workflow", | ||
| "cm.releases.management:read", | ||
| "cm.releases.management:write", | ||
| "cm.release:read", | ||
| "cm.release:write", | ||
| "cm.release:clone", | ||
| "cm.release:deploy", | ||
| "cm.roles.management:read", | ||
| "cm.roles.management:write", | ||
| "cm.audit-logs:read", | ||
| "personalize:read", | ||
| "personalize:manage", | ||
| "cm.publish-queue.management:read", | ||
| "cm.publish-queue.management:write", | ||
| "cm.taxonomies.management:read", | ||
| "cm.taxonomies.management:write", | ||
| "cm.taxonomy.terms:read", | ||
| "cm.taxonomy.terms:write", | ||
| "cm.branches.management:read", | ||
| "cm.branches.management:write", | ||
| "cm.branches:compare-merge", | ||
| "cm.branch-aliases.management:read", | ||
| "cm.branch-aliases.management:write", | ||
| "launch:manage", | ||
| "launch.gitproviders:manage", | ||
| "automationhub.projects.management:read", | ||
| "automationhub.projects.management:write", | ||
| "automationhub.automations:read", | ||
| "automationhub.automations:write", | ||
| "automationhub.executions:read", | ||
| "automationhub.audit-logs:read", | ||
| "automationhub.variables:read", | ||
| "automationhub.variables:write", | ||
| "automationhub.accounts:read", | ||
| "brand-kits:read", | ||
| "brand-kits:manage", | ||
| "cm.variant:read", | ||
| "cm.variant:write", | ||
| "analytics:read", | ||
| "auditlogs:read", | ||
| "teams:read", | ||
| "teams:write" | ||
| ], | ||
| "allow_pkce": true | ||
| }, | ||
| "app_token_config": { | ||
| "enabled": false, | ||
| "scopes": [] | ||
| } | ||
| }, | ||
| "group": "user" | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.