@vizamodo/aws-sts-core 0.4.27 → 0.4.30

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.
Files changed (2) hide show
  1. package/dist/sts/issue.js +14 -15
  2. package/package.json +1 -1
package/dist/sts/issue.js CHANGED
@@ -85,16 +85,8 @@ export async function issueAwsCredentials(input) {
85
85
  const { roleArn, profileArn, trustAnchorArn, region, certBase64, privateKeyPkcs8Base64, profile, forceRefresh, } = input;
86
86
  const sessionTtl = resolveSessionTtlByProfile(profile);
87
87
  const normalizedCert = normalizeCert(certBase64);
88
- // ---- DER serial extraction (with isolate-level cache) ----
89
- let certSerialDec;
90
- if (cachedCertSerialDec && cachedCertSerialSource === normalizedCert) {
91
- certSerialDec = cachedCertSerialDec;
92
- }
93
- else {
94
- certSerialDec = parseCertSerialDec(normalizedCert); // throws InternalError on bad DER
95
- cachedCertSerialDec = certSerialDec;
96
- cachedCertSerialSource = normalizedCert;
97
- }
88
+ // ---- DER serial extraction (no isolate cache — avoid stale bug) ----
89
+ const certSerialDec = parseCertSerialDec(normalizedCert);
98
90
  const cacheKey = `${region}|${roleArn}|${profileArn}|${trustAnchorArn}|${certSerialDec}`;
99
91
  return getCachedOrFetch(cacheKey, async () => {
100
92
  // ---- Build SigV4 request (moved inside fetcher) ----
@@ -139,11 +131,18 @@ export async function issueAwsCredentials(input) {
139
131
  "Authorization": `${ALGORITHM} Credential=${certSerialDec}/${credentialScope}, SignedHeaders=${signedHeaders}, Signature=${signatureHex}`,
140
132
  });
141
133
  const issuedAt = Date.now();
142
- const res = await fetch(`https://${host}${PATH}`, {
143
- method: "POST",
144
- headers: finalHeaders,
145
- body,
146
- });
134
+ let res;
135
+ try {
136
+ res = await fetch(`https://${host}${PATH}`, {
137
+ method: "POST",
138
+ headers: finalHeaders,
139
+ body,
140
+ });
141
+ }
142
+ catch (err) {
143
+ console.warn("[aws-unreachable]", { region, error: err?.message });
144
+ throw new InternalError("aws_unreachable");
145
+ }
147
146
  if (!res.ok) {
148
147
  console.warn("[aws-rejected]", { status: res.status, region, profile });
149
148
  throw new InternalError("aws_rejected");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizamodo/aws-sts-core",
3
- "version": "0.4.27",
3
+ "version": "0.4.30",
4
4
  "description": "Pure AWS STS + SigV4 (X509 Roles Anywhere) core logic",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",