Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:
name: lcov
path: coverage-reports/lcov.info
retention-days: 1

test-q:
runs-on: ubuntu-latest
steps:
Expand All @@ -66,17 +67,9 @@ jobs:
run: ./qcumber.sh -src test/q/main.q -test test/q/tests
env:
KDB_K4LICENSE_B64: ${{ secrets.KDB_K4LICENSE_B64 }}

q-api:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: node build-api.js
- uses: actions/upload-artifact@v4
with:
name: q-api
path: out/vscode.q

uses: ./.github/workflows/q-api.yml

app-sec:
needs: [test, test-q]
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/q-api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Build q-api

on:
workflow_call:

jobs:
q-api:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.x
- run: node build-api.js
- uses: actions/upload-artifact@v4
with:
name: q-api
path: out/vscode.q
retention-days: 1
21 changes: 14 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ jobs:
path: coverage-reports/lcov.info
retention-days: 1

q-api:
uses: ./.github/workflows/q-api.yml

app-sec:
needs: build
uses: ./.github/workflows/app-sec-template.yml
Expand All @@ -58,16 +61,20 @@ jobs:
uses: actions/download-artifact@v4
with:
name: KDB-VSCode-Extension
- name: Download vscode.q from q-api job
uses: actions/download-artifact@v4
with:
name: q-api
- name: Release to Portal
run: |
NOW=$(date +'%Y%m%dT%H%M%S')
curl -L -s --fail-with-body -D /dev/stderr --oauth2-bearer ${{ secrets.kx_downloads_token_prod }} \
-H 'content-type: application/octet-stream' \
--upload-file ./kdb-*.vsix \
https://portal.dl.kx.com/assets/raw/kdb-vscode/${{ github.ref_name }}/kdb-${{ github.ref_name }}.$NOW.vsix

curl -L -s --fail-with-body -D /dev/stderr --oauth2-bearer ${{ secrets.kx_downloads_token_prod }} \
-H 'content-type: application/octet-stream' \
--upload-file ./kdb-*.vsix \
https://portal.dl.kx.com/assets/raw/kdb-vscode/${{ github.ref_name }}/kdb-${{ github.ref_name }}.$NOW.vsix

curl -L -s --fail-with-body -D /dev/stderr --oauth2-bearer ${{ secrets.kx_downloads_token_prod }} \
-H 'content-type: application/octet-stream' \
--upload-file ./kdb-*.vsix \
https://portal.dl.kx.com/assets/raw/kdb-vscode/${{ github.ref_name }}/$NOW/kdb-${{ github.ref_name }}.vsix
-H 'content-type: application/octet-stream' \
--upload-file ./kdb-*.vsix \
https://portal.dl.kx.com/assets/raw/kdb-vscode/${{ github.ref_name }}/$NOW/kdb-${{ github.ref_name }}.vsix
2 changes: 1 addition & 1 deletion resources/q/vscode.q
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ reservedWords: {.Q.res}

getViews: {views[]}

// Note: These functions are created from templates by running `node build-api.js` to generate `out/vscode.q`
i.evaluateQ: //{{resources/q/evaluateQ.q}}


i.formatQ: //{{resources/q/formatQ.q}}

i.evaluatePy: {[args]
Expand Down
7 changes: 6 additions & 1 deletion secure-processes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@ To allow the KX extension to connect to this process, the process
The following gives an simplified version of such a process.
Note that this example is a demonstration only, and not intended to provide robust security.

First, generate out/vs-code.q by running
```
$ node build-api.js
```

```q
\l resources/q/vscode.q
\l out/vscode.q

\d .secure

Expand Down
11 changes: 6 additions & 5 deletions src/classes/localConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,19 @@ export class LocalConnection {
this.connection = conn;
this.connected = true;

// Test if arbitrary strings can be executed
// TODO remove result from these functions, and err from setUseAPI
// This checks if an arbitrary string can be executed,
// which means we can send the functions over with each request
// instead of relying on the .vscode namespace to be defined
this.connection?.k("123", (err) => {
if (!err) {
this.setUseAPI(err, false);
this.setUseAPI(false);
return resolve(conn);
}

// Test if vscode library functions are present and can be called
this.connection?.k(".vscode.getManifest", null, (err) => {
if (!err) {
this.setUseAPI(err, true);
this.setUseAPI(true);
} else {
notify("Failed to check security settings", MessageKind.ERROR, {
logger,
Expand All @@ -132,7 +133,7 @@ export class LocalConnection {
});
}

public setUseAPI(err: Error | undefined, result: boolean): void {
public setUseAPI(result: boolean): void {
if (result) {
this.useAPI = true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/queryUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export function getPythonWrapper(
query: string,
returnFormat: "serialized" | "text" | "structuredText",
): string {
const wrapper = normalizeQSQLQuery(queryWrapper(true, false));
const wrapper = queryWrapper(true, false);
const args = {
returnFormat,
code: normalizePyQuery(query),
Expand Down
Loading