Skip to content

Commit 24ae307

Browse files
authored
Merge pull request #419 from objectstack-ai/copilot/fix-auth-registration-issue
2 parents d9cb38c + 40df750 commit 24ae307

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

ROADMAP.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,7 @@ Standardize third-party plugin distribution.
968968
| `packages/foundation/plugin-query` | `@objectql/plugin-query` | Universal | QueryService, QueryBuilder, QueryAnalyzer, FilterTranslator. |
969969
| `packages/foundation/plugin-optimizations` | `@objectql/plugin-optimizations` | Universal | Connection pooling, query compilation, compiled hooks, lazy metadata. |
970970
| `packages/foundation/platform-node` | `@objectql/platform-node` | Node.js | File system integration, YAML loading, glob-based plugin discovery. |
971-
| `packages/foundation/plugin-security` | `@objectql/plugin-security` | Universal | RBAC, FLS, RLS with AST-level enforcement. |
971+
| `packages/foundation/plugin-security` | `@objectql/plugin-security` | Universal | RBAC, FLS, RLS with AST-level enforcement. Registers as `'security'` service (not `'auth'`; `'auth'` is reserved for `@objectstack/plugin-auth`). |
972972
| `packages/foundation/plugin-validator` | `@objectql/plugin-validator` | Universal | 5-type validation engine. |
973973
| `packages/foundation/plugin-formula` | `@objectql/plugin-formula` | Universal | Computed fields with sandboxed JS expressions. |
974974
| `packages/foundation/plugin-workflow` | `@objectql/plugin-workflow` | Universal | State machine executor with guards, actions, compound states. |

packages/foundation/plugin-security/__tests__/plugin.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ describe('ObjectQLSecurityPlugin', () => {
113113
expect(kernel.use).not.toHaveBeenCalled();
114114
});
115115

116-
it('should register auth service when registerService is available', async () => {
116+
it('should register security service when registerService is available', async () => {
117117
const plugin = new ObjectQLSecurityPlugin({
118118
permissions: [ACCOUNTS_PERM],
119119
});
@@ -122,7 +122,7 @@ describe('ObjectQLSecurityPlugin', () => {
122122

123123
await plugin.install({ engine: kernel, registerService });
124124

125-
expect(registerService).toHaveBeenCalledWith('auth', expect.anything());
125+
expect(registerService).toHaveBeenCalledWith('security', expect.anything());
126126
});
127127

128128
it('should not register hooks when RLS/FLS are disabled', async () => {

packages/foundation/plugin-security/src/plugin.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,13 @@ export class ObjectQLSecurityPlugin implements RuntimePlugin {
147147
// Register security hooks
148148
this.registerSecurityHooks(kernel, ctx);
149149

150-
// Register 'auth' service alias if available in context
151-
// This allows ApiRegistry and other components to find the security service
150+
// Register 'security' service alias if available in context
151+
// This allows ApiRegistry and other components to find the security service.
152+
// NOTE: We register as 'security' (authorization/RBAC), NOT 'auth'.
153+
// The 'auth' service is reserved for @objectstack/plugin-auth (authentication).
152154
if (typeof (ctx as any).registerService === 'function') {
153-
(ctx as any).registerService('auth', kernel.security);
154-
this.logger.info("Registered 'auth' service alias");
155+
(ctx as any).registerService('security', kernel.security);
156+
this.logger.info("Registered 'security' service alias");
155157
}
156158

157159
this.logger.info('Security plugin installed successfully');

0 commit comments

Comments
 (0)