mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-04 18:04:18 +00:00
lint + prettier
This commit is contained in:
@@ -2,10 +2,27 @@
|
||||
* Small pure helpers of the plugin module (#plugins): permission recognition and
|
||||
* the code/data path resolution (both the env-override and default branches).
|
||||
*/
|
||||
import { describe, it, expect, afterEach } from 'vitest';
|
||||
import { isKnownPermission, METHOD_PERMISSION, KNOWN_METHODS, HOOK_PERMISSION } from '../../../src/nest/plugins/protocol/envelope';
|
||||
import {
|
||||
pluginsCodeRoot,
|
||||
pluginsDataRoot,
|
||||
pluginCodeDir,
|
||||
pluginDataDir,
|
||||
pluginDbFile,
|
||||
resolveChildEntry,
|
||||
serverCodeRoot,
|
||||
pluginPermissionArgs,
|
||||
pluginRealCodeDir,
|
||||
ensurePluginModuleType,
|
||||
} from '../../../src/nest/plugins/paths';
|
||||
import {
|
||||
isKnownPermission,
|
||||
METHOD_PERMISSION,
|
||||
KNOWN_METHODS,
|
||||
HOOK_PERMISSION,
|
||||
} from '../../../src/nest/plugins/protocol/envelope';
|
||||
|
||||
import path from 'node:path';
|
||||
import { pluginsCodeRoot, pluginsDataRoot, pluginCodeDir, pluginDataDir, pluginDbFile, resolveChildEntry, serverCodeRoot, pluginPermissionArgs, pluginRealCodeDir, ensurePluginModuleType } from '../../../src/nest/plugins/paths';
|
||||
import { describe, it, expect, afterEach } from 'vitest';
|
||||
|
||||
afterEach(() => {
|
||||
delete process.env.TREK_PLUGINS_DIR;
|
||||
@@ -109,17 +126,7 @@ describe('paths', () => {
|
||||
* still matches the route and arrives here decoded.
|
||||
*/
|
||||
describe('plugin id containment', () => {
|
||||
const traversals = [
|
||||
'../../uploads',
|
||||
'../..',
|
||||
'..',
|
||||
'.',
|
||||
'a/b',
|
||||
'a\b',
|
||||
'C:\Windows',
|
||||
'.hidden',
|
||||
'',
|
||||
];
|
||||
const traversals = ['../../uploads', '../..', '..', '.', 'a/b', 'a\b', 'C:\Windows', '.hidden', ''];
|
||||
|
||||
it('refuses any id that could point outside its parent', () => {
|
||||
for (const id of traversals) {
|
||||
|
||||
Reference in New Issue
Block a user