Repository navigation
Add scoped API keys and native document SDK access - #198
Draft
canvascoding wants to merge 39 commits into
Draft
canvascoding wants to merge 39 commits into
canvascoding wants to merge 39 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
External programs currently have to use browser sessions or OAuth for document access. This draft adds user-owned API integrations with explicit workspace/action grants and connects supported operations to the existing native document services.
Implemented behavior:
Validation of the current single-snapshot path-status increment (f80b4ec):
Baseline main integration validation (a6a261b):
Existing adapter/SDK acceptance:
Remaining before this draft is ready to merge:
Review Center and Undo remain outside the requested work. This API-key feature is not released or deployed. Full scope and evidence boundaries: docs/document-write-database-performance-plan.md.
CodeQL provenance audit
Alert 272 at the previous product commit flagged a synthetic external-link preservation test using substring matching. The current test walks the actual rich-text document and compares the complete href exactly. The test does not authorize URLs; the assertion is strengthened without suppressing or dismissing the rule. The preceding cfb3949 analysis completed with no open findings and the original alert instance is marked fixed. This new head still requires its own CI result.
The Python findings 257 and 258 were individually audited as false positives at
1cf2c3187098f726df8146a3ea1382a354233587; the new head requires its own CI result. The downloaded SARIF traces start at the return value ofapi_key_attribution()(helper line 540), propagate throughsourceAttribution, and reach the immutable-intent SHA256 digest and the helper reply. That return value is a strict creation-provenance DTO, not an API credential or password.The genuine principal supplies nonsecret identity fields. The strict TypeScript/Python origin and source contracts exclude a raw key, password, secret hash and download URL. The real native Create test explicitly requires that the actual issued full key never occurs in the Birth intent. SHA256 is the existing file/intent integrity fingerprint. The subprocess transport uses private stdin/stdout pipes consumed by Node, not an application/public log. No scanner rule/workflow, integrity algorithm or original audit field is removed.
JavaScript findings, checked individually
The final JavaScript SARIF for this exact head was also downloaded and traced. The CodeQL query concerns password guessing resistance; the reported SHA256 sinks here have the following purposes:
crypto.randomBytes(32)inissueApiKeySecret(), then parsed/verified as a canonical 43-character base64url tokenFor 261 specifically, management accepts no caller-chosen key/secret; creation and rotation both use the server CSPRNG issuer. Only the secret hash is stored, verification uses
timingSafeEqual, and this helper is not used for Better Auth user passwords. The native management/authentication and regular secret tests verify actual 32-byte issuance, strict parsing, wrong-secret rejection, rotation/revocation and instance isolation. Using a password KDF for the unrelated document, lock and operation fingerprints would change existing persisted identities rather than fix a password flaw. These findings are individually documented as false positives; no query, rule, language scan or workflow is disabled.Copy principal CodeQL audit at b65ac0c
The JavaScript SARIF from analysis
2070376564was traced for each new finding atb65ac0cefe00329c8cc6017b069b0fc7a1588f47. The heuristic treats generic principal callback returns as password sources, even when their actual result is domain observation data.sourceWorkspace.workspaceIdinto the existing asset namespace hash atreadonly-assets.ts:88/168header.requestHashinto the canonical Copy completion object{canonicalRequestHash, planId, stageDigest}JSON.stringify([identity.userId, identity.integrationId, identity.instanceId])in the stable audit actorFor 267, the OAuth-origin fixture trace reaches only
actor.userId. The real key phase exposes current workspace/identity metadata and bounded assertions; it returns no reusable credential material. Current native Copy and provenance regressions cover actual rotation, scoped roles, original receipts, null Session attribution and protected source rows/bytes. These three exact findings are documented as false positives. No rule, query, language scan, authentication behavior or persisted hash algorithm is disabled or altered.Path claim CodeQL audit at 3ce83fa
The JavaScript SARIF from analysis
2070776319was traced individually for all four new findings at3ce83fa8f601f589a6b1dfa88afb1bbcc9524654(ten actual trace paths). The reported SHA256 sinks do not store or verify passwords.The actual stored key-job contract has fourteen own data fields and no raw key/token/password. Key claim tests explicitly require that the issued full key is absent from persisted authorization JSON. The fixed error constructor accepts only three controlled authorization error codes. No scanner, query, rule, workflow, password handling or persisted integrity hash is disabled or changed by this classification. The current head still requires its complete CI/review result.
Pure path status CodeQL audit at d63a310
The exact-head JavaScript SARIF from analysis 2071390194 was checked for both new findings (eight data-flow traces). Every trace begins at the synthetic accessor test in api-key-native-path-owner-postgres-test.ts:373. That object contains a fake status holder with principal: {} and no API key/password; it has no expectedPlan field. The actual reader inspects the own property descriptor and rejects its accessor before reading expectedPlan, invoking the getter, opening SQL or reaching native evidence parsing. The successful actual PostgreSQL boundary test requires zero queries and touched === false.
These two exact findings are resolved individually as false positives. No rule/query/workflow, native integrity hash, descriptor guard or negative test is removed or weakened.