Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion library/agent/AIStatistics.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "tap";
import t from "tap";
import { AIStatistics } from "./AIStatistics";

t.test("it initializes with empty state", async () => {
Expand Down
4 changes: 2 additions & 2 deletions library/agent/Agent.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as FakeTimers from "@sinonjs/fake-timers";
import FakeTimers from "@sinonjs/fake-timers";
import { hostname, platform, release } from "os";
import * as t from "tap";
import t from "tap";
import { getSemverNodeVersion } from "../helpers/getNodeVersion";
import { ip } from "../helpers/ipAddress";
import { wrap } from "../helpers/wrap";
Expand Down
2 changes: 1 addition & 1 deletion library/agent/AikidoDAST.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "tap";
import t from "tap";
import { isAikidoDASTRequest } from "./AikidoDAST";
import type { Context } from "./Context";

Expand Down
4 changes: 2 additions & 2 deletions library/agent/AttackLogger.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { wrap } from "../helpers/wrap";
import { DetectedAttack } from "./api/Event";
import { AttackLogger } from "./AttackLogger";
import * as t from "tap";
import * as FakeTimers from "@sinonjs/fake-timers";
import t from "tap";
import FakeTimers from "@sinonjs/fake-timers";

const logs: string[] = [];
wrap(console, "log", function log() {
Expand Down
2 changes: 1 addition & 1 deletion library/agent/Context.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "tap";
import t from "tap";
import { sep } from "node:path";
import { extractStringsFromUserInputCached } from "../helpers/extractStringsFromUserInputCached";
import { extractPathStringsFromUserInputCached } from "../helpers/extractPathStringsFromUserInputCached";
Expand Down
2 changes: 1 addition & 1 deletion library/agent/Hostnames.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "tap";
import t from "tap";
import { Hostnames } from "./Hostnames";

t.test("it works", async () => {
Expand Down
4 changes: 2 additions & 2 deletions library/agent/InspectionStatistics.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as FakeTimers from "@sinonjs/fake-timers";
import * as t from "tap";
import FakeTimers from "@sinonjs/fake-timers";
import t from "tap";
import { InspectionStatistics } from "./InspectionStatistics";

t.test("it resets stats", async () => {
Expand Down
4 changes: 2 additions & 2 deletions library/agent/Packages.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as t from "tap";
import * as FakeTimers from "@sinonjs/fake-timers";
import t from "tap";
import FakeTimers from "@sinonjs/fake-timers";
import { Packages } from "./Packages";

t.test("addPackage should add a new package", async (t) => {
Expand Down
2 changes: 1 addition & 1 deletion library/agent/PendingEvents.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "tap";
import t from "tap";
import { setTimeout } from "timers/promises";
import { PendingEvents } from "./PendingEvents";

Expand Down
2 changes: 1 addition & 1 deletion library/agent/Routes.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "tap";
import t from "tap";
import { Routes } from "./Routes";
import { Context } from "./Context";

Expand Down
2 changes: 1 addition & 1 deletion library/agent/ServiceConfig.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "tap";
import t from "tap";
import { ServiceConfig } from "./ServiceConfig";

t.test("it returns false if empty rules", async () => {
Expand Down
4 changes: 2 additions & 2 deletions library/agent/Users.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as FakeTimers from "@sinonjs/fake-timers";
import * as t from "tap";
import FakeTimers from "@sinonjs/fake-timers";
import t from "tap";
import { Users } from "./Users";

t.test("it works", async () => {
Expand Down
2 changes: 1 addition & 1 deletion library/agent/api-discovery/getApiAuthType.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "tap";
import t from "tap";
import { getApiAuthType as get } from "./getApiAuthType";
import type { Context } from "../Context";

Expand Down
2 changes: 1 addition & 1 deletion library/agent/api-discovery/getBodyDataType.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "tap";
import t from "tap";
import { getBodyDataType } from "./getBodyDataType";

t.test("it works", async (t) => {
Expand Down
2 changes: 1 addition & 1 deletion library/agent/api-discovery/getDataSchema.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "tap";
import t from "tap";
import { getDataSchema } from "./getDataSchema";

t.test("it works", async (t) => {
Expand Down
2 changes: 1 addition & 1 deletion library/agent/api-discovery/getStringFormat.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "tap";
import t from "tap";
import { getStringFormat } from "./getStringFormat";

t.test("it is not a known format", async (t) => {
Expand Down
2 changes: 1 addition & 1 deletion library/agent/api-discovery/helpers/isDateString.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "tap";
import t from "tap";
import isDateString from "./isDateString";

t.test("it is a date string", async (t) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "tap";
import t from "tap";
import isDateTimeString from "./isDateTimeString";

t.test("it is a date time string", async (t) => {
Expand Down
2 changes: 1 addition & 1 deletion library/agent/api-discovery/helpers/isEmail.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "tap";
import t from "tap";
import isEmail from "./isEmail";

t.test("is a valid email", async (t) => {
Expand Down
2 changes: 1 addition & 1 deletion library/agent/api-discovery/helpers/isFQDN.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "tap";
import t from "tap";
import isFQDN from "./isFQDN";

t.test("is a valid domain", async (t) => {
Expand Down
2 changes: 1 addition & 1 deletion library/agent/api-discovery/helpers/isUUIDString.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "tap";
import t from "tap";
import isUUIDString from "./isUUIDString";

t.test("it is a uuid", async (t) => {
Expand Down
2 changes: 1 addition & 1 deletion library/agent/api-discovery/helpers/isUri.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "tap";
import t from "tap";
import isUri from "./isUri";

t.test("is a valid URI", async (t) => {
Expand Down
2 changes: 1 addition & 1 deletion library/agent/api-discovery/mergeApiAuthTypes.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "tap";
import t from "tap";
import { mergeApiAuthTypes as merge } from "./mergeApiAuthTypes";

t.test("it works", async (t) => {
Expand Down
2 changes: 1 addition & 1 deletion library/agent/api-discovery/mergeDataSchemas.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "tap";
import t from "tap";
import { mergeDataSchemas } from "./mergeDataSchemas";
import { getDataSchema } from "./getDataSchema";

Expand Down
6 changes: 3 additions & 3 deletions library/agent/api/FetchListsAPINodeHTTP.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as express from "express";
import * as asyncHandler from "express-async-handler";
import * as t from "tap";
import express from "express";
import asyncHandler from "express-async-handler";
import t from "tap";
import { Token } from "./Token";
import { FetchListsAPINodeHTTP } from "./FetchListsAPINodeHTTP";
import { FetchListsAPIResponse } from "./FetchListsAPI";
Expand Down
6 changes: 3 additions & 3 deletions library/agent/api/ReportingAPINodeHTTP.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as express from "express";
import * as asyncHandler from "express-async-handler";
import * as t from "tap";
import express from "express";
import asyncHandler from "express-async-handler";
import t from "tap";
import { ReportingAPINodeHTTP } from "./ReportingAPINodeHTTP";
import { Event } from "./Event";
import { Token } from "./Token";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "tap";
import t from "tap";
import { ReportingAPIForTesting } from "./ReportingAPIForTesting";
import { ReportingAPIRateLimitedClientSide } from "./ReportingAPIRateLimitedClientSide";
import { Token } from "./Token";
Expand Down
4 changes: 2 additions & 2 deletions library/agent/api/ReportingAPIRateLimitedServerSide.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as FakeTimers from "@sinonjs/fake-timers";
import * as t from "tap";
import FakeTimers from "@sinonjs/fake-timers";
import t from "tap";
import { ReportingAPIForTesting } from "./ReportingAPIForTesting";
import { ReportingAPIRateLimitedServerSide } from "./ReportingAPIRateLimitedServerSide";
import { Event } from "./Event";
Expand Down
2 changes: 1 addition & 1 deletion library/agent/api/ReportingAPIThatValidatesToken.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "tap";
import t from "tap";
import { ReportingAPIForTesting } from "./ReportingAPIForTesting";
import { ReportingAPIThatValidatesToken } from "./ReportingAPIThatValidatesToken";
import { Event } from "./Event";
Expand Down
2 changes: 1 addition & 1 deletion library/agent/api/Token.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "tap";
import t from "tap";
import { Token } from "./Token";

t.test("it throws error if token is empty", async (t) => {
Expand Down
2 changes: 1 addition & 1 deletion library/agent/applyHooks.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "tap";
import t from "tap";
import { ReportingAPIForTesting } from "./api/ReportingAPIForTesting";
import { Token } from "./api/Token";
import { applyHooks } from "./applyHooks";
Expand Down
2 changes: 1 addition & 1 deletion library/agent/context/markUnsafe.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "tap";
import t from "tap";
import { createTestAgent } from "../../helpers/createTestAgent";
import { wrap } from "../../helpers/wrap";
import { checkContextForSqlInjection } from "../../vulnerabilities/sql-injection/checkContextForSqlInjection";
Expand Down
2 changes: 1 addition & 1 deletion library/agent/context/tenantId.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* oxlint-disable no-console */
import * as t from "tap";
import t from "tap";
import { EventEmitter } from "events";
import { setTimeout as sleep } from "node:timers/promises";
import {
Expand Down
2 changes: 1 addition & 1 deletion library/agent/context/user.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "tap";
import t from "tap";
import { wrap } from "../../helpers/wrap";
import {
type Context,
Expand Down
2 changes: 1 addition & 1 deletion library/agent/exports.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "tap";
import t from "tap";
import * as pkg from "../index";

t.test("has named and default exports", async (t) => {
Expand Down
2 changes: 1 addition & 1 deletion library/agent/extractRegionFromToken.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "tap";
import t from "tap";
import { extractRegionFromToken } from "./extractRegionFromToken";

t.test("should return EU for empty token", async (t) => {
Expand Down
2 changes: 1 addition & 1 deletion library/agent/getAPIURL.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "tap";
import t from "tap";
import { getAPIURL } from "./getAPIURL";

t.afterEach(() => {
Expand Down
2 changes: 1 addition & 1 deletion library/agent/hooks/Hooks.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "tap";
import t from "tap";
import { Hooks } from "./Hooks";

t.test("package throws error if name is empty", async (t) => {
Expand Down
2 changes: 1 addition & 1 deletion library/agent/hooks/getModuleInfoFromPath.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "tap";
import t from "tap";
import { getModuleInfoFromPath } from "./getModuleInfoFromPath";

t.test("it works", async (t) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as t from "tap";
import t from "tap";
import { wrap } from "../../../helpers/wrap";
import { registerNodeHooks } from "./index";
import * as mod from "node:module";
import mod from "node:module";

const logs: string[] = [];
wrap(console, "warn", function warn() {
Expand Down
4 changes: 2 additions & 2 deletions library/agent/hooks/instrumentation/checkHooks.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "tap";
import t from "tap";
import { checkHooks } from "./checkHooks";
import { wrap } from "../../../helpers/wrap";

Expand All @@ -10,7 +10,7 @@ wrap(console, "warn", function warn() {
});

t.test("it works", async (t) => {
await checkHooks();
checkHooks();

t.same(logs, [
"AIKIDO: A self check of the code instrumentation failed. This means that the protection might not work as expected.",
Expand Down
4 changes: 2 additions & 2 deletions library/agent/hooks/instrumentation/checkHooks.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export async function checkHooks() {
export function checkHooks() {
let success = false;

try {
const imported = await import("./zenHooksCheckImport");
const imported = require("./zenHooksCheckImport");

if (imported.test() === ":)") {
success = true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "tap";
import t from "tap";
import { transformCode } from "./codeTransformation";
import { readFile } from "fs/promises";
import { join } from "path";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "tap";
import t from "tap";
import { transformCode } from "./codeTransformation";

const compareCodeStrings = (code1: string, code2: string) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "tap";
import t from "tap";
import { getPackageVersionFromPath } from "./getPackageVersionFromPath";
import { join } from "path";

Expand Down
2 changes: 1 addition & 1 deletion library/agent/hooks/instrumentation/getSourceType.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "tap";
import t from "tap";
import { getSourceType } from "./getSourceType";

t.test("getSourceType works", async (t) => {
Expand Down
2 changes: 1 addition & 1 deletion library/agent/hooks/instrumentation/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { onModuleLoad } from "./loadHook";
import * as mod from "node:module";
import mod from "node:module";
import type { RegisterHookFunction } from "./types";
import { patchProcessGetBuiltinModule } from "./processGetBuiltin";
import { checkHooks } from "./checkHooks";
Expand Down
2 changes: 1 addition & 1 deletion library/agent/hooks/instrumentation/instructions.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "tap";
import t from "tap";
import {
getBuiltinInterceptors,
getFunctionCallbackInfo,
Expand Down
4 changes: 2 additions & 2 deletions library/agent/hooks/instrumentation/loadHook.packages.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as mod from "node:module";
import * as t from "tap";
import mod from "node:module";
import t from "tap";
import { createTestAgent } from "../../../helpers/createTestAgent";
import { ReportingAPIForTesting } from "../../api/ReportingAPIForTesting";
import { Token } from "../../api/Token";
Expand Down
Loading
Loading