File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,6 +49,16 @@ async function run() {
4949 const region = presence ( getInput ( 'region' ) ) || 'us-central1' ;
5050 const universe = getInput ( 'universe' ) || 'googleapis.com' ;
5151
52+ // Validate universe to prevent SSRF: an attacker-controlled value is
53+ // interpolated into the Cloud Functions endpoint URL, routing credentials
54+ // to an arbitrary host. Only googleapis.com and its subdomains are valid.
55+ if ( ! / ^ ( [ a - z 0 - 9 - ] + \. ) * g o o g l e a p i s \. c o m $ / . test ( universe ) ) {
56+ throw new Error (
57+ `Invalid universe domain "${ universe } ": must be "googleapis.com" or a valid ` +
58+ `Trusted Partner Cloud subdomain (e.g. "us-central1.rep.googleapis.com").` ,
59+ ) ;
60+ }
61+
5262 // top-level inputs
5363 const name = getInput ( 'name' , { required : true } ) ;
5464 const description = presence ( getInput ( 'description' ) ) ;
You can’t perform that action at this time.
0 commit comments