@westbayberry/dg 2.0.1 → 2.0.2
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/api/analyze.js +8 -0
- package/dist/proxy/server.js +3 -1
- package/package.json +1 -1
package/dist/api/analyze.js
CHANGED
|
@@ -182,6 +182,14 @@ function resolveApiBaseUrl(env) {
|
|
|
182
182
|
function resolveToken(env) {
|
|
183
183
|
return envAuthToken(env) ?? readAuthStateSafe(env)?.token;
|
|
184
184
|
}
|
|
185
|
+
export function identityHeaders(env) {
|
|
186
|
+
const headers = { "X-Device-Id": getOrCreateDeviceId(env) };
|
|
187
|
+
const token = resolveToken(env);
|
|
188
|
+
if (token) {
|
|
189
|
+
headers.Authorization = `Bearer ${token}`;
|
|
190
|
+
}
|
|
191
|
+
return headers;
|
|
192
|
+
}
|
|
185
193
|
function readAuthStateSafe(env) {
|
|
186
194
|
try {
|
|
187
195
|
return readAuthState(env);
|
package/dist/proxy/server.js
CHANGED
|
@@ -15,6 +15,7 @@ import { artifactDisplayName, artifactUrlHash, extractRegistryMetadataIdentities
|
|
|
15
15
|
import { authorityFor, connectViaUpstreamProxy, selectUpstreamProxy } from "./upstream-proxy.js";
|
|
16
16
|
import { redactSecrets } from "../launcher/output-redaction.js";
|
|
17
17
|
import { envAuthToken } from "../auth/env-token.js";
|
|
18
|
+
import { identityHeaders } from "../api/analyze.js";
|
|
18
19
|
export async function startProductionHttpProxy(options) {
|
|
19
20
|
const ca = createEphemeralCertificateAuthority(options.session.files.ca);
|
|
20
21
|
const state = {
|
|
@@ -629,7 +630,8 @@ async function lookupVerdict(options, target, sha256, upstream, identity) {
|
|
|
629
630
|
const response = await fetch(`${options.apiBaseUrl}/v1/install-verdict`, {
|
|
630
631
|
method: "POST",
|
|
631
632
|
headers: {
|
|
632
|
-
"Content-Type": "application/json"
|
|
633
|
+
"Content-Type": "application/json",
|
|
634
|
+
...identityHeaders(options.env)
|
|
633
635
|
},
|
|
634
636
|
body: JSON.stringify({
|
|
635
637
|
manager: options.classification.manager,
|