@theokit/sdk 4.44.1 → 4.45.0
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/CHANGELOG.md +22 -0
- package/dist/index.cjs +34 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +59 -1
- package/dist/index.d.ts +59 -1
- package/dist/index.js +34 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 4.45.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- f9a29f5: `applySecurityFloor` — a lower-trust configuration layer may tighten a security setting, never loosen it.
|
|
8
|
+
|
|
9
|
+
Layered configuration usually resolves last-wins, and for the keys that decide confinement that is a
|
|
10
|
+
hole: a project layer outranks the user's own file, so a cloned repository can hand itself the most
|
|
11
|
+
permissive sandbox and the operator's global choice loses silently, at the moment the directory is
|
|
12
|
+
opened. Nothing fails; the confinement is simply gone.
|
|
13
|
+
|
|
14
|
+
The rule is generic and the vocabulary is not, so the vocabulary is parameters: which values count
|
|
15
|
+
as more permissive, which layers are restricted, and which layer is the operator's explicit
|
|
16
|
+
override. A second product supplies its own without inheriting the first's words.
|
|
17
|
+
|
|
18
|
+
The override is returned verbatim even when outside the vocabulary — validating the operator's flag
|
|
19
|
+
is the consumer's job, and silently dropping an unrecognised one is worse than passing it through. A
|
|
20
|
+
value outside the vocabulary in a RESTRICTED layer is ignored instead: a typo in a repository's
|
|
21
|
+
config must neither become the effective setting nor read as maximally permissive.
|
|
22
|
+
|
|
23
|
+
Additive. Nothing calls it yet.
|
|
24
|
+
|
|
3
25
|
## 4.44.1
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -1621,6 +1621,39 @@ var Security = class {
|
|
|
1621
1621
|
}
|
|
1622
1622
|
};
|
|
1623
1623
|
|
|
1624
|
+
// src/security-floor.ts
|
|
1625
|
+
function permissivenessOf(order, value) {
|
|
1626
|
+
if (value === void 0) return -1;
|
|
1627
|
+
return order.indexOf(value);
|
|
1628
|
+
}
|
|
1629
|
+
function baseline(input) {
|
|
1630
|
+
const { restricted, override, layers } = input;
|
|
1631
|
+
let value;
|
|
1632
|
+
for (const [name, candidate] of Object.entries(layers)) {
|
|
1633
|
+
if (name === override || restricted.includes(name)) continue;
|
|
1634
|
+
if (candidate !== void 0) value = candidate;
|
|
1635
|
+
}
|
|
1636
|
+
return value;
|
|
1637
|
+
}
|
|
1638
|
+
function tightenOnly(input, start) {
|
|
1639
|
+
const { permissiveness, restricted, layers } = input;
|
|
1640
|
+
let resolved = start;
|
|
1641
|
+
let ceiling = permissivenessOf(permissiveness, start);
|
|
1642
|
+
for (const layer of restricted) {
|
|
1643
|
+
const candidate = layers[layer];
|
|
1644
|
+
if (candidate === void 0) continue;
|
|
1645
|
+
const level = permissivenessOf(permissiveness, candidate);
|
|
1646
|
+
if (level < 0) continue;
|
|
1647
|
+
if (ceiling >= 0 && level > ceiling) continue;
|
|
1648
|
+
resolved = candidate;
|
|
1649
|
+
ceiling = level;
|
|
1650
|
+
}
|
|
1651
|
+
return resolved;
|
|
1652
|
+
}
|
|
1653
|
+
function applySecurityFloor(input) {
|
|
1654
|
+
return input.layers[input.override] ?? tightenOnly(input, baseline(input));
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1624
1657
|
// src/session-scope.ts
|
|
1625
1658
|
function scopedConversationId(scope, id) {
|
|
1626
1659
|
return `${scope}__${id}`;
|
|
@@ -2267,6 +2300,7 @@ exports.Theokit = Theokit;
|
|
|
2267
2300
|
exports.TokenLimiter = TokenLimiter;
|
|
2268
2301
|
exports.UnicodeNormalizer = UnicodeNormalizer;
|
|
2269
2302
|
exports.applyMode = applyMode;
|
|
2303
|
+
exports.applySecurityFloor = applySecurityFloor;
|
|
2270
2304
|
exports.chargeAndCheckThresholds = chargeAndCheckThresholds;
|
|
2271
2305
|
exports.createCounterBudgetTracker = createCounterBudgetTracker;
|
|
2272
2306
|
exports.estimateTokens = estimateTokens;
|