cdk-local 0.164.0 → 0.164.1
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/{assembly-path-R96uhMm1.js → assembly-path-4qK96UfP.js} +2 -2
- package/dist/{assembly-path-R96uhMm1.js.map → assembly-path-4qK96UfP.js.map} +1 -1
- package/dist/{cdkl-io-host-DFQf5KWv.js → cdkl-io-host-b34gsrHs.js} +2 -2
- package/dist/{cdkl-io-host-DFQf5KWv.js.map → cdkl-io-host-b34gsrHs.js.map} +1 -1
- package/dist/cli.js +2 -2
- package/dist/{docker-cmd-Cjg3jGYF.js → docker-cmd-C_Hfs3eo.js} +3 -3
- package/dist/{docker-cmd-Cjg3jGYF.js.map → docker-cmd-C_Hfs3eo.js.map} +1 -1
- package/dist/{docker-runner-D6K15jJP.js → docker-runner-C0Igd4LD.js} +8 -7
- package/dist/{docker-runner-D6K15jJP.js.map → docker-runner-C0Igd4LD.js.map} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/internal.d.ts +5 -3
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +5 -5
- package/dist/{local-studio-nWE5yJK1.d.ts → local-studio-B6fnvxp2.d.ts} +12 -2
- package/dist/local-studio-B6fnvxp2.d.ts.map +1 -0
- package/dist/{local-studio-C78UofCN.js → local-studio-Bo1NL6UK.js} +19 -19
- package/dist/{local-studio-C78UofCN.js.map → local-studio-Bo1NL6UK.js.map} +1 -1
- package/dist/{logger-Co5XVwco.js → logger-25be7ULc.js} +4 -2
- package/dist/logger-25be7ULc.js.map +1 -0
- package/dist/{workload-identity-CCXbr0KK.js → workload-identity-BQBoBgdT.js} +238 -50
- package/dist/{workload-identity-CCXbr0KK.js.map → workload-identity-BQBoBgdT.js.map} +1 -1
- package/package.json +1 -1
- package/dist/local-studio-nWE5yJK1.d.ts.map +0 -1
- package/dist/logger-Co5XVwco.js.map +0 -1
|
@@ -10,7 +10,8 @@ const DEFAULTS = {
|
|
|
10
10
|
envPrefix: "CDKL",
|
|
11
11
|
sigV4StrictByDefault: false,
|
|
12
12
|
sigV4OptFlag: "--strict-sigv4",
|
|
13
|
-
workloadIdentity: "role"
|
|
13
|
+
workloadIdentity: "role",
|
|
14
|
+
awsEmulatorSqsSidecar: true
|
|
14
15
|
};
|
|
15
16
|
let current = DEFAULTS;
|
|
16
17
|
function setEmbedConfig(config) {
|
|
@@ -24,6 +25,7 @@ function setEmbedConfig(config) {
|
|
|
24
25
|
sigV4StrictByDefault: config?.sigV4StrictByDefault ?? DEFAULTS.sigV4StrictByDefault,
|
|
25
26
|
sigV4OptFlag: config?.sigV4OptFlag ?? DEFAULTS.sigV4OptFlag,
|
|
26
27
|
workloadIdentity: config?.workloadIdentity === "caller" ? "caller" : "role",
|
|
28
|
+
awsEmulatorSqsSidecar: config === void 0 ? DEFAULTS.awsEmulatorSqsSidecar : config.awsEmulatorSqsSidecar === true,
|
|
27
29
|
...config?.logger !== void 0 && { logger: config.logger }
|
|
28
30
|
};
|
|
29
31
|
}
|
|
@@ -259,4 +261,4 @@ function getLogger() {
|
|
|
259
261
|
|
|
260
262
|
//#endregion
|
|
261
263
|
export { displayIdent as a, getEmbedConfig as c, STACK_REF_MAX_CODE_POINTS as i, resetEmbedConfig as l, renderLogText as n, displayStackName as o, resolveConfiguredLogLevel as r, displayToolOutput as s, getLogger as t, setEmbedConfig as u };
|
|
262
|
-
//# sourceMappingURL=logger-
|
|
264
|
+
//# sourceMappingURL=logger-25be7ULc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger-25be7ULc.js","names":[],"sources":["../src/local/embed-config.ts","../src/utils/ident-display.ts","../src/utils/logger.ts"],"mappings":";;;AAsKA,MAAM,WAAgC;CACpC,SAAS;CACT,YAAY;CACZ,aAAa;CACb,oBAAoB;CACpB,kBAAkB;CAClB,WAAW;CACX,sBAAsB;CACtB,cAAc;CACd,kBAAkB;CAClB,uBAAuB;AACzB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AAK,UAAU;EACf,MAAM,MAAM,KAAK,SAAS,MAAM,UAAU,IAAI,KAAK,OAAO,IAAI,YAAY;EAC1E,MAAM,KAAK,KAAK,GAAG,IAAI;CACzB;CAEA,AAAS,KAAK,SAAiB,GAAG,MAAuB;EACvD,KAAK,UAAU;EACf,MAAM,MAAM,KAAK,SAAS,MAAM,UAAU,IAAI,KAAK,OAAO,IAAI,YAAY;EAC1E,MAAM,KAAK,KAAK,GAAG,IAAI;CACzB;CAEA,AAAS,MAAM,SAAiB,GAAG,MAAuB;EACxD,KAAK,UAAU;EACf,MAAM,MAAM,KAAK,SAAS,MAAM,UAAU,IAAI,KAAK,OAAO,IAAI,YAAY;EAC1E,MAAM,MAAM,KAAK,GAAG,IAAI;CAC1B;AACF;AAaA,SAAgB,4BAAsC;CACpD,MAAM,MAAM,QAAQ,IAAI;CACxB,IAAI,QAAQ,WAAW,QAAQ,UAAU,QAAQ,UAAU,QAAQ,SACjE,OAAO;CAET,OAAO;AACT;AAEA,IAAI,eAAqC;AAEzC,SAAgB,YAA2B;CACzC,IAAI,CAAC,cACH,eAAe,IAAI,cAAc,0BAA0B,CAAC;CAE9D,OAAO;AACT"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-w6R9maHv.js";
|
|
2
|
-
import { c as getEmbedConfig, t as getLogger } from "./logger-
|
|
3
|
-
import { r as displayUntrustedValue, u as describeCredentialLoadFailure } from "./assembly-path-
|
|
2
|
+
import { c as getEmbedConfig, t as getLogger } from "./logger-25be7ULc.js";
|
|
3
|
+
import { r as displayUntrustedValue, u as describeCredentialLoadFailure } from "./assembly-path-4qK96UfP.js";
|
|
4
4
|
import { existsSync, lstatSync, mkdtempSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { createHash, generateKeyPairSync, randomBytes, sign } from "node:crypto";
|
|
6
6
|
import { Agent, get, request } from "node:http";
|
|
@@ -1583,6 +1583,25 @@ function createMixedModeTlsMaterials(now = /* @__PURE__ */ new Date(), leafDnsNa
|
|
|
1583
1583
|
}).toString()
|
|
1584
1584
|
};
|
|
1585
1585
|
}
|
|
1586
|
+
const OID_PKCS7_DATA = "1.2.840.113549.1.7.1";
|
|
1587
|
+
const OID_CERT_BAG = "1.2.840.113549.1.12.10.1.3";
|
|
1588
|
+
const OID_X509_CERTIFICATE = "1.2.840.113549.1.9.22.1";
|
|
1589
|
+
const OID_FRIENDLY_NAME = "1.2.840.113549.1.9.20";
|
|
1590
|
+
const OID_JDK_TRUSTED_KEY_USAGE = "2.16.840.1.113894.746875.1.1";
|
|
1591
|
+
const OID_ANY_EXTENDED_KEY_USAGE = "2.5.29.37.0";
|
|
1592
|
+
function buildJavaTrustStore(pems, aliasPrefix = "cdk-local") {
|
|
1593
|
+
const bags = [];
|
|
1594
|
+
for (const pem of pems) for (const block of pem.match(/-----BEGIN CERTIFICATE-----[\s\S]*?-----END CERTIFICATE-----/g) ?? []) {
|
|
1595
|
+
const body = block.replace(/-----(BEGIN|END) CERTIFICATE-----/g, "").replace(/\s+/g, "");
|
|
1596
|
+
const certDer = Buffer.from(body, "base64");
|
|
1597
|
+
const alias = `${aliasPrefix}-${bags.length}`;
|
|
1598
|
+
const bmp = Buffer.from(alias, "utf16le").swap16();
|
|
1599
|
+
bags.push(seq(oid(OID_CERT_BAG), explicit(0, seq(oid(OID_X509_CERTIFICATE), explicit(0, octets(certDer)))), set(seq(oid(OID_JDK_TRUSTED_KEY_USAGE), set(oid(OID_ANY_EXTENDED_KEY_USAGE))), seq(oid(OID_FRIENDLY_NAME), set(der(30, bmp))))));
|
|
1600
|
+
}
|
|
1601
|
+
const safeContents = seq(...bags);
|
|
1602
|
+
const authSafe = seq(seq(oid(OID_PKCS7_DATA), explicit(0, octets(safeContents))));
|
|
1603
|
+
return seq(integer(Buffer.from([3])), seq(oid(OID_PKCS7_DATA), explicit(0, octets(authSafe))));
|
|
1604
|
+
}
|
|
1586
1605
|
|
|
1587
1606
|
//#endregion
|
|
1588
1607
|
//#region src/local/emulator-resign-sidecar.ts
|
|
@@ -1741,17 +1760,100 @@ function errorBody(err,service){
|
|
|
1741
1760
|
if(service==='s3'||service===undefined)return {type:'application/xml',text:'<?xml version="1.0" encoding="UTF-8"?><Error><Code>'+err.code+'</Code><Message>'+err.message.replace(/&/g,'&').replace(/</g,'<')+'</Message></Error>'};
|
|
1742
1761
|
return {type:'application/x-amz-json-1.0',text:JSON.stringify({__type:err.code,message:err.message})};
|
|
1743
1762
|
}
|
|
1763
|
+
var PASS_DROP_HEADERS=new Set(['connection','keep-alive','proxy-authorization','proxy-connection','te','trailer','transfer-encoding','upgrade','expect']);
|
|
1764
|
+
function passthroughHeaders(incoming){
|
|
1765
|
+
var out=Object.create(null);
|
|
1766
|
+
Object.keys(incoming).forEach(function(k){var lk=k.toLowerCase();if(PASS_DROP_HEADERS.has(lk))return;var v=incoming[k];if(v===undefined)return;out[lk]=v;});
|
|
1767
|
+
return out;
|
|
1768
|
+
}
|
|
1769
|
+
// Only a real SQS queue URL is rewritten: an AWS SQS host (either form, any
|
|
1770
|
+
// partition suffix), no port, user info, query or fragment, and a path of a
|
|
1771
|
+
// 12-digit account and a queue name.
|
|
1772
|
+
var SQS_QUEUE_URL=/^https?:\/\/(?:sqs\.[a-z0-9-]+|[a-z0-9-]+\.queue)\.amazonaws\.com(?:\.cn)?\/([0-9]{12}\/[A-Za-z0-9_-]{1,80}(?:\.fifo)?)$/;
|
|
1773
|
+
function localQueueUrl(u,origin){var m=SQS_QUEUE_URL.exec(String(u));return m?origin+'/'+m[1]:u;}
|
|
1774
|
+
var SQS_QUEUE_URL_OPERATIONS=new Set(['CreateQueue','GetQueueUrl','ListQueues','ListDeadLetterSourceQueues']);
|
|
1775
|
+
// An unsigned request (an emulator run with --auth off and an SDK that signs
|
|
1776
|
+
// nothing) has no scope: only the JSON protocol's target names SQS then.
|
|
1777
|
+
function isSqsRequest(headers,service){return service==='sqs'||String(headers['x-amz-target']||'').indexOf('AmazonSQS.')===0;}
|
|
1778
|
+
// JSON protocol: the target names the operation. Query protocol: unknown here,
|
|
1779
|
+
// so every response is a candidate.
|
|
1780
|
+
function sqsResponseMayCarryQueueUrl(headers){
|
|
1781
|
+
var t=String(headers['x-amz-target']||'');
|
|
1782
|
+
if(t==='')return true;
|
|
1783
|
+
return t.indexOf('AmazonSQS.')===0&&SQS_QUEUE_URL_OPERATIONS.has(t.slice('AmazonSQS.'.length));
|
|
1784
|
+
}
|
|
1785
|
+
function rewriteSqsQueueUrls(text,contentType,origin){
|
|
1786
|
+
var ct=String(contentType||'').toLowerCase(),changed=false;
|
|
1787
|
+
function one(u){if(typeof u!=='string')return u;var n=localQueueUrl(u,origin);if(n!==u)changed=true;return n;}
|
|
1788
|
+
if(ct.indexOf('json')>=0){
|
|
1789
|
+
var o;
|
|
1790
|
+
try{o=JSON.parse(text);}catch(e){return undefined;}
|
|
1791
|
+
if(!o||typeof o!=='object'||Array.isArray(o))return undefined;
|
|
1792
|
+
if(typeof o.QueueUrl==='string')o.QueueUrl=one(o.QueueUrl);
|
|
1793
|
+
['QueueUrls','queueUrls'].forEach(function(k){if(Array.isArray(o[k]))o[k]=o[k].map(one);});
|
|
1794
|
+
return changed?JSON.stringify(o):undefined;
|
|
1795
|
+
}
|
|
1796
|
+
if(ct.indexOf('xml')>=0){
|
|
1797
|
+
// A message body inside XML is escaped, so a literal element is never user data.
|
|
1798
|
+
var out=String(text).replace(/<QueueUrl>([^<]*)<\/QueueUrl>/g,function(all,u){var n=one(u.trim());return n===u.trim()?all:'<QueueUrl>'+n+'</QueueUrl>';});
|
|
1799
|
+
return changed?out:undefined;
|
|
1800
|
+
}
|
|
1801
|
+
return undefined;
|
|
1802
|
+
}
|
|
1744
1803
|
`;
|
|
1745
1804
|
const RESIGN_SIDECAR_SERVER = String.raw`
|
|
1746
1805
|
function startResigner(cfgPath){return new Promise(function(done){
|
|
1747
|
-
var fs=require('fs'),https=require('https'),http=require('http'),tls=require('tls');
|
|
1806
|
+
var fs=require('fs'),https=require('https'),http=require('http'),tls=require('tls'),net=require('net'),zlib=require('zlib');
|
|
1748
1807
|
var cfg;
|
|
1749
1808
|
try{cfg=JSON.parse(fs.readFileSync(cfgPath,'utf8'));}catch(e){done({error:'CONFIG_'+(e.code||'ERROR')});return;}
|
|
1809
|
+
var passthrough=cfg.passthrough===true;
|
|
1810
|
+
if(!passthrough&&!cfg.credentials){done({error:'CONFIG_ERROR'});return;}
|
|
1811
|
+
var label=passthrough?'cdk-local --aws-emulator':'cdk-local mixed mode';
|
|
1750
1812
|
var up=new URL(cfg.upstream),secure=up.protocol==='https:',mod=secure?https:http;
|
|
1813
|
+
var upHost=up.hostname.replace(/^\[|\]$/g,'');
|
|
1751
1814
|
cfg.upstreamHost=up.host;
|
|
1752
1815
|
var agentOpts={keepAlive:true};
|
|
1753
1816
|
if(secure&&cfg.upstreamCaPem)agentOpts.ca=tls.rootCertificates.concat([cfg.upstreamCaPem]);
|
|
1754
1817
|
var agent=new mod.Agent(agentOpts);
|
|
1818
|
+
// What a rewritten queue URL points at: this sidecar, the endpoint the workload already uses.
|
|
1819
|
+
var origin='https://127.0.0.1:'+cfg.port;
|
|
1820
|
+
var REWRITE_CAP=16*1048576;
|
|
1821
|
+
// Response bytes held at once across concurrent requests; past it a
|
|
1822
|
+
// response streams through unrewritten.
|
|
1823
|
+
var heldResp=0,HELD_RESP_CAP=4*REWRITE_CAP;
|
|
1824
|
+
var DECODERS={identity:null,gzip:zlib.gunzipSync,'x-gzip':zlib.gunzipSync,deflate:zlib.inflateSync,br:zlib.brotliDecompressSync};
|
|
1825
|
+
// Relay an emulator response. An SQS response that may carry a queue URL is
|
|
1826
|
+
// held (up to a cap) and its queue URLs point back here; anything else, and
|
|
1827
|
+
// a response that needs no change, goes through byte for byte.
|
|
1828
|
+
function relay(ur,resp,rewrite){
|
|
1829
|
+
var h={};
|
|
1830
|
+
Object.keys(ur.headers).forEach(function(k){if(k==='connection'||k==='keep-alive'||k==='transfer-encoding')return;h[k]=ur.headers[k];});
|
|
1831
|
+
var status=ur.statusCode||502,enc=String(ur.headers['content-encoding']||'identity').trim().toLowerCase();
|
|
1832
|
+
ur.on('error',function(){resp.destroy();});
|
|
1833
|
+
if(!rewrite||status<200||status>=300||!Object.prototype.hasOwnProperty.call(DECODERS,enc)||Number(ur.headers['content-length'])>REWRITE_CAP){resp.writeHead(status,h);ur.pipe(resp);return;}
|
|
1834
|
+
var chunks=[],n=0,released=false;
|
|
1835
|
+
function release(){if(!released){released=true;heldResp-=n;}}
|
|
1836
|
+
function onData(c){
|
|
1837
|
+
n+=c.length;heldResp+=c.length;chunks.push(c);
|
|
1838
|
+
if(n<=REWRITE_CAP&&heldResp<=HELD_RESP_CAP)return;
|
|
1839
|
+
ur.removeListener('data',onData);ur.removeListener('end',onEnd);release();
|
|
1840
|
+
resp.writeHead(status,h);chunks.forEach(function(x){resp.write(x);});chunks=[];
|
|
1841
|
+
ur.pipe(resp);
|
|
1842
|
+
}
|
|
1843
|
+
function onEnd(){
|
|
1844
|
+
release();
|
|
1845
|
+
var raw=Buffer.concat(chunks),text,out;chunks=[];
|
|
1846
|
+
try{var dec=DECODERS[enc];text=(dec?dec(raw,{maxOutputLength:4*REWRITE_CAP}):raw).toString('utf8');}catch(e){text=undefined;}
|
|
1847
|
+
if(text!==undefined)out=rewriteSqsQueueUrls(text,ur.headers['content-type'],origin);
|
|
1848
|
+
if(out===undefined){h['content-length']=String(raw.length);resp.writeHead(status,h);resp.end(raw);return;}
|
|
1849
|
+
var b=Buffer.from(out,'utf8');
|
|
1850
|
+
delete h['content-encoding'];delete h['content-md5'];delete h['x-amz-crc32'];
|
|
1851
|
+
h['content-length']=String(b.length);
|
|
1852
|
+
resp.writeHead(status,h);resp.end(b);
|
|
1853
|
+
}
|
|
1854
|
+
ur.on('data',onData);ur.on('end',onEnd);ur.on('close',release);
|
|
1855
|
+
}
|
|
1856
|
+
function rewritesResponse(req,service){return isSqsRequest(req.headers,service)&&sqsResponseMayCarryQueueUrl(req.headers);}
|
|
1755
1857
|
function send(resp,status,err,service){
|
|
1756
1858
|
if(resp.headersSent){resp.destroy();return;}
|
|
1757
1859
|
var b=errorBody(err,service);
|
|
@@ -1778,37 +1880,58 @@ function startResigner(cfgPath){return new Promise(function(done){
|
|
|
1778
1880
|
req.on('error',function(){drop();resp.destroy();});
|
|
1779
1881
|
resp.on('close',drop);
|
|
1780
1882
|
req.on('end',function(){
|
|
1781
|
-
if(busy){send(resp,503,{code:'SlowDown',message:'
|
|
1883
|
+
if(busy){send(resp,503,{code:'SlowDown',message:label+': the AWS Emulator re-signing sidecar is holding too many request bodies at once; retry.'},serviceOf(req));return;}
|
|
1782
1884
|
if(over){process.stdout.write('CDKL-RESIGN rejected a streamed request body over the cap without holding it\n');send(resp,413,tooLargeError(seen,cfg.capBytes,serviceOf(req)),serviceOf(req));return;}
|
|
1783
1885
|
var p;
|
|
1784
1886
|
var joined=Buffer.concat(chunks);chunks=[];
|
|
1785
|
-
try{p=prepareResign(req,joined,cfg,new Date());}catch(e){p={error:{status:400,code:'InvalidRequest',message:'
|
|
1887
|
+
try{p=prepareResign(req,joined,cfg,new Date());}catch(e){p={error:{status:400,code:'InvalidRequest',message:label+': the request could not be re-signed.'}};}
|
|
1786
1888
|
joined=null;
|
|
1787
1889
|
if(p.error){if(p.error.status===413)process.stdout.write('CDKL-RESIGN rejected a request body over the cap\n');send(resp,p.error.status,p.error,serviceOf(req));return;}
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
ur.on('error',function(){resp.destroy();});
|
|
1795
|
-
});}catch(e){send(resp,400,{code:'InvalidRequest',message:'cdk-local mixed mode: the request has a header the AWS Emulator re-signing sidecar cannot forward.'},p.service);return;}
|
|
1796
|
-
// A client that hangs up (an aborted GetObject) frees the upstream socket too.
|
|
1797
|
-
resp.on('close',function(){if(!resp.writableFinished)r.destroy();});
|
|
1798
|
-
r.setTimeout(300000,function(){r.destroy(Object.assign(new Error('upstream timeout'),{code:'ETIMEDOUT'}));});
|
|
1799
|
-
r.on('error',function(e){process.stdout.write('CDKL-RESIGN upstream error '+(e.code||'ERROR')+'\n');send(resp,502,{code:'BadGateway',message:'cdk-local mixed mode: the AWS Emulator at '+cfg.upstream+' did not answer ('+(e.code||'ERROR')+').'},p.service);});
|
|
1800
|
-
r.end(p.body);
|
|
1890
|
+
// Re-signed anyway (accept-encoding is not a signed header): ask for an
|
|
1891
|
+
// identity body, so an encoding the sidecar cannot decode never carries
|
|
1892
|
+
// a real queue URL past it.
|
|
1893
|
+
if(rewritesResponse(req,p.service))delete p.headers['accept-encoding'];
|
|
1894
|
+
var r=upstreamRequest(req,resp,p.path,p.headers,p.service,{});
|
|
1895
|
+
if(r)r.end(p.body);
|
|
1801
1896
|
});
|
|
1802
1897
|
}
|
|
1803
|
-
|
|
1898
|
+
// One upstream request; the response is relayed back. Undefined when the
|
|
1899
|
+
// headers cannot be sent (the client got a 400).
|
|
1900
|
+
function upstreamRequest(req,resp,path,headers,service,extra){
|
|
1901
|
+
var r,opts={host:upHost,port:up.port||(secure?443:80),method:req.method,path:path,headers:headers,agent:agent};
|
|
1902
|
+
Object.keys(extra).forEach(function(k){opts[k]=extra[k];});
|
|
1903
|
+
try{r=mod.request(opts,function(ur){relay(ur,resp,rewritesResponse(req,service));});}
|
|
1904
|
+
catch(e){send(resp,400,{code:'InvalidRequest',message:label+': the request has a header the AWS Emulator sidecar cannot forward.'},service);return undefined;}
|
|
1905
|
+
// A client that hangs up (an aborted GetObject) frees the upstream socket too.
|
|
1906
|
+
resp.on('close',function(){if(!resp.writableFinished)r.destroy();});
|
|
1907
|
+
r.setTimeout(300000,function(){r.destroy(Object.assign(new Error('upstream timeout'),{code:'ETIMEDOUT'}));});
|
|
1908
|
+
r.on('error',function(e){process.stdout.write('CDKL-RESIGN upstream error '+(e.code||'ERROR')+'\n');send(resp,502,{code:'BadGateway',message:label+': the AWS Emulator at '+cfg.upstream+' did not answer ('+(e.code||'ERROR')+').'},service);});
|
|
1909
|
+
return r;
|
|
1910
|
+
}
|
|
1911
|
+
// Full emulator mode: the workload already signs with the emulator's keys,
|
|
1912
|
+
// so the request goes upstream unchanged (its Host header too, which the
|
|
1913
|
+
// signature covers) and streams; only hop-by-hop headers are dropped. TLS
|
|
1914
|
+
// to the emulator is verified against the emulator's host name.
|
|
1915
|
+
function handlePassthrough(req,resp){
|
|
1916
|
+
var service=serviceOf(req);
|
|
1917
|
+
// The incoming Host names the sidecar, not the emulator: SNI (and with it
|
|
1918
|
+
// the certificate check) uses the emulator's own host name instead.
|
|
1919
|
+
var extra=secure?{servername:net.isIP(upHost)?'':upHost}:{};
|
|
1920
|
+
var r=upstreamRequest(req,resp,String(req.url||'/'),passthroughHeaders(req.headers),service,extra);
|
|
1921
|
+
if(!r){req.resume();return;}
|
|
1922
|
+
req.on('error',function(){r.destroy();resp.destroy();});
|
|
1923
|
+
req.pipe(r);
|
|
1924
|
+
}
|
|
1925
|
+
var srv=https.createServer({key:cfg.keyPem,cert:cfg.certPem},passthrough?handlePassthrough:handle);
|
|
1804
1926
|
srv.on('checkContinue',function(req,resp){
|
|
1927
|
+
if(passthrough){resp.writeContinue();handlePassthrough(req,resp);return;}
|
|
1805
1928
|
var n=tooLargeByHeaders(req.headers,cfg.capBytes);
|
|
1806
1929
|
if(n>0){process.stdout.write('CDKL-RESIGN rejected a request body over the cap\n');send(resp,413,tooLargeError(n,cfg.capBytes,serviceOf(req)),serviceOf(req));req.resume();return;}
|
|
1807
1930
|
resp.writeContinue();
|
|
1808
1931
|
handle(req,resp);
|
|
1809
1932
|
});
|
|
1810
1933
|
srv.once('error',function(e){done({error:e.code||'ERROR',port:cfg.port});});
|
|
1811
|
-
// Loopback only: it signs with the emulator's keys for whoever connects.
|
|
1934
|
+
// Loopback only: in mixed mode it signs with the emulator's keys for whoever connects.
|
|
1812
1935
|
srv.listen(cfg.port,'127.0.0.1',function(){done({port:cfg.port,address:srv.address().address});});
|
|
1813
1936
|
});}
|
|
1814
1937
|
`;
|
|
@@ -2126,19 +2249,7 @@ function processAlive(pid) {
|
|
|
2126
2249
|
return err.code === "EPERM";
|
|
2127
2250
|
}
|
|
2128
2251
|
}
|
|
2129
|
-
function
|
|
2130
|
-
const { ep, services, credentials, caSources, disposers } = args;
|
|
2131
|
-
const resignEndpoint = `https://127.0.0.1:${MIXED_MODE_RESIGN_PORT}`;
|
|
2132
|
-
const caPems = [];
|
|
2133
|
-
for (const source of caSources) try {
|
|
2134
|
-
caPems.push(...pemCertificates(readFileSync(source, "utf8")));
|
|
2135
|
-
} catch (err) {
|
|
2136
|
-
throw new Error(`--aws-emulator: the CA bundle ${displayUntrustedValue(source)} cannot be read (${err.code ?? "error"}).`);
|
|
2137
|
-
}
|
|
2138
|
-
const upstreamCaPem = caPems.length > 0 ? caPems.join("\n") : void 0;
|
|
2139
|
-
const tls = createMixedModeTlsMaterials();
|
|
2140
|
-
const bundle = writeCaBundleFile(void 0, [...caPems, tls.caCertPem]);
|
|
2141
|
-
disposers.push(bundle.dispose);
|
|
2252
|
+
function writeSidecarConfig(config, disposers) {
|
|
2142
2253
|
sweepStaleResignDirs();
|
|
2143
2254
|
const dir = mkdtempSync(path$1.join(tmpdir(), `${getEmbedConfig().productName}-resign-`));
|
|
2144
2255
|
disposers.push(() => rmSync(dir, {
|
|
@@ -2146,7 +2257,39 @@ function resolveMixedModeWiring(args) {
|
|
|
2146
2257
|
force: true
|
|
2147
2258
|
}));
|
|
2148
2259
|
writeFileSync(path$1.join(dir, "owner.pid"), String(process.pid), { mode: 384 });
|
|
2149
|
-
const
|
|
2260
|
+
const configPath = path$1.join(dir, "resign.json");
|
|
2261
|
+
writeFileSync(configPath, JSON.stringify(config), { mode: 384 });
|
|
2262
|
+
return configPath;
|
|
2263
|
+
}
|
|
2264
|
+
function readPemCertificates(sources) {
|
|
2265
|
+
const out = [];
|
|
2266
|
+
for (const source of new Set(sources)) try {
|
|
2267
|
+
out.push(...pemCertificates(readFileSync(source, "utf8")));
|
|
2268
|
+
} catch (err) {
|
|
2269
|
+
throw new Error(`--aws-emulator: the CA bundle ${displayUntrustedValue(source)} cannot be read (${err.code ?? "error"}).`);
|
|
2270
|
+
}
|
|
2271
|
+
return out;
|
|
2272
|
+
}
|
|
2273
|
+
function writeJavaTrustStoreFile(pems) {
|
|
2274
|
+
const dir = mkdtempSync(path$1.join(tmpdir(), `${getEmbedConfig().productName}-truststore-`));
|
|
2275
|
+
const hostPath = path$1.join(dir, "truststore.p12");
|
|
2276
|
+
writeFileSync(hostPath, buildJavaTrustStore(pems), { mode: 420 });
|
|
2277
|
+
return {
|
|
2278
|
+
hostPath,
|
|
2279
|
+
dispose: () => rmSync(dir, {
|
|
2280
|
+
recursive: true,
|
|
2281
|
+
force: true
|
|
2282
|
+
})
|
|
2283
|
+
};
|
|
2284
|
+
}
|
|
2285
|
+
function resolveMixedModeWiring(args) {
|
|
2286
|
+
const { ep, services, credentials, caSources, disposers } = args;
|
|
2287
|
+
const resignEndpoint = `https://127.0.0.1:${MIXED_MODE_RESIGN_PORT}`;
|
|
2288
|
+
const caPems = readPemCertificates(caSources);
|
|
2289
|
+
const upstreamCaPem = caPems.length > 0 ? caPems.join("\n") : void 0;
|
|
2290
|
+
const tls = createMixedModeTlsMaterials();
|
|
2291
|
+
const bundle = writeCaBundleFile(void 0, [...caPems, tls.caCertPem]);
|
|
2292
|
+
disposers.push(bundle.dispose);
|
|
2150
2293
|
const config = {
|
|
2151
2294
|
port: MIXED_MODE_RESIGN_PORT,
|
|
2152
2295
|
upstream: ep.url,
|
|
@@ -2161,12 +2304,19 @@ function resolveMixedModeWiring(args) {
|
|
|
2161
2304
|
capBytes: MIXED_MODE_RESIGN_BODY_CAP_BYTES,
|
|
2162
2305
|
...args.region ? { region: args.region } : {}
|
|
2163
2306
|
};
|
|
2164
|
-
|
|
2307
|
+
const resignConfigHostPath = writeSidecarConfig(config, disposers);
|
|
2165
2308
|
const containerPath = getContainerCaBundlePath();
|
|
2166
2309
|
const trust = {};
|
|
2167
2310
|
for (const k of CA_TRUST_ENV_KEYS) trust[k] = containerPath;
|
|
2168
2311
|
return {
|
|
2169
2312
|
mode: "forward",
|
|
2313
|
+
sidecar: {
|
|
2314
|
+
port: MIXED_MODE_RESIGN_PORT,
|
|
2315
|
+
endpoint: resignEndpoint,
|
|
2316
|
+
upstream: ep,
|
|
2317
|
+
configHostPath: resignConfigHostPath,
|
|
2318
|
+
passthrough: false
|
|
2319
|
+
},
|
|
2170
2320
|
mixed: {
|
|
2171
2321
|
realServices: services,
|
|
2172
2322
|
emulatorEndpoint: ep,
|
|
@@ -2208,8 +2358,8 @@ async function resolveWorkloadAwsWiring(opts) {
|
|
|
2208
2358
|
d();
|
|
2209
2359
|
} catch {}
|
|
2210
2360
|
};
|
|
2211
|
-
const caMount = (source, keys = CA_TRUST_ENV_KEYS) => {
|
|
2212
|
-
const file = writeCaBundleFile(expandHome(source, homeDir));
|
|
2361
|
+
const caMount = (source, keys = CA_TRUST_ENV_KEYS, extraCertsPem = []) => {
|
|
2362
|
+
const file = writeCaBundleFile(expandHome(source, homeDir), extraCertsPem);
|
|
2213
2363
|
disposers.push(file.dispose);
|
|
2214
2364
|
const containerPath = getContainerCaBundlePath();
|
|
2215
2365
|
const caEnv = {};
|
|
@@ -2256,14 +2406,36 @@ async function resolveWorkloadAwsWiring(opts) {
|
|
|
2256
2406
|
skipPull: opts.skipPull,
|
|
2257
2407
|
region: env["AWS_REGION"] || env["AWS_DEFAULT_REGION"] || void 0
|
|
2258
2408
|
});
|
|
2259
|
-
const
|
|
2409
|
+
const https = ep.url.startsWith("https:");
|
|
2410
|
+
const sidecarTls = https && run.caPath && getEmbedConfig().awsEmulatorSqsSidecar ? createMixedModeTlsMaterials() : void 0;
|
|
2411
|
+
const ca = caSource && https ? caMount(caSource, CA_TRUST_ENV_KEYS, sidecarTls ? [sidecarTls.caCertPem] : []) : void 0;
|
|
2412
|
+
let sidecar;
|
|
2413
|
+
if (sidecarTls && run.caPath) {
|
|
2414
|
+
const upstreamPems = readPemCertificates([run.caPath, ...caSource ? [caSource] : []].map((c) => expandHome(c, homeDir)));
|
|
2415
|
+
sidecar = {
|
|
2416
|
+
port: MIXED_MODE_RESIGN_PORT,
|
|
2417
|
+
endpoint: `https://127.0.0.1:${MIXED_MODE_RESIGN_PORT}`,
|
|
2418
|
+
upstream: ep,
|
|
2419
|
+
passthrough: true,
|
|
2420
|
+
configHostPath: writeSidecarConfig({
|
|
2421
|
+
port: MIXED_MODE_RESIGN_PORT,
|
|
2422
|
+
upstream: ep.url,
|
|
2423
|
+
...upstreamPems.length > 0 ? { upstreamCaPem: upstreamPems.join("\n") } : {},
|
|
2424
|
+
certPem: sidecarTls.certPem,
|
|
2425
|
+
keyPem: sidecarTls.keyPem,
|
|
2426
|
+
capBytes: MIXED_MODE_RESIGN_BODY_CAP_BYTES,
|
|
2427
|
+
passthrough: true
|
|
2428
|
+
}, disposers)
|
|
2429
|
+
};
|
|
2430
|
+
}
|
|
2260
2431
|
let java;
|
|
2261
|
-
if (run.truststorePath &&
|
|
2432
|
+
if (run.truststorePath && https) {
|
|
2262
2433
|
let file;
|
|
2434
|
+
const source = sidecarTls && run.caPath ? run.caPath : run.truststorePath;
|
|
2263
2435
|
try {
|
|
2264
|
-
file = copyTruststoreFile(run.truststorePath);
|
|
2436
|
+
file = sidecarTls && run.caPath ? writeJavaTrustStoreFile([readFileSync(run.caPath, "utf8"), sidecarTls.caCertPem]) : copyTruststoreFile(run.truststorePath);
|
|
2265
2437
|
} catch (err) {
|
|
2266
|
-
getLogger().warn(`--aws-emulator: ${
|
|
2438
|
+
getLogger().warn(`--aws-emulator: ${source} cannot be read (${err.code ?? "error"}); Java workloads get no JAVA_TOOL_OPTIONS trust store.`);
|
|
2267
2439
|
}
|
|
2268
2440
|
if (file) {
|
|
2269
2441
|
disposers.push(file.dispose);
|
|
@@ -2280,8 +2452,10 @@ async function resolveWorkloadAwsWiring(opts) {
|
|
|
2280
2452
|
return {
|
|
2281
2453
|
mode: "emulator",
|
|
2282
2454
|
emulatorEndpoint: ep,
|
|
2455
|
+
...sidecar ? { sidecar } : {},
|
|
2283
2456
|
env: {
|
|
2284
2457
|
AWS_ENDPOINT_URL: ep.url,
|
|
2458
|
+
...sidecar ? { AWS_ENDPOINT_URL_SQS: sidecar.endpoint } : {},
|
|
2285
2459
|
AWS_EC2_METADATA_DISABLED: "true",
|
|
2286
2460
|
AWS_DISABLE_HOST_PREFIX_INJECTION: "true",
|
|
2287
2461
|
AWS_IGNORE_CONFIGURED_ENDPOINT_URLS: "false",
|
|
@@ -2290,7 +2464,7 @@ async function resolveWorkloadAwsWiring(opts) {
|
|
|
2290
2464
|
},
|
|
2291
2465
|
scrubEnvKeys: EMULATOR_SCRUBBED_ENV_KEYS,
|
|
2292
2466
|
mounts: [...ca?.mounts ?? [], ...java ? [java.mount] : []],
|
|
2293
|
-
loopbackPorts: ep.loopback ? [ep.port] : [],
|
|
2467
|
+
loopbackPorts: [...ep.loopback ? [ep.port] : [], ...sidecar ? [sidecar.port] : []],
|
|
2294
2468
|
probeHealth: ca !== void 0,
|
|
2295
2469
|
...ca ? { caHostPath: ca.hostPath } : {},
|
|
2296
2470
|
emulatorCredentials: credentials,
|
|
@@ -2336,6 +2510,18 @@ async function resolveWorkloadAwsWiring(opts) {
|
|
|
2336
2510
|
throw err;
|
|
2337
2511
|
}
|
|
2338
2512
|
}
|
|
2513
|
+
function sidecarOf(wiring) {
|
|
2514
|
+
if (wiring.sidecar) return wiring.sidecar;
|
|
2515
|
+
const mixed = wiring.mixed;
|
|
2516
|
+
if (!mixed) return void 0;
|
|
2517
|
+
return {
|
|
2518
|
+
port: mixed.resignPort,
|
|
2519
|
+
endpoint: mixed.resignEndpoint,
|
|
2520
|
+
upstream: mixed.emulatorEndpoint,
|
|
2521
|
+
configHostPath: mixed.resignConfigHostPath,
|
|
2522
|
+
passthrough: false
|
|
2523
|
+
};
|
|
2524
|
+
}
|
|
2339
2525
|
function effectiveLoopbackPorts(env, wiring) {
|
|
2340
2526
|
const used = /* @__PURE__ */ new Set();
|
|
2341
2527
|
for (const [k, v] of Object.entries(env)) {
|
|
@@ -2345,16 +2531,16 @@ function effectiveLoopbackPorts(env, wiring) {
|
|
|
2345
2531
|
if (ep.loopback) used.add(ep.port);
|
|
2346
2532
|
} catch {}
|
|
2347
2533
|
}
|
|
2348
|
-
const
|
|
2349
|
-
if (
|
|
2534
|
+
const sidecar = sidecarOf(wiring);
|
|
2535
|
+
if (sidecar && used.has(sidecar.port) && sidecar.upstream.loopback) used.add(sidecar.upstream.port);
|
|
2350
2536
|
return wiring.loopbackPorts.filter((p) => used.has(p));
|
|
2351
2537
|
}
|
|
2352
2538
|
function loopbackForwarderPlan(wiring, ports) {
|
|
2353
|
-
const
|
|
2354
|
-
if (!
|
|
2539
|
+
const sidecar = sidecarOf(wiring);
|
|
2540
|
+
if (!sidecar || !ports.includes(sidecar.port)) return { ports: [...ports] };
|
|
2355
2541
|
return {
|
|
2356
|
-
ports: ports.filter((p) => p !==
|
|
2357
|
-
resignConfigHostPath:
|
|
2542
|
+
ports: ports.filter((p) => p !== sidecar.port),
|
|
2543
|
+
resignConfigHostPath: sidecar.configHostPath
|
|
2358
2544
|
};
|
|
2359
2545
|
}
|
|
2360
2546
|
function applyWorkloadAwsWiringToEnv(env, wiring, defaultCredentials) {
|
|
@@ -2393,8 +2579,10 @@ function applyWorkloadAwsWiringToEnv(env, wiring, defaultCredentials) {
|
|
|
2393
2579
|
};
|
|
2394
2580
|
if (wiring.mode === "emulator") {
|
|
2395
2581
|
const ownJavaToolOptions = out["JAVA_TOOL_OPTIONS"];
|
|
2582
|
+
const ownSqsEndpoint = out["AWS_ENDPOINT_URL_SQS"];
|
|
2396
2583
|
for (const k of wiring.scrubEnvKeys) delete out[k];
|
|
2397
2584
|
Object.assign(out, wiring.env);
|
|
2585
|
+
if (ownSqsEndpoint !== void 0) out["AWS_ENDPOINT_URL_SQS"] = ownSqsEndpoint;
|
|
2398
2586
|
const javaToolOptions = wiring.env["JAVA_TOOL_OPTIONS"];
|
|
2399
2587
|
if (javaToolOptions !== void 0) out["JAVA_TOOL_OPTIONS"] = mergeJavaToolOptions(ownJavaToolOptions, javaToolOptions);
|
|
2400
2588
|
setCreds(wiring.emulatorCredentials);
|
|
@@ -2679,5 +2867,5 @@ function warnWorkloadCredentialsStripped() {
|
|
|
2679
2867
|
}
|
|
2680
2868
|
|
|
2681
2869
|
//#endregion
|
|
2682
|
-
export {
|
|
2683
|
-
//# sourceMappingURL=workload-identity-
|
|
2870
|
+
export { getAwsEndpointOverride as $, parseAwsEndpoint as A, hostFromAuthority as At, workload_aws_wiring_exports as B, effectiveLoopbackPorts as C, readEnvVarsFileText as Ct, javaTruststoreToolOptions as D, isWildcardHostname as Dt, getContainerJavaTruststorePath as E, isLoopbackHostname as Et, resolveHostDefaultCredentials as F, createMixedModeTlsMaterials as G, MIXED_MODE_RESIGN_BODY_CAP_BYTES as H, resolveWorkloadAwsWiring as I, awsEndpointOverrideClientConfig as J, awsClientConfigForService as K, setActiveWorkloadAwsWiring as L, readEmulatorRunFiles as M, readProfileEndpointSettings as N, loopbackForwarderPlan as O, formatAuthority as Ot, resolveAwsEmulatorOption as P, getAwsEmulatorServiceRouting as Q, takeAwsEmulatorStateSourceHint as R, displayEndpointValue as S, applyEnvOverrideMap as St, getContainerCaBundlePath as T, defineOwnKey as Tt, RESIGN_SIDECAR_SCRIPT as U, writeCaBundleFile as V, buildJavaTrustStore as W, deployArtifactClientConfig as X, buildProxyClientConfig as Y, deployArtifactsReadEmulator as Z, HOST_DEFAULT_CREDENTIALS_MISS_TTL_MS as _, realAwsServicesForWorkload as _t, deployAccountStsClientConfig as a, setAwsEndpointOverride as at, awsEmulatorEnvName as b, validateAwsEmulatorEnvVars as bt, resetWorkloadIdentity as c, REAL_AWS_SENTINEL as ct, workloadStsClientConfig as d, findRealAwsExceptions as dt, isAwsServiceRoutedToEmulator as et, AUTH_OFF_PLACEHOLDER_CREDENTIALS as f, isLegacyAwsEmulatorSentinel as ft, HOST_CA_TRUST_ENV_KEYS as g, realAwsEndpointFor as gt, EMULATOR_SCRUBBED_ENV_KEYS as h, readAwsEmulatorEnvVarsFile as ht, assumedRoleRecorded as i, setAwsEmulatorServiceRouting as it, probeAwsEmulatorHealth as j, mergeJavaToolOptions as k, formatHostForAuthority as kt, warnWorkloadCredentialsStripped as l, createMixedModeStateProvider as lt, DEFAULT_AWS_EMULATOR_URL as m, legacyAwsEmulatorSentinelMessage as mt, accountLookupStsClientConfig as n, normalizeAwsEndpointServiceId as nt, readEnvCallerCredentials as o, LEGACY_AWS_EMULATOR_SENTINEL as ot, CA_TRUST_ENV_KEYS as p, isRealAwsSentinel as pt, awsEmulatorRealServices as q, applyWorkloadEnvCredentials as r, proxyAwareFetch as rt, recordAssumedRole as s, MIXED_MODE_RESIGN_PORT as st, SECOND_ASSUME_MESSAGE as t, isProxyEnvConfigured as tt, workloadClientConfig as u, findLegacyAwsEmulatorSentinels as ut, activateWorkloadAwsWiring as v, realAwsServicesOf as vt, getActiveWorkloadAwsWiring as w, resolveEnvVars as wt, collectHostEndpointOverrides as x, AWS_ENDPOINT_SERVICE_IDS as xt, applyWorkloadAwsWiringToEnv as y, resourceTypeMatchesService as yt, workloadGetsEmulatorKeysOnly as z };
|
|
2871
|
+
//# sourceMappingURL=workload-identity-BQBoBgdT.js.map
|