feat: rate limit auth endpoints and scope user proxy host permissions

- Add in-memory sliding window rate limiter for auth token endpoints with CI/test bypass and successful request exclusion
- Add user_permission meta column migration and Objection model configuration
- Support scoping allowed proxy hosts per user when in 'Created Items Only' visibility mode
- Restrict advanced nginx configuration editing on hosts to admin users only
- Fix user permissions route ID parsing and omit id from permission update payloads
- Add allowed proxy hosts selector in permissions modal and display permissions summary badges in users table
This commit is contained in:
Abdulhafiz Davlatov committed 2026-11-05 12:16:36 +05:00
1 parent cc46ce5ab6
commit bc8bbf3562
23 files changed
+571 -104

No files matched your search

@@ -30,8 +30,9 @@ interface Row {
interface Props {
initialValues: ProxyLocation[];
name?: string;
allowAdvanced?: boolean;
}
export function LocationsFields({ initialValues, name = "locations" }: Props) {
export function LocationsFields({ initialValues, name = "locations", allowAdvanced = true }: Props) {
const [rows, setRows] = useState<Row[]>(() => (initialValues || []).map((value, id) => ({ id, value })));
const { setFieldValue } = useFormikContext();
const [expanded, setExpanded] = useState<number[]>([]);
@@ -217,7 +218,7 @@ export function LocationsFields({ initialValues, name = "locations" }: Props) {
{isOpen && (
<div className="card-body" id={bodyId}>
<div className="row">
<div className="col-md-10">
<div className={allowAdvanced ? "col-md-10" : "col-md-12"}>
<div className="input-group mb-3">
<span className="input-group-text">Location</span>
<input
@@ -230,23 +231,25 @@ export function LocationsFields({ initialValues, name = "locations" }: Props) {
/>
</div>
</div>
<div className="col-md-2 text-end">
<button
type="button"
className="btn p-0"
title="Advanced"
aria-expanded={advVisible.includes(row.id)}
onClick={() => toggleAdvVisible(row.id)}
>
<IconSettings size={20} />
</button>
</div>
{allowAdvanced && (
<div className="col-md-2 text-end">
<button
type="button"
className="btn p-0"
title="Advanced"
aria-expanded={advVisible.includes(row.id)}
onClick={() => toggleAdvVisible(row.id)}
>
<IconSettings size={20} />
</button>
</div>
)}
</div>
<div className="row">
<div className="col-md-3">
<div className="col-sm-3 col-md-3">
<div className="mb-3">
<label
className="form-label"
className="form-label text-nowrap"
htmlFor={`location-forwardScheme-${row.id}`}
>
<T id="host.forward-scheme" />
@@ -264,10 +267,10 @@ export function LocationsFields({ initialValues, name = "locations" }: Props) {
</select>
</div>
</div>
<div className="col-md-6">
<div className="col-sm-5 col-md-5">
<div className="mb-3">
<label
className="form-label"
className="form-label text-nowrap"
htmlFor={`location-forwardHost-${row.id}`}
>
<T id="proxy-host.forward-host" />
@@ -285,10 +288,10 @@ export function LocationsFields({ initialValues, name = "locations" }: Props) {
/>
</div>
</div>
<div className="col-md-3">
<div className="col-sm-4 col-md-4">
<div className="mb-3">
<label
className="form-label"
className="form-label text-nowrap"
htmlFor={`location-forwardPort-${row.id}`}
>
<T id="host.forward-port" />
@@ -316,7 +319,7 @@ export function LocationsFields({ initialValues, name = "locations" }: Props) {
onFormChange={(value) => handleAccessListChange(row.id, value)}
inheritHost
/>
{advVisible.includes(row.id) && (
{allowAdvanced && advVisible.includes(row.id) && (
<div className="">
<CodeEditor
language="nginx"