Skip to content

Commit 1b5f130

Browse files
committed
fix(update UX and add save state):
1 parent 430aeb6 commit 1b5f130

File tree

3 files changed

+101
-1
lines changed

3 files changed

+101
-1
lines changed

agentic_security/static/index.html

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,45 @@ <h2 class="text-2xl font-bold">Parameters</h2>
142142
</svg>
143143
</div>
144144
<div v-show="showParams" class="mt-4">
145+
<div class="flex items-center justify-end mt-4">
146+
<button
147+
@click="confirmResetState"
148+
class="flex items-center bg-dark-accent-red text-dark-bg rounded-lg px-4 py-2 text-sm font-medium hover:bg-opacity-80 transition-colors">
149+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-2"
150+
fill="none" viewBox="0 0 24 24" stroke="currentColor">
151+
<path stroke-linecap="round" stroke-linejoin="round"
152+
stroke-width="2"
153+
d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />
154+
</svg>
155+
Reset State
156+
</button>
157+
</div>
158+
<!-- Confirmation Modal -->
159+
<div
160+
v-if="showResetConfirmation"
161+
class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">
162+
<div class="bg-dark-card rounded-lg p-6 max-w-sm w-full">
163+
<h3 class="text-xl font-bold mb-4 text-dark-text">Confirm
164+
Reset</h3>
165+
<p class="text-gray-400 mb-6">Are you sure you want to reset all
166+
settings to their default state? This action cannot be
167+
undone.</p>
168+
<div class="flex justify-end space-x-4">
169+
<button
170+
@click="showResetConfirmation = false"
171+
class="bg-gray-600 text-dark-text rounded-lg px-4 py-2 hover:bg-opacity-80 transition-colors">
172+
Cancel
173+
</button>
174+
<button
175+
@click="resetState"
176+
class="bg-dark-accent-red text-dark-bg rounded-lg px-4 py-2 hover:bg-opacity-80 transition-colors">
177+
Reset
178+
</button>
179+
</div>
180+
</div>
181+
</div>
182+
<!-- Confirmation Modal -->
183+
145184
<!-- Maximum Budget Slider -->
146185
<!-- Budget Slider -->
147186
<section class="bg-dark-card rounded-lg p-6 shadow-lg">
@@ -229,6 +268,21 @@ <h3 class="text-lg font-semibold">Enable Concurrency</h3>
229268
concurrently. This can significantly reduce the total scan time
230269
but may increase resource usage.
231270
</p>
271+
<!-- Multi-Step Attack Toggle -->
272+
<div class="flex items-center justify-between mb-2">
273+
<h3 class="text-lg font-semibold">Enable Multi-Step Attack</h3>
274+
<label class="relative inline-flex items-center cursor-pointer">
275+
<input type="checkbox" v-model="enableMultiStepAttack"
276+
class="sr-only peer">
277+
<div
278+
class="w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-dark-accent-green rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-dark-accent-green"></div>
279+
</label>
280+
</div>
281+
<p class="text-sm text-gray-400 mt-2">
282+
When enabled, the scan will attempt multi-step attack
283+
simulations,
284+
increasing accuracy and depth of analysis.
285+
</p>
232286
</div>
233287
</div>
234288
</section>

agentic_security/static/main.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,12 @@ var app = new Vue({
7373
modelSpec: LLM_SPECS[0],
7474
budget: 50,
7575
showParams: false,
76+
showResetConfirmation: false,
7677
enableChartDiagram: true,
7778
enableLogging: false,
7879
enableConcurrency: false,
7980
optimize: false,
81+
enableMultiStepAttack: false,
8082
showDatasets: false,
8183
scanResults: [],
8284
mainTable: [],
@@ -117,6 +119,7 @@ var app = new Vue({
117119
this.adjustHeight({ target: document.getElementById('llm-spec') });
118120
// this.startScan();
119121
this.loadConfigs();
122+
120123
},
121124
computed: {
122125
selectedDS: function () {
@@ -131,6 +134,45 @@ var app = new Vue({
131134
this.showConsentModal = false; // Close the modal
132135
localStorage.setItem('consentGiven', 'true'); // Save consent to local storage
133136
},
137+
138+
saveStateToLocalStorage() {
139+
const state = {
140+
modelSpec: this.modelSpec,
141+
budget: this.budget,
142+
dataConfig: this.dataConfig,
143+
optimize: this.optimize,
144+
enableChartDiagram: this.enableChartDiagram,
145+
};
146+
localStorage.setItem('appState', JSON.stringify(state));
147+
},
148+
loadStateFromLocalStorage() {
149+
const savedState = localStorage.getItem('appState');
150+
console.log('Loading state from local storage:', savedState);
151+
if (savedState) {
152+
const state = JSON.parse(savedState);
153+
this.modelSpec = state.modelSpec;
154+
this.budget = state.budget;
155+
this.dataConfig = state.dataConfig;
156+
this.optimize = state.optimize;
157+
this.enableChartDiagram = state.enableChartDiagram;
158+
}
159+
},
160+
resetState() {
161+
localStorage.removeItem('appState');
162+
this.modelSpec = LLM_SPECS[0];
163+
this.budget = 50;
164+
this.dataConfig.forEach(config => config.selected = false);
165+
this.optimize = false;
166+
this.enableChartDiagram = true;
167+
this.okMsg = '';
168+
this.errorMsg = '';
169+
this.integrationVerified = false;
170+
this.showResetConfirmation = false;
171+
},
172+
confirmResetState() {
173+
this.showResetConfirmation = true;
174+
},
175+
134176
declineConsent() {
135177
this.showConsentModal = false; // Close the modal
136178
localStorage.setItem('consentGiven', 'false'); // Save decline to local storage
@@ -186,6 +228,7 @@ var app = new Vue({
186228
// this.$forceUpdate();
187229

188230
}
231+
this.saveStateToLocalStorage();
189232
},
190233
loadConfigs: async function () {
191234
const response = await fetch(`${URL}/v1/data-config`, {
@@ -196,6 +239,7 @@ var app = new Vue({
196239
});
197240
console.log(response);
198241
this.dataConfig = await response.json();
242+
this.loadStateFromLocalStorage();
199243
},
200244
selectConfig(index) {
201245
this.selectedConfig = index;
@@ -413,6 +457,8 @@ var app = new Vue({
413457
}
414458
});
415459
}
460+
this.saveStateToLocalStorage();
461+
416462
}
417463
}
418464
});

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "agentic_security"
3-
version = "0.3.2"
3+
version = "0.3.3"
44
description = "Agentic LLM vulnerability scanner"
55
authors = ["Alexander Miasoiedov <msoedov@gmail.com>"]
66
maintainers = ["Alexander Miasoiedov <msoedov@gmail.com>"]

0 commit comments

Comments
 (0)