web/website/node/jarvis-web-key-boundary.mjs

6 lines
534 B
JavaScript

// This is a fixed boundary, not a permission node. Owners cannot override it.
const reserved=/^(?:dev(?:eloper)?(?:[-_.:]|$)|root(?:[-_.:]|$)|sudo(?:[-_.:]|$))/i;
export function assertWebIssuableMaster(action){
if(!action||typeof action.id!=='string'||typeof action.keyType!=='string'||reserved.test(action.id)||reserved.test(action.keyType)||action.devOnly===true||action.family==='developer'||action.family==='dev'||action.serverOnly===true)throw Error('Devkeys cannot be generated or updated by the website');
return action;
}