Skip to content

Commit a6f89ed

Browse files
committed
Validate the exact Windows login storage patch from the official candidate
1 parent 651a527 commit a6f89ed

2 files changed

Lines changed: 28 additions & 5 deletions

File tree

‎.github/workflows/windows-login-storage.yml‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ jobs:
2121
shell: pwsh
2222
run: |
2323
$ErrorActionPreference = 'Stop'
24-
$url = 'https://kodermodule.com/releases/cli-0.8.1/koder-cli-0.8.1.tgz'
24+
$url = 'https://kodermodule.com/packages/cli/cli-0.8.4/f4eec29a09c41019/koder-cli-0.8.4.tgz'
2525
$archive = Join-Path $env:RUNNER_TEMP 'koder-acceptance.tgz'
2626
curl.exe --fail --location --retry 3 --retry-delay 2 --connect-timeout 30 --max-time 600 --output $archive $url
2727
if ($LASTEXITCODE -ne 0) { throw 'OFFICIAL_DOWNLOAD_FAILED' }
28-
if ((Get-FileHash $archive -Algorithm SHA256).Hash.ToLowerInvariant() -ne '42bb474ba7e5570786de588c97809af71d55bc774db37985e2eb049a9d54c573') { throw 'PACKAGE_HASH_MISMATCH' }
28+
if ((Get-FileHash $archive -Algorithm SHA256).Hash.ToLowerInvariant() -ne '97b5ec4ba6b81b8f2f361402cb355966132f3586be42ea5d181f2c31d1331c83') { throw 'PACKAGE_HASH_MISMATCH' }
2929
$installer = Join-Path $env:RUNNER_TEMP 'koder-cli.ps1'
30-
curl.exe --fail --location --retry 3 --connect-timeout 30 --max-time 120 --output $installer 'https://kodermodule.com/releases/cli-0.8.1/koder-cli.ps1'
30+
curl.exe --fail --location --retry 3 --connect-timeout 30 --max-time 120 --output $installer 'https://kodermodule.com/packages/cli/cli-0.8.4/f4eec29a09c41019/koder-cli.ps1'
3131
if ($LASTEXITCODE -ne 0) { throw 'INSTALLER_DOWNLOAD_FAILED' }
32-
if ((Get-FileHash $installer -Algorithm SHA256).Hash.ToLowerInvariant() -ne '1014ed7fa47d00ba237f5beb71628acc7f49bcfbf8c3150d1975d4536b09581b') { throw 'INSTALLER_HASH_MISMATCH' }
32+
if ((Get-FileHash $installer -Algorithm SHA256).Hash.ToLowerInvariant() -ne 'd3fca32519b86d9488df8a46f1b2d2798576e75ac3b4fa6593c37b31a5ee9127') { throw 'INSTALLER_HASH_MISMATCH' }
3333
# Exercise the shipping installer's Unicode-safe extractor; Windows tar
3434
# does not accept every long filename in the full package.
3535
$installerText = [IO.File]::ReadAllText($installer)
@@ -46,7 +46,7 @@ jobs:
4646
if ($LASTEXITCODE -ne 0) { throw 'PACKAGE_EXTRACT_FAILED' }
4747
"KODER_ACCEPTANCE_PACKAGE=$dest" | Out-File $env:GITHUB_ENV -Append -Encoding utf8
4848
- name: Exercise real CurrentUser DPAPI with synthetic credentials
49-
shell: pwsh
49+
shell: powershell
5050
run: node test/acceptance/windows-login-storage.mjs
5151
- name: Save sanitized receipt
5252
if: always()

‎test/acceptance/windows-login-storage.mjs‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,29 @@ try{
8383
now+=301000;demand((await client.authenticated()).state==='authenticated'&&rotations===2,'ACCOUNT_REFRESH_FAILED');
8484
demand((await client.logout()).state==='signed-out'&&(await client.status()).state==='signed-out','ACCOUNT_LOGOUT_FAILED');
8585
});
86+
if(typeof openMemoryCredentials({dir:path.join(base,'capability-check'),requireProtected:true}).check==='function'){
87+
await check('protected-retry-after-spawn-failure',async()=>{
88+
let failOnce=true;
89+
const vault=openMemoryCredentials({dir:path.join(base,'retry'),namespace:'retry',requireProtected:true,spawnImpl:(...args)=>{
90+
if(failOnce){failOnce=false;throw Object.assign(Error('synthetic failure'),{code:'EACCES'});}return spawn(...args);
91+
}});
92+
let failure;try{await vault.write({marker:'SYNTHETIC'});}catch(error){failure=error;}
93+
demand(failure?.storageFailure?.reason==='ACCESS_DENIED','STORAGE_REASON_LOST');
94+
await vault.write({marker:'SYNTHETIC'});
95+
demand(vault.availability().mode==='protected'&&(await vault.read())?.marker==='SYNTHETIC','RETRY_NOT_RECOVERED');
96+
await vault.clear();
97+
});
98+
await check('signed-out-cli-storage-doctor',async()=>{
99+
const env={...process.env,KODER_CLI_HOME:path.join(base,'doctor cli'),KODER_AUTO_UPDATE:'0',KODER_REMOTE_RESOURCES:'0',KODER_NO_ONBOARD:'1',NO_COLOR:'1'};
100+
const cli=path.join(root,'bin/koder.mjs');
101+
const accepted=spawnSync(process.execPath,[cli,'eula','accept'],{env,timeout:20000,windowsHide:true,maxBuffer:32768});
102+
demand(!accepted.error&&accepted.status===0,'DOCTOR_EULA_SETUP_FAILED');
103+
const result=spawnSync(process.execPath,[cli,'account','doctor','--json'],{env,timeout:30000,windowsHide:true,maxBuffer:32768});
104+
demand(!result.error&&result.status===0,'DOCTOR_CLI_FAILED');
105+
const data=JSON.parse(result.stdout.toString('utf8'));
106+
demand(data.state==='ready'&&data.remoteChecksPerformed===false,'DOCTOR_CLI_NOT_READY');
107+
});
108+
}
86109
}finally{fs.rmSync(base,{recursive:true,force:true});}
87110
receipt.state=receipt.checks.every(x=>x.state==='PASS')?'PASS':'FAIL';
88111
fs.mkdirSync('evidence',{recursive:true});

0 commit comments

Comments
 (0)