Add scoped human-unlocked vault agent autofill
This commit is contained in:
1 parent
61fcd8336f
commit
e8a654fb38
23 files changed
+383
-29
No files matched your search
@@ -101,3 +101,37 @@ test('background metadata polling cannot postpone the idle lock deadline', t =>
|
||||
assert.equal(engine.status().locked, true);
|
||||
assert.throws(() => engine.list());
|
||||
});
|
||||
|
||||
test('internal access generation invalidates refs across reopen and same-id credential changes', t => {
|
||||
const { engine } = fixture(t); t.after(engine.lock);
|
||||
const initial = engine.accessGeneration();
|
||||
engine.create(master); assert.ok(engine.accessGeneration() > initial);
|
||||
const { id } = engine.upsert({ origin: 'https://company.example', username: 'user', password: 'first-fixture-value' });
|
||||
const listed = engine.accessGeneration();
|
||||
engine.upsert({ id, origin: 'https://company.example', username: 'user', password: 'second-fixture-value' });
|
||||
assert.ok(engine.accessGeneration() > listed);
|
||||
assert.equal(engine.list()[0].id, id);
|
||||
const changed = engine.accessGeneration();
|
||||
engine.lock(); assert.ok(engine.accessGeneration() > changed);
|
||||
const locked = engine.accessGeneration();
|
||||
engine.unlock(master); assert.ok(engine.accessGeneration() > locked);
|
||||
assert.equal(engine.list()[0].id, id);
|
||||
const reopened = engine.accessGeneration();
|
||||
engine.delete(id); assert.ok(engine.accessGeneration() > reopened);
|
||||
assert.equal('accessGeneration' in engine.status(), false);
|
||||
});
|
||||
|
||||
test('internal access generation and metadata reads neither renew idle unlock nor invalidate refs', t => {
|
||||
t.mock.timers.enable({ apis: ['setTimeout'] });
|
||||
const { engine } = fixture(t); t.after(engine.lock);
|
||||
engine.create(master);
|
||||
const generation = engine.accessGeneration();
|
||||
for (let elapsed = 0; elapsed < 300_000; elapsed += 5000) {
|
||||
assert.equal(engine.accessGeneration(), generation);
|
||||
assert.equal(engine.status().locked, false);
|
||||
assert.deepEqual(engine.list(), []);
|
||||
t.mock.timers.tick(5000);
|
||||
}
|
||||
assert.equal(engine.status().locked, true);
|
||||
assert.ok(engine.accessGeneration() > generation);
|
||||
});
|
||||
Reference in new issue
Block a user