mirror of
https://github.com/outline/outline.git
synced 2026-11-20 21:23:06 +03:00
* 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>
18 lines
497 B
TypeScript
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");
|
|
}
|
|
},
|
|
},
|
|
});
|
|
}
|