Skip to content

Commit 774e7ad

Browse files
committed
Version 1.0.1
1 parent f7cc603 commit 774e7ad

5 files changed

Lines changed: 38 additions & 30 deletions

File tree

caido.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default defineConfig({
1212
id,
1313
name: "Authify",
1414
description: "Plugin for seamless Authorization testing of user roles",
15-
version: "1.0.0",
15+
version: "1.0.1",
1616
author: {
1717
name: "Saltify",
1818
email: "saltify7@gmail.com",

packages/backend/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,7 @@ export type API = DefineAPI<{
868868
getCurrentProjectId: typeof getCurrentProjectId;
869869
saveMatchReplaceRules: typeof saveMatchReplaceRules;
870870
getMatchReplaceRules: typeof getMatchReplaceRules;
871-
applyMatchReplaceRules: (sdk: SDK, body: string) => string;
871+
applyMatchReplaceRules: (sdk: SDK, body: string, requestLine?: string, headers?: Record<string, string>) => { body: string; requestLine?: string; headers?: Record<string, string> };
872872
hasEnabledMatchReplaceRules: (sdk: SDK) => boolean;
873873
storeHttpqlFilter: typeof storeHttpqlFilter;
874874
getStoredHttpqlFilter: typeof getStoredHttpqlFilter;
@@ -893,7 +893,7 @@ export async function init(sdk: SDK<API, BackendEvents>) {
893893
sdk.api.register("getCurrentProjectId", getCurrentProjectId);
894894
sdk.api.register("saveMatchReplaceRules", saveMatchReplaceRules);
895895
sdk.api.register("getMatchReplaceRules", getMatchReplaceRules);
896-
sdk.api.register("applyMatchReplaceRules", (sdk: SDK, body: string) => applyMatchReplaceRules(body).body);
896+
sdk.api.register("applyMatchReplaceRules", (sdk: SDK, body: string, requestLine?: string, headers?: Record<string, string>) => applyMatchReplaceRules(body, requestLine, headers));
897897
sdk.api.register("hasEnabledMatchReplaceRules", (sdk: SDK) => hasEnabledMatchReplaceRules());
898898
sdk.api.register("storeHttpqlFilter", storeHttpqlFilter);
899899
sdk.api.register("getStoredHttpqlFilter", getStoredHttpqlFilter);

packages/frontend/src/configs/scopes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export class ScopesManager {
9393
// Stored scope no longer exists, default to "Unset Scope"
9494
this.selectedScope.value = '';
9595
console.log("Previously selected scope no longer exists, defaulting to 'Unset Scope'");
96-
this.sdk.window.showToast("Previously selected scope no longer available", { variant: "warning" });
96+
this.sdk.window.showToast("Authify: Previously selected scope no longer available", { variant: "warning" });
9797
}
9898
} else {
9999
// No stored scope, default to "Unset Scope"

packages/frontend/src/index.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,26 +79,32 @@ async function applyHeadersToReplay(sdk: any, requestText: string, authHeaders:
7979
}
8080

8181
// Add new auth headers
82-
const modifiedHeaders = { ...filteredHeaders, ...newAuthHeaders };
82+
let modifiedHeaders = { ...filteredHeaders, ...newAuthHeaders };
8383

8484
// Reconstruct the request
85-
const requestLine = lines[0]; // GET /path HTTP/1.1
85+
let requestLine = lines[0]; // GET /path HTTP/1.1
8686
const body = headerEndIndex < lines.length ? lines.slice(headerEndIndex + 1).join('\r\n') : '';
8787

88-
// Apply match & replace rules to the request body (if any rules are configured)
88+
// Apply match & replace rules across the entire request (headers, request line, and body)
8989
let modifiedBody = body;
9090
try {
9191
const hasRules = await sdk.backend.hasEnabledMatchReplaceRules();
9292
if (hasRules) {
93-
const modifiedBodyResult = await sdk.backend.applyMatchReplaceRules(body);
94-
modifiedBody = modifiedBodyResult;
95-
if (modifiedBody !== body) {
96-
console.log(`Applied match & replace rules to request body`);
93+
const result = await sdk.backend.applyMatchReplaceRules(body, requestLine, modifiedHeaders);
94+
modifiedBody = result.body;
95+
if (result.requestLine !== undefined) {
96+
requestLine = result.requestLine;
97+
}
98+
if (result.headers !== undefined) {
99+
modifiedHeaders = result.headers;
100+
}
101+
if (modifiedBody !== body || requestLine !== lines[0]) {
102+
console.log(`Applied match & replace rules across entire request (headers, path, and body)`);
97103
}
98104
}
99105
} catch (error) {
100106
console.warn("Error applying match & replace rules:", error);
101-
// Continue with original body if match & replace fails
107+
// Continue with original values if match & replace fails
102108
}
103109

104110
let modifiedRequest = requestLine + '\r\n';

packages/frontend/src/views/App.vue

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,27 +1056,29 @@ const ignorePathInHttpql = async (row: Row) => {
10561056
</div>
10571057
<span v-if="isEnabled" class="text-xs text-amber-400">(Read-only while monitoring)</span>
10581058
</div>
1059-
<div class="w-full">
1060-
<Textarea
1061-
v-model="auth"
1062-
class="w-full"
1063-
rows="8"
1064-
:readonly="isEnabled"
1065-
placeholder="Paste authentication headers (Cookie, Authorization, etc. - one per line)...
1059+
<div class="bg-surface-800 border border-surface-700 rounded-lg p-4">
1060+
<div class="w-full">
1061+
<Textarea
1062+
v-model="auth"
1063+
class="w-full"
1064+
rows="8"
1065+
:readonly="isEnabled"
1066+
placeholder="Paste authentication headers (Cookie, Authorization, etc. - one per line)...
10661067
10671068
e.g.
10681069
Cookie: session_id=abc123;
10691070
X-CSRF-Token: def456"
1070-
@input="autoSaveAuthHeaders"
1071-
:pt="{
1072-
root: {
1073-
class: `w-full bg-surface-800 border-surface-700 text-surface-0 rounded-lg ${isEnabled ? 'opacity-75' : ''}`
1074-
},
1075-
input: {
1076-
class: 'w-full bg-surface-800 text-surface-0 placeholder:text-surface-400 resize-none overflow-auto rounded-lg'
1077-
}
1078-
}"
1079-
/>
1071+
@input="autoSaveAuthHeaders"
1072+
:pt="{
1073+
root: {
1074+
class: `w-full bg-surface-700 border border-surface-600 text-surface-0 rounded-lg ${isEnabled ? 'opacity-75' : ''}`
1075+
},
1076+
input: {
1077+
class: 'w-full bg-surface-700 text-surface-0 placeholder:text-surface-400 resize-none overflow-auto rounded-lg'
1078+
}
1079+
}"
1080+
/>
1081+
</div>
10801082
</div>
10811083
</div>
10821084

@@ -1281,7 +1283,7 @@ X-CSRF-Token: def456"
12811283
<div class="relative group">
12821284
<i class="fas fa-info-circle text-surface-400 text-sm cursor-help"></i>
12831285
<div class="absolute top-full left-0 mt-2 px-3 py-2 bg-surface-900 text-surface-0 text-sm rounded-lg shadow-lg opacity-0 group-hover:opacity-100 transition-opacity duration-200 pointer-events-none whitespace-nowrap z-50">
1284-
For advanced filtering, create a filter using the button below configure it from the "Custom Authify filter" in the Overview > Filters sidebar.
1286+
For advanced filtering, create a filter using the button below and configure it from the "Custom Authify filter" in the Overview > Filters sidebar.
12851287
<div class="absolute bottom-full left-4 w-0 h-0 border-l-4 border-r-4 border-b-4 border-transparent border-b-surface-900"></div>
12861288
</div>
12871289
</div>

0 commit comments

Comments
 (0)