cabloy 5.1.186 → 5.1.187

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.cabloy-version CHANGED
@@ -1 +1 @@
1
- 5.1.186
1
+ 5.1.187
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.1.187
4
+
5
+ ### Improvements
6
+
7
+ - Enhance redirection handling for trusted external destinations.
8
+
3
9
  ## 5.1.186
4
10
 
5
11
  ### Improvements
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cabloy",
3
- "version": "5.1.186",
3
+ "version": "5.1.187",
4
4
  "gitHead": "2c5c19284bab738e492856189acb6fad74b8a7b7",
5
5
  "description": "A Node.js fullstack framework",
6
6
  "keywords": [
package/vona/env/.env CHANGED
@@ -124,3 +124,8 @@ MAIL_SYSTEM_TRANSPORT_SECURE = false
124
124
  MAIL_SYSTEM_TRANSPORT_AUTH_USER =
125
125
  MAIL_SYSTEM_TRANSPORT_AUTH_PASS =
126
126
  MAIL_SYSTEM_DEFAULTS_FROM = no.reply@cabloy.com
127
+
128
+ # demonstration
129
+
130
+ DEMONSTRATION_ENABLED = false
131
+ DEMONSTRATION_USERNAME_WHITELIST =
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vona-cli",
3
- "version": "1.1.153",
3
+ "version": "1.1.154",
4
4
  "gitHead": "a79189b882c17af5911573896a781bbb0046d37d",
5
5
  "description": "vona cli",
6
6
  "keywords": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vona-cli-set-api",
3
- "version": "1.1.151",
3
+ "version": "1.1.152",
4
4
  "gitHead": "a79189b882c17af5911573896a781bbb0046d37d",
5
5
  "description": "vona cli-set-api",
6
6
  "keywords": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vona",
3
- "version": "5.1.97",
3
+ "version": "5.1.98",
4
4
  "gitHead": "a79189b882c17af5911573896a781bbb0046d37d",
5
5
  "description": "Vona is an intuitive, elegant and powerful Node.js framework for rapidly developing enterprise applications of any size",
6
6
  "keywords": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vona-core",
3
- "version": "5.1.39",
3
+ "version": "5.1.40",
4
4
  "gitHead": "a79189b882c17af5911573896a781bbb0046d37d",
5
5
  "description": "vona",
6
6
  "keywords": [
@@ -1,5 +1,5 @@
1
1
  import type { IInstanceRecord } from '../../types/config/instance.ts';
2
- import type { ContextBase } from '../../types/context/contextBase.ts';
2
+ import type { ContextBase, IContextRedirectOptions } from '../../types/context/contextBase.ts';
3
3
  import type { VonaContext } from '../../types/context/index.ts';
4
4
  import type { MetadataKey } from './metadata.ts';
5
5
 
@@ -121,15 +121,16 @@ export const contextBase: ContextBase = {
121
121
  return false;
122
122
  },
123
123
 
124
- redirect(url: string, status?: 301 | 302): void {
124
+ redirect(url: string, statusOrOptions?: (301 | 302) | IContextRedirectOptions): void {
125
125
  const self = cast<VonaContext>(this);
126
+ const options =
127
+ typeof statusOrOptions === 'number' ? { status: statusOrOptions } : (statusOrOptions ?? {});
126
128
  // checkOrigin
127
- if (!url.startsWith('/')) {
129
+ if (!url.startsWith('/') && !options.trustedExternal) {
128
130
  const origin = cast(self.app.bean).security.checkOrigin(url, self.host);
129
131
  if (!origin) self.app.throw(403);
130
132
  }
131
133
  // throw
132
- status = status ?? 302;
133
- self.app.throw(status, url);
134
+ self.app.throw(options.status ?? 302, url);
134
135
  },
135
136
  };
@@ -3,6 +3,11 @@ import type { VonaConfig } from '../config/config.ts';
3
3
  import type { IInstanceRecord } from '../config/instance.ts';
4
4
  import type { VonaContext } from './index.ts';
5
5
 
6
+ export interface IContextRedirectOptions {
7
+ status?: 301 | 302;
8
+ trustedExternal?: boolean;
9
+ }
10
+
6
11
  export interface ContextBase {
7
12
  get bean(): BeanContainer;
8
13
  get locale(): keyof ILocaleRecord;
@@ -26,4 +31,5 @@ export interface ContextBase {
26
31
  set onionsDynamic(value: any | undefined);
27
32
  get acceptJSON(): boolean;
28
33
  redirect(url: string, status?: 301 | 302): void;
34
+ redirect(url: string, options?: IContextRedirectOptions): void;
29
35
  }
@@ -5,6 +5,7 @@ import type { ContextBase } from './contextBase.ts';
5
5
  import type { ContextOthers } from './contextOthers.ts';
6
6
  import type { ContextState } from './contextState.ts';
7
7
 
8
+ export type { IContextRedirectOptions } from './contextBase.ts';
8
9
  export * from './contextState.ts';
9
10
 
10
11
  // @ts-ignore ignore the throw type check of 'throw'/'meta'
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vona-mock",
3
- "version": "6.1.39",
3
+ "version": "6.1.40",
4
4
  "gitHead": "a79189b882c17af5911573896a781bbb0046d37d",
5
5
  "description": "vona mock",
6
6
  "keywords": [
@@ -1595,7 +1595,7 @@ importers:
1595
1595
  specifier: workspace:^
1596
1596
  version: link:modules/a-auth
1597
1597
  vona-module-auth-oauth:
1598
- specifier: ^5.0.10
1598
+ specifier: ^5.0.12
1599
1599
  version: link:modules/auth-oauth
1600
1600
  vona-module-auth-simple:
1601
1601
  specifier: workspace:^
@@ -42,6 +42,7 @@ export interface IGuardOptionsDemonstration extends IDecoratorGuardOptionsGlobal
42
42
  '/auth/passport/callback',
43
43
  '/auth/mock/authorize',
44
44
  '/captcha/create',
45
+ '/captcha/refresh',
45
46
  '/image/upload-policy',
46
47
  '/file/upload-policy',
47
48
  ],
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vona-module-a-auth",
3
- "version": "5.1.22",
3
+ "version": "5.1.23",
4
4
  "gitHead": "a79189b882c17af5911573896a781bbb0046d37d",
5
5
  "description": "",
6
6
  "keywords": [
@@ -86,7 +86,7 @@ export class BeanAuth extends BeanBase {
86
86
  strategy.redirect = (location: string) => {
87
87
  // real
88
88
  if (!clientOptions.mockUsername) {
89
- return this.ctx.redirect(location);
89
+ return this.ctx.redirect(location, { trustedExternal: true });
90
90
  }
91
91
  // mock
92
92
  this.ctx.request.query.code = clientOptions.mockProfileId
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vona-suite-a-auth",
3
- "version": "5.1.26",
3
+ "version": "5.1.27",
4
4
  "gitHead": "a79189b882c17af5911573896a781bbb0046d37d",
5
5
  "description": "",
6
6
  "author": "",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vona-module-a-core",
3
- "version": "5.1.53",
3
+ "version": "5.1.54",
4
4
  "gitHead": "a79189b882c17af5911573896a781bbb0046d37d",
5
5
  "description": "",
6
6
  "keywords": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vona-suite-a-vona",
3
- "version": "5.1.88",
3
+ "version": "5.1.89",
4
4
  "gitHead": "a79189b882c17af5911573896a781bbb0046d37d",
5
5
  "description": "",
6
6
  "author": "",