Skip to content

Commit ce03f39

Browse files
Remove global-api-key-authn-handler.ts and related env variables (#1763)
Fixes OPS-3239
1 parent a69ecfa commit ce03f39

13 files changed

Lines changed: 3 additions & 75 deletions

File tree

.env.template

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
NODE_OPTIONS=--no-node-snapshot
55

66

7-
OPS_API_KEY="api-key"
87
OPS_CACHE_PATH="./dev/cache"
98
OPS_CONFIG_PATH="./dev/config"
109
OPS_ENVIRONMENT="dev"

deploy/docker-compose/.env.defaults

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ OPS_NGINX_CONFIG_FILE=nginx.gateway.conf
2222
# Authentication
2323
# ---------------------------------------------------------
2424

25-
OPS_API_KEY="api-key"
2625
OPS_ENCRYPTION_KEY=abcdef123456789abcdef123456789ab
2726
OPS_JWT_SECRET=please-change-this-secret
2827
OPS_OPENOPS_ADMIN_EMAIL=admin@openops.com

deploy/helm/openops/values.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ openopsEnv:
2020
OPS_ANALYTICS_VERSION: "{{ .Values.analytics.tag }}"
2121

2222
# Authentication
23-
OPS_API_KEY: "api-key"
2423
OPS_ENCRYPTION_KEY: abcdef123456789abcdef123456789ab
2524
OPS_JWT_SECRET: please-change-this-secret
2625
OPS_OPENOPS_ADMIN_EMAIL: admin@openops.com
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
export enum HttpHeader {
22
AUTHORIZATION = 'Authorization',
33
ACCEPT = 'Accept',
4-
API_KEY = 'Api-Key',
54
CONTENT_TYPE = 'Content-Type',
65
}

packages/cli/src/lib/commands/sync-blocks.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,8 @@ export const syncBlockCommand = new Command('sync')
7474
'-h, --apiUrl <url>',
7575
'API URL ex: https://app.openops.com/api',
7676
)
77+
.requiredOption('-t, --token <token>', 'Access token for authentication')
7778
.action(async (options) => {
78-
const apiKey = process.env.OPS_API_KEY;
7979
const apiUrlWithoutTrailSlash = options.apiUrl.replace(/\/$/, '');
80-
if (!apiKey) {
81-
console.error(chalk.red('OPS_API_KEY environment variable is required'));
82-
process.exit(1);
83-
}
84-
await syncBlocks(apiUrlWithoutTrailSlash, apiKey);
80+
await syncBlocks(apiUrlWithoutTrailSlash, options.token);
8581
});

packages/server/api/.env.tests

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
OPS_API_KEY=api-key
21
OPS_QUEUE_MODE=MEMORY
32
OPS_DB_TYPE=SQLITE3
43
OPS_ENVIRONMENT=test
@@ -16,7 +15,6 @@ OPS_JWT_SECRET=secret
1615
OPS_BILLING_SETTINGS={\"nickname\":\"test-flow-plan\",\"tasks\":1000,\"activeFlows\":20,\"minimumPollingInterval\":5,\"connections\":50,\"teamMembers\":1,\"type\":\"FLOWS\"}
1716
OPS_STRIPE_SECRET_KEY=invalid-key
1817
OPS_FIREBASE_HASH_PARAMETERS={\"memCost\":14,\"rounds\":8,\"signerKey\":\"YE0dO4bwD4JnJafh6lZZfkp1MtKzuKAXQcDCJNJNyeCHairWHKENOkbh3dzwaCdizzOspwr/FITUVlnOAwPKyw==\",\"saltSeparator\":\"Bw==\"}
19-
OPS_API_KEY="api-key"
2018
OPS_CLOUD_ORGANIZATION_ID="cloud-id"
2119
OPS_BLOCKS_SYNC_MODE=NONE
2220
OPS_CONTAINER_TYPE=WORKER_AND_APP

packages/server/api/src/app/core/security/authn/global-api-key-authn-handler.ts

Lines changed: 0 additions & 45 deletions
This file was deleted.

packages/server/api/src/app/core/security/security-handler-chain.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@ import { Principal } from '@openops/shared';
22
import { FastifyRequest } from 'fastify';
33
import { AccessTokenAuthnHandler } from './authn/access-token-authn-handler';
44
import { AnonymousAuthnHandler } from './authn/anonymous-authn-handler';
5-
import { GlobalApiKeyAuthnHandler } from './authn/global-api-key-authn-handler';
65
import { PrincipalTypeAuthzHandler } from './authz/principal-type-authz-handler';
76
import { ProjectAuthzHandler } from './authz/project-authz-handler';
87

98
const AUTHN_HANDLERS = [
10-
new GlobalApiKeyAuthnHandler(),
119
new AccessTokenAuthnHandler(),
1210
new AnonymousAuthnHandler(),
1311
];

packages/server/api/src/app/helper/error-handler.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ const isValidationError = (error: unknown): error is FastifyValidationError => {
7575
};
7676

7777
const statusCodeMap: Partial<Record<ErrorCode, StatusCodes>> = {
78-
[ErrorCode.INVALID_API_KEY]: StatusCodes.UNAUTHORIZED,
7978
[ErrorCode.INVALID_BEARER_TOKEN]: StatusCodes.UNAUTHORIZED,
8079
[ErrorCode.FEATURE_DISABLED]: StatusCodes.PAYMENT_REQUIRED,
8180
[ErrorCode.PERMISSION_DENIED]: StatusCodes.FORBIDDEN,

packages/server/api/src/app/workers/machine/machine-controller.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ export const workerMachineController: FastifyPluginAsyncTypebox = async (
5555

5656
const GenerateWorkerTokenParams = {
5757
config: {
58-
// TODO this should be replaced with the user
59-
allowedPrincipals: [PrincipalType.SUPER_USER],
58+
allowedPrincipals: [PrincipalType.USER],
6059
},
6160
schema: {
6261
description:

0 commit comments

Comments
 (0)