fix: remove open execution record caps and preserve recovery history
This commit is contained in:
@@ -17,7 +17,7 @@ export class CredentialVault {
|
||||
}
|
||||
reload() {
|
||||
const state = this.store.storage.meta(metadata, empty());
|
||||
this.blocked = !state || state.schema !== 1 || !Number.isSafeInteger(state.revision) || !state.entries || typeof state.entries !== 'object' || Array.isArray(state.entries) || Object.keys(state.entries).length > 101;
|
||||
this.blocked = !state || state.schema !== 1 || !Number.isSafeInteger(state.revision) || state.revision < 0 || !state.entries || typeof state.entries !== 'object' || Array.isArray(state.entries);
|
||||
this.state = this.blocked ? empty() : state;
|
||||
}
|
||||
binding(connection) {
|
||||
@@ -30,8 +30,15 @@ export class CredentialVault {
|
||||
if (connection.credentialSource) return { status: 'reference', storage: 'source-reference', sourceId: connection.credentialSource.connectionId,
|
||||
message: '共用上游源连接的凭据与加载状态,请在源连接管理;没有复制或额外保存 Key。' };
|
||||
if (this.blocked) return { status: 'unavailable', storage: 'windows-user-dpapi', message: '本机保存登记格式损坏或来自新版本,未覆盖原记录。' };
|
||||
if (!Object.hasOwn(this.state.entries, connection.id)) return { status: 'not_saved', storage: 'memory', message: '当前凭据只在宿主内存中。' };
|
||||
const value = this.state.entries[connection.id];
|
||||
if (!value) return { status: 'not_saved', storage: 'memory', message: '当前凭据只在宿主内存中。' };
|
||||
if (!value || typeof value !== 'object' || Array.isArray(value) || value.schema !== 1 || value.connectionId !== connection.id
|
||||
|| !Number.isSafeInteger(value.connectionRevision) || value.connectionRevision < 1 || !Number.isSafeInteger(value.credentialRevision) || value.credentialRevision < 1
|
||||
|| typeof value.enabled !== 'boolean' || typeof value.savedAt !== 'string' || !Number.isFinite(Date.parse(value.savedAt))
|
||||
|| value.userSid !== null && typeof value.userSid !== 'string' || !/^[a-f0-9]{64}$/.test(value.dataIdentity) || !/^[a-f0-9]{64}$/.test(value.bindingSha256)
|
||||
|| typeof value.ciphertext !== 'string' || !value.ciphertext.length || value.ciphertext.length > 200000 || !/^[A-Za-z0-9+/]+={0,2}$/.test(value.ciphertext)) {
|
||||
return { status: 'invalid_record', storage: 'windows-user-dpapi', message: '此连接的原保存登记无法核对,原记录已保留;其他有效连接继续加载。' };
|
||||
}
|
||||
const issue = value.userSid !== this.userSid ? 'user_mismatch' : value.dataIdentity !== this.dataIdentity ? 'directory_mismatch'
|
||||
: value.connectionRevision !== connection.revision || value.bindingSha256 !== this.binding(connection) ? 'source_changed'
|
||||
: this.issues.get(connection.id);
|
||||
|
||||
Reference in New Issue
Block a user