feat: dsh-geek2api 0.1.0, a Geek2API route for DeepSeek Harness
Derived from dsh-packycode-api 1.1.7 (MIT) and rebuilt for the Geek2API (sub2api) gateway: multi-endpoint failover, /v1/usage balances with wallet dedupe, per-key coverage from /v1/models, sub2api failure wording, a Claude runtime switch (HTTP or local CLI), and Claude/GPT web search backends. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
commit
ed5154c042
94 files changed
+28617
No files matched your search
@@ -0,0 +1,41 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import test from 'node:test'
|
||||
import { createDeltaRedactor, redactSecrets } from '../src/secret-redactor.js'
|
||||
|
||||
test('redaction covers raw and JSON-escaped quote/backslash keys', () => {
|
||||
const key = 'sk-private-"quoted"-\\backslash'
|
||||
assert.equal(redactSecrets(`value ${key}`, [key]), 'value [redacted]')
|
||||
const serialized = redactSecrets(JSON.stringify({ summary: `echo ${key}`, title: key }), [key])
|
||||
assert.deepEqual(JSON.parse(serialized), { summary: 'echo [redacted]', title: '[redacted]' })
|
||||
})
|
||||
|
||||
test('every possible delta split of a secret and its escaped form redacts before emission', () => {
|
||||
const key = 'sk-private-"quoted"-\\backslash'
|
||||
for (const value of [key, JSON.stringify(key).slice(1, -1)]) {
|
||||
for (let split = 1; split < value.length; split++) {
|
||||
const redactor = createDeltaRedactor([key])
|
||||
const result = redactor.write(`说明 ${value.slice(0, split)}`) + redactor.write(`${value.slice(split)} done`) + redactor.flush()
|
||||
assert.equal(result, '说明 [redacted] done')
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
test('character-by-character credentials/capabilities and block-boundary prefixes cannot reconstruct a secret', () => {
|
||||
const key = 'sk-test-only-streamed-secret'
|
||||
const cap = 'deadbeef1234567890abcdef'
|
||||
const redactor = createDeltaRedactor([key, cap])
|
||||
let result = ''
|
||||
for (const char of `one ${key} two ${cap}.`) result += redactor.write(char)
|
||||
result += redactor.flush()
|
||||
assert.equal(result, 'one [redacted] two [redacted].')
|
||||
const boundary = createDeltaRedactor([key])
|
||||
const across = boundary.write(key.slice(0, 5)) + boundary.flush({ boundary: true }) + boundary.write(key.slice(5)) + boundary.flush()
|
||||
assert.equal(across.includes(key), false)
|
||||
})
|
||||
|
||||
test('ordinary streaming text and incomplete end-of-output prefixes remain unchanged', () => {
|
||||
const redactor = createDeltaRedactor(['sk-sensitive-value'])
|
||||
const input = ['你好 ', 'plain ', 'source', 's']
|
||||
const output = input.map(s => redactor.write(s)).join('') + redactor.flush()
|
||||
assert.equal(output, input.join(''))
|
||||
})
|
||||
Reference in new issue
Block a user