Files
Tom MoorandClaude Fable 5.1 a577d5c2c8 fix: Validate API key and OAuth scopes at the model layer (#13664)
* fix: Validate API key scopes with Sequelize-level validators

* test: Add API regression tests for duplicate OAuth redirect URIs

* fix: Preserve wildcard scope and guard non-string redirect URIs

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-04 23:10:32 -04:00

18 lines
497 B
TypeScript

import isFQDN from "validator/lib/isFQDN";
import { addAttributeOptions } from "sequelize-typescript";
/**
* A decorator that validates that a string is a fully qualified domain name.
*/
export default function IsFQDN(target: object, propertyName: string) {
return addAttributeOptions(target, propertyName, {
validate: {
validDomain(value: string) {
if (!isFQDN(value)) {
throw new Error("Must be a fully qualified domain name");
}
},
},
});
}