@runeya/runeya 2.0.48 → 2.0.49
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/agent-manager-JNA5ZALK.js +7 -0
- package/{chunk-JUOZ4L4Y.js → chunk-4AGTVGSH.js} +48 -5
- package/chunk-4AGTVGSH.js.map +1 -0
- package/index.js +1 -1
- package/package.json +1 -1
- package/{src-GMWPTVN2.js → src-WVK4WUI3.js} +36 -7
- package/src-WVK4WUI3.js.map +1 -0
- package/agent-manager-3VUZZC3X.js +0 -7
- package/chunk-JUOZ4L4Y.js.map +0 -1
- package/src-GMWPTVN2.js.map +0 -1
- /package/{agent-manager-3VUZZC3X.js.map → agent-manager-JNA5ZALK.js.map} +0 -0
|
@@ -635,7 +635,7 @@ function encryptVariableSlots(variables, existingEncrypted) {
|
|
|
635
635
|
}
|
|
636
636
|
return result;
|
|
637
637
|
}
|
|
638
|
-
function decryptVariableSlots(variables, contextLabel) {
|
|
638
|
+
function decryptVariableSlots(variables, contextLabel, onFailure) {
|
|
639
639
|
const result = {};
|
|
640
640
|
for (const [key, variable] of Object.entries(variables)) {
|
|
641
641
|
const slot = variable.value;
|
|
@@ -643,7 +643,8 @@ function decryptVariableSlots(variables, contextLabel) {
|
|
|
643
643
|
try {
|
|
644
644
|
result[key] = { ...variable, value: { ...slot, value: decryptValue(slot.value) } };
|
|
645
645
|
} catch (err) {
|
|
646
|
-
console.error(`[crypto-helpers] Failed to decrypt variable "${key}" for ${contextLabel}: ${err.message}`);
|
|
646
|
+
console.error(`[crypto-helpers] Failed to decrypt variable "${key}" for ${contextLabel}: ${err.message} \u2014 la valeur chiffr\xE9e est conserv\xE9e telle quelle sur le disque`);
|
|
647
|
+
onFailure?.(key);
|
|
647
648
|
result[key] = { ...variable, value: { ...slot, value: "" } };
|
|
648
649
|
}
|
|
649
650
|
} else {
|
|
@@ -1928,6 +1929,13 @@ var EnvironmentStore = class {
|
|
|
1928
1929
|
loaded = false;
|
|
1929
1930
|
/** Cache of encrypted secret values as last written to disk */
|
|
1930
1931
|
diskEncryptedSlots = /* @__PURE__ */ new Map();
|
|
1932
|
+
/**
|
|
1933
|
+
* Les secrets qu'aucune clé chargée n'a ouverts, par environnement.
|
|
1934
|
+
*
|
|
1935
|
+
* Vides en mémoire, ils doivent repartir sur le disque sous leur forme
|
|
1936
|
+
* chiffrée : c'est ce que retient cette liste. Voir `keepUnreadableSecrets`.
|
|
1937
|
+
*/
|
|
1938
|
+
unreadableSecrets = /* @__PURE__ */ new Map();
|
|
1931
1939
|
listeners = /* @__PURE__ */ new Set();
|
|
1932
1940
|
/** Notified after every persisted mutation, for the cloud sync bridge. */
|
|
1933
1941
|
onChange(fn) {
|
|
@@ -2001,15 +2009,48 @@ var EnvironmentStore = class {
|
|
|
2001
2009
|
cache?.envSlots
|
|
2002
2010
|
);
|
|
2003
2011
|
}
|
|
2004
|
-
return { ...environment, variables: encryptedVars };
|
|
2012
|
+
return { ...environment, variables: this.keepUnreadableSecrets(environment.id, encryptedVars) };
|
|
2013
|
+
}
|
|
2014
|
+
/**
|
|
2015
|
+
* Réécrire un secret illisible tel qu'il est sur le disque, jamais à blanc.
|
|
2016
|
+
*
|
|
2017
|
+
* Un secret qui ne s'ouvre pas est vide en mémoire (voir
|
|
2018
|
+
* `decryptVariableSlots`) : le chiffrer donnerait un chiffré de la chaîne
|
|
2019
|
+
* vide, et la sauvegarde effacerait pour de bon une valeur dont il ne
|
|
2020
|
+
* manquait que la clé. Son chiffré d'origine est encore là — c'est celui que
|
|
2021
|
+
* `diskEncryptedSlots` a mis de côté avant le déchiffrement — et c'est lui
|
|
2022
|
+
* qui repart sur le disque.
|
|
2023
|
+
*
|
|
2024
|
+
* La condition tient à la valeur en mémoire : tant qu'elle est vide, la
|
|
2025
|
+
* variable n'a pas été retouchée et son chiffré fait foi. Dès que
|
|
2026
|
+
* l'utilisateur en saisit une nouvelle, elle l'emporte — et vider un secret
|
|
2027
|
+
* volontairement reste possible, puisque cela ne concerne que les variables
|
|
2028
|
+
* dont le déchiffrement a échoué.
|
|
2029
|
+
*/
|
|
2030
|
+
keepUnreadableSecrets(environmentId, variables) {
|
|
2031
|
+
const failed = this.unreadableSecrets.get(environmentId);
|
|
2032
|
+
if (!failed?.size || !variables) return variables;
|
|
2033
|
+
const onDisk = this.diskEncryptedSlots.get(environmentId)?.envSlots ?? {};
|
|
2034
|
+
const result = { ...variables };
|
|
2035
|
+
for (const variableId of failed) {
|
|
2036
|
+
const ciphertext = onDisk[variableId];
|
|
2037
|
+
const variable = result[variableId];
|
|
2038
|
+
if (!ciphertext || !variable || variable.value.value) continue;
|
|
2039
|
+
result[variableId] = { ...variable, value: { ...variable.value, value: ciphertext } };
|
|
2040
|
+
}
|
|
2041
|
+
return result;
|
|
2005
2042
|
}
|
|
2006
2043
|
decryptEnvironment(environment) {
|
|
2007
2044
|
let decryptedVars = environment.variables;
|
|
2008
2045
|
if (environment.variables && Object.keys(environment.variables).length > 0) {
|
|
2046
|
+
const failed = /* @__PURE__ */ new Set();
|
|
2009
2047
|
decryptedVars = decryptVariableSlots(
|
|
2010
2048
|
environment.variables,
|
|
2011
|
-
`environment ${environment.id}
|
|
2049
|
+
`environment ${environment.id}`,
|
|
2050
|
+
(variableId) => failed.add(variableId)
|
|
2012
2051
|
);
|
|
2052
|
+
if (failed.size > 0) this.unreadableSecrets.set(environment.id, failed);
|
|
2053
|
+
else this.unreadableSecrets.delete(environment.id);
|
|
2013
2054
|
}
|
|
2014
2055
|
return { ...environment, variables: decryptedVars };
|
|
2015
2056
|
}
|
|
@@ -2111,6 +2152,7 @@ var EnvironmentStore = class {
|
|
|
2111
2152
|
if (environment.projectId !== projectId) continue;
|
|
2112
2153
|
this.environments.delete(id);
|
|
2113
2154
|
this.diskEncryptedSlots.delete(id);
|
|
2155
|
+
this.unreadableSecrets.delete(id);
|
|
2114
2156
|
this.roots.delete(id);
|
|
2115
2157
|
}
|
|
2116
2158
|
this.notify();
|
|
@@ -2347,6 +2389,7 @@ var EnvironmentStore = class {
|
|
|
2347
2389
|
if (!this.environments.has(id)) return false;
|
|
2348
2390
|
this.environments.delete(id);
|
|
2349
2391
|
this.diskEncryptedSlots.delete(id);
|
|
2392
|
+
this.unreadableSecrets.delete(id);
|
|
2350
2393
|
await this.save();
|
|
2351
2394
|
return true;
|
|
2352
2395
|
}
|
|
@@ -3694,4 +3737,4 @@ export {
|
|
|
3694
3737
|
traefikManager,
|
|
3695
3738
|
agentManager
|
|
3696
3739
|
};
|
|
3697
|
-
//# sourceMappingURL=chunk-
|
|
3740
|
+
//# sourceMappingURL=chunk-4AGTVGSH.js.map
|