@pulsehub/runner 0.1.7 → 0.1.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pulsehub/runner",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Local, credential-safe Pulse Runner",
5
5
  "repository": {
6
6
  "type": "git",
package/src/qa-source.py CHANGED
@@ -13,7 +13,7 @@ import zipfile
13
13
  def call(body):
14
14
  request = urllib.request.Request(os.environ['PULSE_QA_SOURCE_URL'],
15
15
  data=json.dumps(body).encode(), headers={
16
- 'Authorization': 'Bearer ' + os.environ['PULSE_QA_CREDENTIAL'],
16
+ 'X-Pulse-QA-Credential': os.environ['PULSE_QA_CREDENTIAL'],
17
17
  'Content-Type': 'application/json'})
18
18
  try:
19
19
  with urllib.request.urlopen(request, timeout=540) as response:
@@ -34,6 +34,31 @@ with tempfile.TemporaryDirectory() as root:
34
34
  assert.equal(result.code, 0, result.output);
35
35
  });
36
36
 
37
+ test('Runner sends its QA application credential outside the Authorization header', async () => {
38
+ const script = `
39
+ import importlib.util,os
40
+ from pathlib import Path
41
+ spec=importlib.util.spec_from_file_location('qa_source',os.environ['QA_SCRIPT'])
42
+ m=importlib.util.module_from_spec(spec);spec.loader.exec_module(m)
43
+ seen=[]
44
+ class Response:
45
+ def __enter__(self): return self
46
+ def __exit__(self,*args): pass
47
+ def read(self,size): return b'{}'
48
+ def fake(request,timeout):
49
+ seen.append({k.lower():v for k,v in request.header_items()})
50
+ return Response()
51
+ m.urllib.request.urlopen=fake
52
+ os.environ['PULSE_QA_SOURCE_URL']='https://example.invalid/pulseQaSource'
53
+ os.environ['PULSE_QA_CREDENTIAL']='fixture-only'
54
+ m.call({'identifier':'TES-fixture'})
55
+ assert seen[0]['x-pulse-qa-credential']=='fixture-only'
56
+ assert 'authorization' not in seen[0]
57
+ `;
58
+ const result = await command('python3', ['-c', script], { env: { ...process.env, PYTHONDONTWRITEBYTECODE: '1', QA_SCRIPT: fileURLToPath(new URL('../src/qa-source.py', import.meta.url)) } });
59
+ assert.equal(result.code, 0, result.output);
60
+ });
61
+
37
62
  test('both local QA identities use provider readiness independently of global Git credentials', () => {
38
63
  for (const kind of ['codex','claude']) {
39
64
  const config = { identities: [{ agentId: kind, kind, role: 'qa' }] };