@vercel/cli-support 66.2.0 → 66.3.0-snapshot-3206bcf0afd3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{alerts-NLLCERTK.js → alerts-MDU5KBQL.js} +1 -1
- package/dist/chunks/{chunk-6U7TRWBO.js → chunk-HVFGIJ44.js} +2 -2
- package/dist/chunks/chunk-KMTHGHJV.js +8 -0
- package/dist/chunks/{chunk-56QPAEAW.js → chunk-LXZ45FUT.js} +1 -1
- package/dist/chunks/{chunk-YALFS5SH.js → chunk-PX55WGPZ.js} +1 -1
- package/dist/chunks/{chunk-EIBQNIN7.js → chunk-TIOZWOR5.js} +1 -1
- package/dist/chunks/chunk-TUB3APDV.js +7 -0
- package/dist/chunks/chunk-VKVH7LHB.js +7 -0
- package/dist/chunks/{chunk-WHL4PWDW.js → chunk-XLYO5QNG.js} +1 -1
- package/dist/chunks/{chunk-YON6DNQB.js → chunk-ZGATYK5C.js} +1 -1
- package/dist/chunks/cli-embedded-FD3CAPRY.js +84 -0
- package/dist/chunks/{config-BYHUSTMY.js → config-ARJS37DC.js} +1 -1
- package/dist/chunks/{engine-I887QHnP-RUEEKCKH.js → engine-D8YAsQS_-WNPHYRQF.js} +2 -2
- package/dist/chunks/{image-H4HIURNR.js → image-PJBSA7SU.js} +1 -1
- package/dist/chunks/serving-aOQsBok0-OL36TMZU.js +8 -0
- package/dist/commands/deploy/index.js +1 -1
- package/dist/commands/env/index.js +1 -1
- package/dist/commands/link/index.js +1 -1
- package/dist/commands/project/index.js +1 -1
- package/dist/commands-account.js +2 -2
- package/dist/commands-ai.js +1 -1
- package/dist/commands-blob.js +1 -1
- package/dist/commands-core.js +15 -11
- package/dist/commands-deployments.js +1 -1
- package/dist/commands-flags.js +1 -1
- package/dist/commands-integrations.js +1 -1
- package/dist/commands-observability.js +2 -2
- package/dist/commands-routing.js +15 -3
- package/dist/index.js +1 -1
- package/dist/package.json +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +12 -12
- package/dist/chunks/chunk-MGZ3Z4PF.js +0 -8
- package/dist/chunks/chunk-PQSW6EAL.js +0 -7
- package/dist/chunks/chunk-UFCL2VBD.js +0 -7
- package/dist/chunks/cli-embedded-KDIRH75G.js +0 -81
- package/dist/chunks/serving-Bulte-NO-VPBE6F4V.js +0 -8
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
-
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
-
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
-
const require = __createRequire(import.meta.url);
|
|
5
|
-
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
-
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{TOKENS,VERCEL_ISSUER,createRemoteJWKSet,decodeJwt,issuerName,jwtVerify,markVerified,privateHost,trustedIssuers}from"./chunk-PQSW6EAL.js";import{unauthorized}from"./chunk-MGZ3Z4PF.js";import"./chunk-2AMO2VMV.js";import"./chunk-BZENIQ7N.js";var fromDisk;function readLinkedProject(){return fromDisk??=(async()=>{try{let{readFile}=await import("node:fs/promises"),{join}=await import("node:path"),raw=await readFile(join(process.cwd(),".vercel","project.json"),"utf8"),{projectId,orgId}=JSON.parse(raw);return{projectId:projectId??null,teamId:orgId??null}}catch{return{projectId:null,teamId:null}}})(),fromDisk}async function ownProjectId(){return process.env.VERCEL_PROJECT_ID?process.env.VERCEL_PROJECT_ID:(await readLinkedProject()).projectId}async function ownTeamId(){return process.env.VERCEL_ORG_ID?process.env.VERCEL_ORG_ID:(await readLinkedProject()).teamId}async function discoveryIdentity(headers){let projectId=await ownProjectId(),header=headers?.get("x-vercel-oidc-token");if(header)try{let claims=decodeJwt(header);if(typeof claims.owner_id=="string")return{projectId,teamId:claims.owner_id}}catch{}return process.env.VERCEL_ORG_ID?{projectId,teamId:process.env.VERCEL_ORG_ID}:{projectId,teamId:(await readLinkedProject()).teamId}}var REGISTERED=new Set(["aud","exp","iat","nbf","jti"]);function factsOf(issuer,iss,claims){let kept={};for(let[name,value]of Object.entries(claims))REGISTERED.has(name)||Object.keys(kept).length>=64||(typeof value=="number"||typeof value=="boolean"||typeof value=="string"&&value.length<=1e3)&&(kept[name]=value);return{issuer,iss,claims:kept}}var issuerMatches=(iss,accepted)=>typeof accepted=="string"?iss===accepted:accepted.test(iss),remoteKeys=new Map,loading=new Map,REMOTE_KEYS_MAX=100,DISCOVERY_TIMEOUT_MS=5e3;function keysFor(iss){let cached=remoteKeys.get(iss);if(cached)return remoteKeys.delete(iss),remoteKeys.set(iss,cached),Promise.resolve(cached);let pending=loading.get(iss);return pending||(pending=discover(iss).finally(()=>loading.delete(iss)),loading.set(iss,pending)),pending}async function discover(iss){let unknown=why=>unauthorized(`cannot load keys for issuer ${iss}: ${why}`),response=await fetch(`${iss.replace(/\/+$/,"")}/.well-known/openid-configuration`,{redirect:"manual",signal:AbortSignal.timeout(DISCOVERY_TIMEOUT_MS)}).catch(()=>{throw unknown("its discovery did not answer")});if(response.status!==200)throw unknown(`its discovery answered ${response.status}`);let config=await response.json().catch(()=>null);if(config?.issuer!==iss)throw unknown("its discovery names another issuer");let jwks=typeof config.jwks_uri=="string"?URL.parse(config.jwks_uri):null;if(jwks?.protocol!=="https:"||privateHost(jwks.hostname))throw unknown("its jwks_uri isn't an https URL on the internet");let keys=createRemoteJWKSet(jwks,{timeoutDuration:DISCOVERY_TIMEOUT_MS});return remoteKeys.size>=REMOTE_KEYS_MAX&&remoteKeys.delete(remoteKeys.keys().next().value),remoteKeys.set(iss,keys),keys}function createVerifier(options){let vercelIssuer=options.auth?.vercel??{issuer:VERCEL_ISSUER},githubIssuer=options.auth?.github??{issuer:"https://token.actions.githubusercontent.com"},oidcIssuers=trustedIssuers(options.issuers);async function verify(token,audience){let iss;try{iss=String(decodeJwt(token).iss??"")}catch{throw unauthorized("malformed token")}let local=options.auth?.local;if(local&&iss===local.issuer)return localPerson(token,local,audience);let isVercel=issuerMatches(iss,vercelIssuer.issuer),isGitHub=!isVercel&&issuerMatches(iss,githubIssuer.issuer),isOidc=!isVercel&&!isGitHub&&oidcIssuers.has(iss);if(!isVercel&&!isGitHub&&!isOidc)throw unauthorized(`untrusted issuer: ${iss||"(none)"}`);let claims;try{let keys=isOidc?options.auth?.oidc?.[iss]??await keysFor(iss):(isVercel?vercelIssuer:githubIssuer).jwks??await keysFor(iss);({payload:claims}=await jwtVerify(token,keys,{issuer:iss,audience}))}catch(error){throw error.status===401?error:unauthorized(`invalid token: ${error.message}`)}let facts=factsOf(isOidc?"oidc":isGitHub?"github":"vercel",iss,claims),expiresAt=claims.exp?new Date(claims.exp*1e3):null;if(isOidc){if(typeof claims.sub!="string"||claims.sub==="")throw unauthorized(`token from ${iss} without sub`);return{id:`oidc:${issuerName(iss)}:${claims.sub}`,kind:"workflow",handle:claims.sub.slice(0,128),expiresAt,facts}}if(isGitHub)return{id:`github:repo:${String(claims.repository_id)}`,kind:"workflow",handle:String(claims.repository),expiresAt,facts};let environment=String(claims.environment??""),project=String(claims.project??""),ownProject=await options.projectId()??null;if(ownProject!==null&&claims.project_id===ownProject&&environment==="development"){if(typeof claims.user_id!="string")throw unauthorized("development token without user_id");return{id:`vercel:user:${claims.user_id}`,kind:"person",handle:claims.user_id,expiresAt}}return deployment(facts,project,environment,expiresAt)}return{verify}}var LOCAL_SUB=/^[a-z0-9](?:[a-z0-9._-]{0,62}[a-z0-9])?$/;async function localPerson(token,local,audience){let claims;try{({payload:claims}=await jwtVerify(token,local.jwks,{issuer:local.issuer,audience}))}catch(error){throw unauthorized(`invalid token: ${error.message}`)}let sub=String(claims.sub??"");if(!LOCAL_SUB.test(sub))throw unauthorized("local token without a valid sub");return{id:`local:user:${sub}`,kind:"person",handle:sub,expiresAt:claims.exp?new Date(claims.exp*1e3):null}}var deployment=(facts,project,environment,expiresAt)=>({id:`vercel:project:${String(facts.claims.project_id)}:${environment}`,kind:"deployment",handle:project,expiresAt,facts}),environmentBoard={project:async()=>({id:await ownProjectId(),teamId:await ownTeamId()}),issuers:[]};function oidcTokens(options={}){let made=null;return Object.assign(async request=>{if(request.credential===null)return null;let board=request.board??environmentBoard,issuers=board.issuers.join(`
|
|
8
|
-
`);return(made?.board!==board||made.issuers!==issuers)&&(made={board,issuers,verify:createVerifier({projectId:async()=>(await board.project()).id,issuers:board.issuers,auth:options}).verify}),markVerified(await made.verify(request.credential,request.audience))},{[TOKENS]:!0})}export{discoveryIdentity,oidcTokens,ownProjectId,ownTeamId};
|