@akasecurity/ai-tc-codex 0.9.23 → 0.9.24
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/.codex-plugin/plugin.json +1 -1
- package/package.json +1 -1
- package/scripts/apply-suppressions.js +60 -19
- package/scripts/backfill.js +83 -24
- package/scripts/content-retention.js +60 -19
- package/scripts/filescan.js +94 -36
- package/scripts/firstrun.js +74 -32
- package/scripts/history-sync.js +60 -19
- package/scripts/intro.js +32 -6
- package/scripts/onboard.js +60 -19
- package/scripts/post-tool-use.js +97 -38
- package/scripts/pre-tool-use.js +97 -38
- package/scripts/query.js +73 -31
- package/scripts/reconcile.js +95 -36
- package/scripts/remediate.js +80 -21
- package/scripts/scan-worker.js +32 -6
- package/scripts/session-start.js +134 -72
- package/scripts/start-light.js +32 -6
- package/scripts/stop.js +78 -36
- package/scripts/sync.js +96 -38
- package/scripts/user-prompt-submit.js +103 -44
package/scripts/pre-tool-use.js
CHANGED
|
@@ -8777,7 +8777,11 @@ var ListFindingTypesQuery = object({
|
|
|
8777
8777
|
// and so is not bounded by what any page happens to hold.
|
|
8778
8778
|
includeId: string2().optional(),
|
|
8779
8779
|
limit: coerce_exports.number().int().min(1).max(MAX_FINDING_TYPES_LIMIT).optional(),
|
|
8780
|
-
cursor: string2().optional()
|
|
8780
|
+
cursor: string2().optional(),
|
|
8781
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
8782
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
8783
|
+
// from wherever it lands.
|
|
8784
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
8781
8785
|
});
|
|
8782
8786
|
var ListFindingTypesResponse = object({
|
|
8783
8787
|
totals: object({
|
|
@@ -8858,7 +8862,11 @@ var ListFindingInstancesQuery = object({
|
|
|
8858
8862
|
sessionId: string2().optional(),
|
|
8859
8863
|
from: iso_exports.datetime().optional(),
|
|
8860
8864
|
limit: coerce_exports.number().int().min(1).max(MAX_FLAT_FINDINGS_LIMIT).optional(),
|
|
8861
|
-
cursor: string2().optional()
|
|
8865
|
+
cursor: string2().optional(),
|
|
8866
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
8867
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
8868
|
+
// from wherever it lands.
|
|
8869
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
8862
8870
|
});
|
|
8863
8871
|
var ListFindingInstancesResponse = object({
|
|
8864
8872
|
// Instances matching the filters across the whole scope, not just this
|
|
@@ -8930,7 +8938,11 @@ var ListFindingLocationsQuery = object({
|
|
|
8930
8938
|
// rather than a deep-link corner. Never affects totals, facets or the cursor.
|
|
8931
8939
|
includeId: string2().optional(),
|
|
8932
8940
|
limit: coerce_exports.number().int().min(1).max(MAX_FINDING_LOCATIONS_LIMIT).optional(),
|
|
8933
|
-
cursor: string2().optional()
|
|
8941
|
+
cursor: string2().optional(),
|
|
8942
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
8943
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
8944
|
+
// from wherever it lands.
|
|
8945
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
8934
8946
|
});
|
|
8935
8947
|
var ListFindingLocationsResponse = object({
|
|
8936
8948
|
totals: object({
|
|
@@ -11567,7 +11579,11 @@ var MAX_VAULT_PAGE_LIMIT = 200;
|
|
|
11567
11579
|
var ListVaultInventoryQuery = object({
|
|
11568
11580
|
limit: coerce_exports.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
|
|
11569
11581
|
// Opaque; names the last row of the page just served.
|
|
11570
|
-
cursor: string2().optional()
|
|
11582
|
+
cursor: string2().optional(),
|
|
11583
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
11584
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
11585
|
+
// from wherever it lands.
|
|
11586
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
11571
11587
|
});
|
|
11572
11588
|
var ListVaultInventoryResponse = object({
|
|
11573
11589
|
// Vaulted values across the whole store, not just this page — cursor-
|
|
@@ -11579,7 +11595,11 @@ var ListVaultInventoryResponse = object({
|
|
|
11579
11595
|
});
|
|
11580
11596
|
var ListVaultReuseQuery = object({
|
|
11581
11597
|
limit: coerce_exports.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
|
|
11582
|
-
cursor: string2().optional()
|
|
11598
|
+
cursor: string2().optional(),
|
|
11599
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
11600
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
11601
|
+
// from wherever it lands.
|
|
11602
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
11583
11603
|
});
|
|
11584
11604
|
var ListVaultReuseResponse = object({
|
|
11585
11605
|
// Reused values across the whole store — the number the section's claim
|
|
@@ -11595,9 +11615,15 @@ var ListVaultDerefsQuery = object({
|
|
|
11595
11615
|
// over a Server Action, which preserves the type, never as a URL param.
|
|
11596
11616
|
includeBatched: boolean2().optional(),
|
|
11597
11617
|
limit: coerce_exports.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
|
|
11598
|
-
cursor: string2().optional()
|
|
11618
|
+
cursor: string2().optional(),
|
|
11619
|
+
// A row position to read from, for jumping to a page instead of stepping to
|
|
11620
|
+
// it. Takes precedence over `cursor`, and the page's `nextCursor` carries on
|
|
11621
|
+
// from wherever it lands.
|
|
11622
|
+
offset: coerce_exports.number().int().min(0).optional()
|
|
11599
11623
|
});
|
|
11600
11624
|
var ListVaultDerefsResponse = object({
|
|
11625
|
+
// Rows this filter selects across the whole trail, not just this page.
|
|
11626
|
+
totals: object({ derefs: number2().int().nonnegative() }),
|
|
11601
11627
|
items: array(VaultDeref),
|
|
11602
11628
|
nextCursor: string2().nullable(),
|
|
11603
11629
|
// Display/view-render rows the query hid, over the WHOLE trail rather than
|
|
@@ -25185,7 +25211,7 @@ var SqliteFindingsRepository = class {
|
|
|
25185
25211
|
};
|
|
25186
25212
|
const limit = query.limit ?? DEFAULT_FINDING_TYPES_LIMIT;
|
|
25187
25213
|
const cursor = query.cursor === void 0 ? null : decodeGroupCursor(query.cursor);
|
|
25188
|
-
const start = cursor === null ? 0 : firstAfter(sorted, cursor);
|
|
25214
|
+
const start = query.offset ?? (cursor === null ? 0 : firstAfter(sorted, cursor));
|
|
25189
25215
|
const page = sorted.slice(start, start + limit);
|
|
25190
25216
|
const lastOnPage = page.at(-1);
|
|
25191
25217
|
const nextCursor = start + limit < sorted.length && lastOnPage ? encodeGroupCursor(lastOnPage) : null;
|
|
@@ -25279,7 +25305,7 @@ var SqliteFindingsRepository = class {
|
|
|
25279
25305
|
accumulator.add(row);
|
|
25280
25306
|
if (!matchesInstanceFilters(row, opts)) continue;
|
|
25281
25307
|
total += 1;
|
|
25282
|
-
if (!isPastCursor(row)) continue;
|
|
25308
|
+
if (query.offset === void 0 ? !isPastCursor(row) : total <= query.offset) continue;
|
|
25283
25309
|
if (items.length < limit) {
|
|
25284
25310
|
items.push(toInstanceDetail(row));
|
|
25285
25311
|
last = row;
|
|
@@ -25368,7 +25394,7 @@ var SqliteFindingsRepository = class {
|
|
|
25368
25394
|
}
|
|
25369
25395
|
}
|
|
25370
25396
|
sorted.sort(compareLocationOrder);
|
|
25371
|
-
const start = cursor === null ? 0 : firstLocationAfter(sorted, cursor);
|
|
25397
|
+
const start = query.offset ?? (cursor === null ? 0 : firstLocationAfter(sorted, cursor));
|
|
25372
25398
|
const page = sorted.slice(start, start + limit);
|
|
25373
25399
|
const lastOnPage = page.at(-1);
|
|
25374
25400
|
const nextCursor = start + limit < sorted.length && lastOnPage ? encodeLocationCursor(lastOnPage) : null;
|
|
@@ -27996,6 +28022,9 @@ function pageLimit(requested, fallback) {
|
|
|
27996
28022
|
if (requested === void 0) return fallback;
|
|
27997
28023
|
return Math.min(Math.max(1, Math.trunc(requested)), MAX_VAULT_PAGE_LIMIT);
|
|
27998
28024
|
}
|
|
28025
|
+
function pageOffset(requested) {
|
|
28026
|
+
return requested === void 0 ? 0 : Math.max(0, Math.trunc(requested));
|
|
28027
|
+
}
|
|
27999
28028
|
function encodeReuseCursor(payload) {
|
|
28000
28029
|
return Buffer.from(JSON.stringify(payload)).toString("base64url");
|
|
28001
28030
|
}
|
|
@@ -28343,7 +28372,8 @@ var SqliteSecretVaultRepository = class {
|
|
|
28343
28372
|
*/
|
|
28344
28373
|
listInventory(query = {}, now = Date.now()) {
|
|
28345
28374
|
const limit = pageLimit(query.limit, DEFAULT_VAULT_INVENTORY_LIMIT);
|
|
28346
|
-
const
|
|
28375
|
+
const offset = pageOffset(query.offset);
|
|
28376
|
+
const cursor = query.cursor === void 0 || query.offset !== void 0 ? null : decodeKeysetCursor(query.cursor);
|
|
28347
28377
|
const where = cursor === null ? "" : "WHERE (v.last_seen < :cursorLastSeen OR (v.last_seen = :cursorLastSeen AND v.pointer_id < :cursorPointerId))";
|
|
28348
28378
|
const rows = allRows(
|
|
28349
28379
|
this.db.prepare(
|
|
@@ -28357,11 +28387,12 @@ var SqliteSecretVaultRepository = class {
|
|
|
28357
28387
|
FROM secret_vault v
|
|
28358
28388
|
${where}
|
|
28359
28389
|
ORDER BY v.last_seen DESC, v.pointer_id DESC
|
|
28360
|
-
LIMIT :limit`
|
|
28390
|
+
LIMIT :limit OFFSET :offset`
|
|
28361
28391
|
),
|
|
28362
28392
|
bindParams({
|
|
28363
28393
|
now,
|
|
28364
28394
|
limit: limit + 1,
|
|
28395
|
+
offset,
|
|
28365
28396
|
...cursor === null ? {} : { cursorLastSeen: cursor.startedAtMs, cursorPointerId: cursor.id }
|
|
28366
28397
|
})
|
|
28367
28398
|
);
|
|
@@ -28385,7 +28416,8 @@ var SqliteSecretVaultRepository = class {
|
|
|
28385
28416
|
*/
|
|
28386
28417
|
listReuse(query = {}, now = Date.now()) {
|
|
28387
28418
|
const limit = pageLimit(query.limit, DEFAULT_VAULT_INVENTORY_LIMIT);
|
|
28388
|
-
const
|
|
28419
|
+
const offset = pageOffset(query.offset);
|
|
28420
|
+
const cursor = query.cursor === void 0 || query.offset !== void 0 ? null : decodeReuseCursor(query.cursor);
|
|
28389
28421
|
const after = cursor === null ? "" : `AND (v.occurrence_count < :cursorOccurrences
|
|
28390
28422
|
OR (v.occurrence_count = :cursorOccurrences AND v.pointer_id < :cursorPointerId))`;
|
|
28391
28423
|
const rows = allRows(
|
|
@@ -28400,11 +28432,12 @@ var SqliteSecretVaultRepository = class {
|
|
|
28400
28432
|
FROM secret_vault v
|
|
28401
28433
|
WHERE ${REUSED_PREDICATE} ${after}
|
|
28402
28434
|
ORDER BY v.occurrence_count DESC, v.pointer_id DESC
|
|
28403
|
-
LIMIT :limit`
|
|
28435
|
+
LIMIT :limit OFFSET :offset`
|
|
28404
28436
|
),
|
|
28405
28437
|
bindParams({
|
|
28406
28438
|
now,
|
|
28407
28439
|
limit: limit + 1,
|
|
28440
|
+
offset,
|
|
28408
28441
|
...cursor === null ? {} : { cursorOccurrences: cursor.occurrences, cursorPointerId: cursor.pointerId }
|
|
28409
28442
|
})
|
|
28410
28443
|
);
|
|
@@ -28429,7 +28462,8 @@ var SqliteSecretVaultRepository = class {
|
|
|
28429
28462
|
*/
|
|
28430
28463
|
listDerefs(query = {}) {
|
|
28431
28464
|
const limit = pageLimit(query.limit, DEFAULT_VAULT_DEREFS_LIMIT);
|
|
28432
|
-
const
|
|
28465
|
+
const offset = pageOffset(query.offset);
|
|
28466
|
+
const cursor = query.cursor === void 0 || query.offset !== void 0 ? null : decodeKeysetCursor(query.cursor);
|
|
28433
28467
|
const conditions = [];
|
|
28434
28468
|
if (query.includeBatched !== true) {
|
|
28435
28469
|
conditions.push(`reason NOT IN ('display', 'view-render')`);
|
|
@@ -28442,21 +28476,28 @@ var SqliteSecretVaultRepository = class {
|
|
|
28442
28476
|
this.db.prepare(
|
|
28443
28477
|
`SELECT id, pointer_id, at, target, reason, outcome, grant_id, pointer_count
|
|
28444
28478
|
FROM secret_vault_deref ${where}
|
|
28445
|
-
ORDER BY at DESC, id DESC LIMIT :limit`
|
|
28479
|
+
ORDER BY at DESC, id DESC LIMIT :limit OFFSET :offset`
|
|
28446
28480
|
),
|
|
28447
28481
|
bindParams({
|
|
28448
28482
|
limit: limit + 1,
|
|
28483
|
+
offset,
|
|
28449
28484
|
...cursor === null ? {} : { cursorAt: cursor.startedAtMs, cursorId: cursor.id }
|
|
28450
28485
|
})
|
|
28451
28486
|
);
|
|
28452
28487
|
const hasMore = rows.length > limit;
|
|
28453
28488
|
const page = hasMore ? rows.slice(0, limit) : rows;
|
|
28454
28489
|
const last = page[page.length - 1];
|
|
28455
|
-
const
|
|
28456
|
-
this.db
|
|
28457
|
-
|
|
28458
|
-
|
|
28490
|
+
const counts = getRow(
|
|
28491
|
+
this.db.prepare(
|
|
28492
|
+
`SELECT count(*) AS total,
|
|
28493
|
+
count(*) FILTER (WHERE reason IN ('display', 'view-render')) AS hidden
|
|
28494
|
+
FROM secret_vault_deref`
|
|
28495
|
+
)
|
|
28496
|
+
) ?? { total: 0, hidden: 0 };
|
|
28497
|
+
const includeBatched = query.includeBatched === true;
|
|
28498
|
+
const hiddenBatched = includeBatched ? 0 : counts.hidden;
|
|
28459
28499
|
return {
|
|
28500
|
+
totals: { derefs: includeBatched ? counts.total : counts.total - counts.hidden },
|
|
28460
28501
|
items: page.map((r) => ({
|
|
28461
28502
|
id: r.id,
|
|
28462
28503
|
pointerId: r.pointer_id,
|
|
@@ -30924,8 +30965,25 @@ function bundledMaskingRules() {
|
|
|
30924
30965
|
return ensureBundledPacks() ? getLoadedRules() : null;
|
|
30925
30966
|
}
|
|
30926
30967
|
|
|
30968
|
+
// ../../packages/plugin-sdk/src/regular-file.ts
|
|
30969
|
+
import { closeSync as closeSync2, constants, fstatSync, openSync as openSync2, readFileSync as readFileSync16 } from "fs";
|
|
30970
|
+
function notRegularFile(path) {
|
|
30971
|
+
return `not a regular file: ${path}`;
|
|
30972
|
+
}
|
|
30973
|
+
function readRegularFile(path, maxBytes) {
|
|
30974
|
+
const fd = openSync2(path, constants.O_RDONLY | constants.O_NONBLOCK);
|
|
30975
|
+
try {
|
|
30976
|
+
const stat2 = fstatSync(fd);
|
|
30977
|
+
if (!stat2.isFile()) throw new Error(notRegularFile(path));
|
|
30978
|
+
if (maxBytes !== void 0 && stat2.size > maxBytes) throw new Error(`file too large: ${path}`);
|
|
30979
|
+
return readFileSync16(fd, "utf8");
|
|
30980
|
+
} finally {
|
|
30981
|
+
closeSync2(fd);
|
|
30982
|
+
}
|
|
30983
|
+
}
|
|
30984
|
+
|
|
30927
30985
|
// ../../packages/plugin-sdk/src/repo.ts
|
|
30928
|
-
import { existsSync as existsSync9,
|
|
30986
|
+
import { existsSync as existsSync9, statSync as statSync7 } from "fs";
|
|
30929
30987
|
import { basename as basename2, dirname as dirname5, isAbsolute as isAbsolute3, join as join24, sep as sep4 } from "path";
|
|
30930
30988
|
function remoteWithoutCredentials(remote) {
|
|
30931
30989
|
const withoutInfo = withoutUserinfo(remote);
|
|
@@ -31014,9 +31072,10 @@ function resolveGitContext(root) {
|
|
|
31014
31072
|
const headRoot = basename2(commonGitDir) === ".git" ? dirname5(commonGitDir) : root;
|
|
31015
31073
|
return { configPath: join24(commonGitDir, "config"), headRoot };
|
|
31016
31074
|
}
|
|
31075
|
+
var MAX_GIT_METADATA_BYTES = 1024 * 1024;
|
|
31017
31076
|
function safeRead(path) {
|
|
31018
31077
|
try {
|
|
31019
|
-
return
|
|
31078
|
+
return readRegularFile(path, MAX_GIT_METADATA_BYTES);
|
|
31020
31079
|
} catch {
|
|
31021
31080
|
return void 0;
|
|
31022
31081
|
}
|
|
@@ -35651,21 +35710,21 @@ function resolveCodexHome(env, home = homedir3()) {
|
|
|
35651
35710
|
|
|
35652
35711
|
// ../../packages/plugin-sdk/src/account/observation-log.ts
|
|
35653
35712
|
import { createHash as createHash13 } from "crypto";
|
|
35654
|
-
import { closeSync as
|
|
35713
|
+
import { closeSync as closeSync3, constants as constants2, fstatSync as fstatSync2, mkdirSync as mkdirSync2, openSync as openSync3, readSync, writeSync } from "fs";
|
|
35655
35714
|
import { join as join35 } from "path";
|
|
35656
35715
|
var SESSION_LOG_CAP_BYTES = 16 * 1024 * 1024;
|
|
35657
35716
|
var SESSION_LOG_TAIL_BYTES = 64 * 1024;
|
|
35658
35717
|
var NEWLINE = 10;
|
|
35659
35718
|
var SAFE_SESSION_ID = /^[A-Za-z0-9._-]+$/;
|
|
35660
35719
|
function sessionLogOpenFlags(noFollow) {
|
|
35661
|
-
return
|
|
35720
|
+
return constants2.O_WRONLY | constants2.O_APPEND | constants2.O_CREAT | (noFollow ?? 0);
|
|
35662
35721
|
}
|
|
35663
35722
|
var SESSION_LOG_OPEN_FLAGS = sessionLogOpenFlags(
|
|
35664
|
-
|
|
35723
|
+
constants2.O_NOFOLLOW
|
|
35665
35724
|
);
|
|
35666
35725
|
function closeQuietly2(fd) {
|
|
35667
35726
|
try {
|
|
35668
|
-
|
|
35727
|
+
closeSync3(fd);
|
|
35669
35728
|
} catch {
|
|
35670
35729
|
}
|
|
35671
35730
|
}
|
|
@@ -35688,8 +35747,8 @@ function appendObservation(stateDir, sessionId, observation, capBytes = SESSION_
|
|
|
35688
35747
|
let fd;
|
|
35689
35748
|
try {
|
|
35690
35749
|
mkdirSync2(stateDir, { recursive: true, mode: DATA_DIR_MODE });
|
|
35691
|
-
fd =
|
|
35692
|
-
if (
|
|
35750
|
+
fd = openSync3(sessionLogPath(stateDir, sessionId), openFlags, DATA_FILE_MODE);
|
|
35751
|
+
if (fstatSync2(fd).size + Buffer.byteLength(line) > capBytes) return false;
|
|
35693
35752
|
writeSync(fd, line);
|
|
35694
35753
|
return true;
|
|
35695
35754
|
} catch {
|
|
@@ -35719,12 +35778,12 @@ function parseLines(buffer, base) {
|
|
|
35719
35778
|
function readRange(path, from, capBytes) {
|
|
35720
35779
|
let fd;
|
|
35721
35780
|
try {
|
|
35722
|
-
fd =
|
|
35781
|
+
fd = openSync3(path, "r");
|
|
35723
35782
|
} catch {
|
|
35724
35783
|
return void 0;
|
|
35725
35784
|
}
|
|
35726
35785
|
try {
|
|
35727
|
-
const size =
|
|
35786
|
+
const size = fstatSync2(fd).size;
|
|
35728
35787
|
const length = Math.max(0, Math.min(size, capBytes) - from);
|
|
35729
35788
|
const buffer = Buffer.alloc(length);
|
|
35730
35789
|
let filled = 0;
|
|
@@ -35771,7 +35830,7 @@ function classifyObservation(observation) {
|
|
|
35771
35830
|
}
|
|
35772
35831
|
|
|
35773
35832
|
// ../../packages/plugin-sdk/src/account/codex-head.ts
|
|
35774
|
-
import { closeSync as
|
|
35833
|
+
import { closeSync as closeSync4, openSync as openSync4, readSync as readSync2 } from "fs";
|
|
35775
35834
|
var CODEX_HEAD_READ_BYTES = 64 * 1024;
|
|
35776
35835
|
var CODEX_HEAD_MAX_BYTES = 1024 * 1024;
|
|
35777
35836
|
var NEWLINE2 = 10;
|
|
@@ -35804,7 +35863,7 @@ function parseHead(line) {
|
|
|
35804
35863
|
function readCodexHead(rolloutPath) {
|
|
35805
35864
|
let fd;
|
|
35806
35865
|
try {
|
|
35807
|
-
fd =
|
|
35866
|
+
fd = openSync4(rolloutPath, "r");
|
|
35808
35867
|
} catch (error2) {
|
|
35809
35868
|
return isNotFound(error2) ? "pending" : void 0;
|
|
35810
35869
|
}
|
|
@@ -35829,14 +35888,14 @@ function readCodexHead(rolloutPath) {
|
|
|
35829
35888
|
return void 0;
|
|
35830
35889
|
} finally {
|
|
35831
35890
|
try {
|
|
35832
|
-
|
|
35891
|
+
closeSync4(fd);
|
|
35833
35892
|
} catch {
|
|
35834
35893
|
}
|
|
35835
35894
|
}
|
|
35836
35895
|
}
|
|
35837
35896
|
|
|
35838
35897
|
// ../../packages/plugin-sdk/src/account/codex-login.ts
|
|
35839
|
-
import { closeSync as
|
|
35898
|
+
import { closeSync as closeSync5, constants as constants3, fstatSync as fstatSync3, lstatSync as lstatSync6, openSync as openSync5, readSync as readSync3 } from "fs";
|
|
35840
35899
|
import { join as join36 } from "path";
|
|
35841
35900
|
var CODEX_AUTH_MAX_BYTES = 64 * 1024;
|
|
35842
35901
|
var CODEX_ID_TOKEN_MAX_CHARS = 16 * 1024;
|
|
@@ -35869,8 +35928,8 @@ var DROPPED = new Set(CODEX_DROPPED_FIELDS);
|
|
|
35869
35928
|
var PRESENCE = new Set(CODEX_PRESENCE_FIELDS);
|
|
35870
35929
|
var BASE64URL = /^[A-Za-z0-9_-]+$/;
|
|
35871
35930
|
var UUID3 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
35872
|
-
var NOFOLLOW =
|
|
35873
|
-
var READ_FLAGS =
|
|
35931
|
+
var NOFOLLOW = constants3.O_NOFOLLOW ?? 0;
|
|
35932
|
+
var READ_FLAGS = constants3.O_RDONLY | NOFOLLOW;
|
|
35874
35933
|
var ABSENT = { status: "absent" };
|
|
35875
35934
|
var MODE = { status: "mode" };
|
|
35876
35935
|
var MALFORMED = { status: "malformed" };
|
|
@@ -35992,12 +36051,12 @@ function inspectCodexLogin(codexHome, attachedUserDigest, platform = process.pla
|
|
|
35992
36051
|
let fd;
|
|
35993
36052
|
try {
|
|
35994
36053
|
if (platform === "win32" && lstatSync6(path).isSymbolicLink()) return MALFORMED;
|
|
35995
|
-
fd =
|
|
36054
|
+
fd = openSync5(path, openFlags);
|
|
35996
36055
|
} catch (error2) {
|
|
35997
36056
|
return isNotFound2(error2) ? ABSENT : MALFORMED;
|
|
35998
36057
|
}
|
|
35999
36058
|
try {
|
|
36000
|
-
const stat2 =
|
|
36059
|
+
const stat2 = fstatSync3(fd);
|
|
36001
36060
|
if (!stat2.isFile() || stat2.size > CODEX_AUTH_MAX_BYTES) return MALFORMED;
|
|
36002
36061
|
if (platform !== "win32" && (stat2.uid !== process.getuid?.() || (stat2.mode & 18) !== 0)) {
|
|
36003
36062
|
return MALFORMED;
|
|
@@ -36009,7 +36068,7 @@ function inspectCodexLogin(codexHome, attachedUserDigest, platform = process.pla
|
|
|
36009
36068
|
return MALFORMED;
|
|
36010
36069
|
} finally {
|
|
36011
36070
|
try {
|
|
36012
|
-
|
|
36071
|
+
closeSync5(fd);
|
|
36013
36072
|
} catch {
|
|
36014
36073
|
}
|
|
36015
36074
|
}
|