Fully autonomous AI Agents system capable of performing complex penetration testing tasks
Go ai-agentsai-security-toolanthropicautonomous-agentsgolanggptgraphqlmulti-agent-systemoffensive-securityopen-sourceopenaipenetration-testingpenetration-testing-toolsreactsecurity-automationsecurity-testingsecurity-toolsself-hosted
feat(forms): enforce the validation convention (noValidate + useForm lint guard)
Sergey Kozyrenko3ac35ee0d25c
diff --git a/frontend/eslint.config.mjs b/frontend/eslint.config.mjsindex 33deafbc..fe438889 100644--- a/frontend/eslint.config.mjs+++ b/frontend/eslint.config.mjs@@ -36,6 +36,15 @@ const eslintConfig = [],curly: ['error', 'all'],'no-fallthrough': 'off',+ 'no-restricted-syntax': [+ 'error',+ {+ message:+ 'Do not set mode/reValidateMode on useForm — use useAppForm, which owns the silent-until-submit form timing.',+ selector:+ 'CallExpression[callee.name="useForm"] > ObjectExpression > Property[key.name="mode"], CallExpression[callee.name="useForm"] > ObjectExpression > Property[key.name="reValidateMode"]',+ },+ ],'padding-line-between-statements': ['error',{@@ -76,6 +85,12 @@ const eslintConfig = ['react/prop-types': 'off', // TypeScript provides type checking},},+ {+ // useAppForm is the single owner of the form timing — the one place+ // allowed to set mode/reValidateMode on useForm.+ files: ['src/hooks/use-app-form.ts'],+ rules: { 'no-restricted-syntax': 'off' },+ },perfectionist.configs['recommended-natural'],{ignores: ['node_modules/**', 'dist/**', 'build/**', 'public/mockServiceWorker.js', 'src/graphql/types.ts'],diff --git a/frontend/src/features/authentication/login-form.tsx b/frontend/src/features/authentication/login-form.tsxindex 5c75e2d9..966076ab 100644--- a/frontend/src/features/authentication/login-form.tsx+++ b/frontend/src/features/authentication/login-form.tsx@@ -173,6 +173,7 @@ function LoginForm({ providers, returnUrl = routes.newFlow }: LoginFormProps) {<Form {...form}><formclassName="mx-auto grid w-[350px] gap-8"+ noValidateonSubmit={form.handleSubmit(handleSubmit)}><h1 className="text-center text-3xl font-bold">PentAGI</h1>diff --git a/frontend/src/features/authentication/name-change-form.tsx b/frontend/src/features/authentication/name-change-form.tsxindex 6e321596..7e332605 100644--- a/frontend/src/features/authentication/name-change-form.tsx+++ b/frontend/src/features/authentication/name-change-form.tsx@@ -62,6 +62,7 @@ export function NameChangeForm({ onCancel, onSuccess }: NameChangeFormProps) {<Form {...form}><formclassName="flex flex-col gap-4"+ noValidateonSubmit={form.handleSubmit(handleSubmit)}><FormFielddiff --git a/frontend/src/features/authentication/password-change-form.tsx b/frontend/src/features/authentication/password-change-form.tsxindex 84b5656b..96058bb1 100644--- a/frontend/src/features/authentication/password-change-form.tsx+++ b/frontend/src/features/authentication/password-change-form.tsx@@ -138,6 +138,7 @@ export function PasswordChangeForm({<Form {...form}><formclassName="flex flex-col gap-4"+ noValidateonSubmit={form.handleSubmit(handleSubmit)}><FormFielddiff --git a/frontend/src/features/flows/files/flow-files-promote-dialog.tsx b/frontend/src/features/flows/files/flow-files-promote-dialog.tsxindex be246349..dca26820 100644--- a/frontend/src/features/flows/files/flow-files-promote-dialog.tsx+++ b/frontend/src/features/flows/files/flow-files-promote-dialog.tsx@@ -213,6 +213,7 @@ function FlowFilesPromoteDialogForm({ files, flowId, onClose }: FlowFilesPromote<Form {...form}><formclassName="flex flex-col gap-4"+ noValidateonSubmit={handleSave}><FormFielddiff --git a/frontend/src/features/flows/flow-form.tsx b/frontend/src/features/flows/flow-form.tsxindex 8568b340..451dd12b 100644--- a/frontend/src/features/flows/flow-form.tsx+++ b/frontend/src/features/flows/flow-form.tsx@@ -157,6 +157,7 @@ export function FlowForm({resourceIds: defaultValues?.resourceIds ?? [],useAgents: defaultValues?.useAgents ?? false,},+ // eslint-disable-next-line no-restricted-syntax -- flow-form keeps live validation; useAppForm migration deferredmode: 'onChange',resolver: zodResolver(formSchema),});@@ -483,7 +484,10 @@ export function FlowForm({return (<Form {...form}>- <form onSubmit={handleFormSubmit(handleSubmit)}>+ <form+ noValidate+ onSubmit={handleFormSubmit(handleSubmit)}+ ><FormFieldcontrol={control}name="message"diff --git a/frontend/src/features/knowledges/knowledge-form.tsx b/frontend/src/features/knowledges/knowledge-form.tsxindex 102ddbad..b297365e 100644--- a/frontend/src/features/knowledges/knowledge-form.tsx+++ b/frontend/src/features/knowledges/knowledge-form.tsx@@ -363,12 +363,12 @@ export function KnowledgeForm({ initialValues, isNew, knowledge, onSubmit }: Knoreturn (<><Form {...form}>- <form- // Desktop: lock to the viewport so the resizable panels+ <form // Desktop: lock to the viewport so the resizable panels// inside the body can fill the remaining space below the// sticky header. Mobile: allow the page to grow with its// content (single column, vertical scroll).className={isDesktop ? 'flex h-[100dvh] min-h-0 w-full flex-col' : 'flex min-h-[100dvh] flex-col'}+ noValidateonSubmit={handleSubmit(onSubmitWithGuard)}><KnowledgeFormHeaderdiff --git a/frontend/src/features/resources/resources-copy-dialog.tsx b/frontend/src/features/resources/resources-copy-dialog.tsxindex d974158b..aa57a592 100644--- a/frontend/src/features/resources/resources-copy-dialog.tsx+++ b/frontend/src/features/resources/resources-copy-dialog.tsx@@ -208,6 +208,7 @@ function ResourcesCopyDialogForm({ files, onClose }: ResourcesCopyDialogFormProp<Form {...form}><formclassName="flex flex-col gap-4"+ noValidateonSubmit={handleSave}><FormFielddiff --git a/frontend/src/features/resources/resources-mkdir-dialog.tsx b/frontend/src/features/resources/resources-mkdir-dialog.tsxindex a361cc60..970edbbe 100644--- a/frontend/src/features/resources/resources-mkdir-dialog.tsx+++ b/frontend/src/features/resources/resources-mkdir-dialog.tsx@@ -83,6 +83,7 @@ function ResourcesMkdirDialogForm({ defaultParentPath, onClose }: ResourcesMkdir<Form {...form}><formclassName="flex flex-col gap-4"+ noValidateonSubmit={handleSubmit}><FormFielddiff --git a/frontend/src/features/resources/resources-move-dialog.tsx b/frontend/src/features/resources/resources-move-dialog.tsxindex 2eab1f82..f7a618c4 100644--- a/frontend/src/features/resources/resources-move-dialog.tsx+++ b/frontend/src/features/resources/resources-move-dialog.tsx@@ -210,6 +210,7 @@ function ResourcesMoveDialogForm({ files, onClose }: ResourcesMoveDialogFormProp<Form {...form}><formclassName="flex flex-col gap-4"+ noValidateonSubmit={handleSave}><FormFielddiff --git a/frontend/src/pages/settings/settings-prompt.tsx b/frontend/src/pages/settings/settings-prompt.tsxindex eb28918a..303066b2 100644--- a/frontend/src/pages/settings/settings-prompt.tsx+++ b/frontend/src/pages/settings/settings-prompt.tsx@@ -848,6 +848,7 @@ function SettingsPrompt() {<formclassName="flex min-h-0 flex-1 flex-col"id="system-prompt-form"+ noValidateonSubmit={systemForm.handleSubmit(handleSystemSubmit)}><FormMarkdownItem@@ -871,6 +872,7 @@ function SettingsPrompt() {<formclassName="flex min-h-0 flex-1 flex-col"id="human-prompt-form"+ noValidateonSubmit={humanForm.handleSubmit(handleHumanSubmit)}><FormMarkdownItemdiff --git a/frontend/src/pages/settings/settings-provider.tsx b/frontend/src/pages/settings/settings-provider.tsxindex d7e61ffc..824f4e9c 100644--- a/frontend/src/pages/settings/settings-provider.tsx+++ b/frontend/src/pages/settings/settings-provider.tsx@@ -1873,6 +1873,7 @@ function SettingsProvider() {<formclassName="flex min-h-0 flex-1 flex-col"id="provider-form"+ noValidateonSubmit={handleFormSubmit(handleSubmit)}>{isDesktop ? (diff --git a/frontend/src/pages/templates/template.tsx b/frontend/src/pages/templates/template.tsxindex b31126a3..af8f932b 100644--- a/frontend/src/pages/templates/template.tsx+++ b/frontend/src/pages/templates/template.tsx@@ -725,6 +725,7 @@ function Template() {<formclassName="flex min-h-0 flex-1 flex-col"id="template-form"+ noValidateonSubmit={handleFormSubmit(handleSubmit)}>{isDesktop ? (