Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Production deploy #3026

Merged
merged 4 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
11 changes: 11 additions & 0 deletions api.planx.uk/modules/admin/session/digitalPlanningData.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,15 @@ describe("Digital Planning Application payload admin endpoint", () => {
expect(res.body).toEqual(expectedPlanningPermissionPayload),
);
});

it("returns an invalid JSON payload if the skipValidation query param is set", async () => {
await supertest(app)
.get(endpoint`123`.concat("?skipValidation=true"))
.set(authHeader({ role: "platformAdmin" }))
.expect(200)
.expect("content-type", "application/json; charset=utf-8")
.then((res) =>
expect(res.body).toEqual(expectedPlanningPermissionPayload),
);
});
});
13 changes: 13 additions & 0 deletions api.planx.uk/modules/admin/session/digitalPlanningData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ import { $api } from "../../../client";
* - admin
* parameters:
* - $ref: '#/components/parameters/sessionId'
* - in: query
* name: skipValidation
* type: boolean
* required: false
* description: If invalid JSON data should still be returned, instead of logging validation errors
* security:
* - bearerAuth: []
*/
Expand All @@ -20,9 +25,17 @@ export const getDigitalPlanningApplicationPayload = async (
next: NextFunction,
) => {
try {
let skipValidation = false;
if (req.query?.skipValidation) {
skipValidation =
(req.query.skipValidation as string).toLowerCase() === "true";
}

const data = await $api.export.digitalPlanningDataPayload(
req.params.sessionId,
skipValidation,
);

res.set("content-type", "application/json");
return res.send(data);
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion api.planx.uk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"dependencies": {
"@airbrake/node": "^2.1.8",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#7ff62e4",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#15bde6b",
"@types/isomorphic-fetch": "^0.0.36",
"adm-zip": "^0.5.10",
"aws-sdk": "^2.1467.0",
Expand Down
8 changes: 4 additions & 4 deletions api.planx.uk/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion e2e/tests/api-driven/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
"dependencies": {
"@cucumber/cucumber": "^9.3.0",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#7ff62e4",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#15bde6b",
"axios": "^1.6.8",
"dotenv": "^16.3.1",
"dotenv-expand": "^10.0.0",
Expand Down
8 changes: 4 additions & 4 deletions e2e/tests/api-driven/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion e2e/tests/ui-driven/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"postinstall": "./install-dependencies.sh"
},
"dependencies": {
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#7ff62e4",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#15bde6b",
"axios": "^1.6.8",
"dotenv": "^16.3.1",
"eslint": "^8.56.0",
Expand Down
8 changes: 4 additions & 4 deletions e2e/tests/ui-driven/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion editor.planx.uk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@mui/material": "^5.15.2",
"@mui/utils": "^5.15.2",
"@opensystemslab/map": "^0.8.1",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#7ff62e4",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#15bde6b",
"@tiptap/core": "^2.0.3",
"@tiptap/extension-bold": "^2.0.3",
"@tiptap/extension-bubble-menu": "^2.1.13",
Expand Down
10 changes: 5 additions & 5 deletions editor.planx.uk/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ const Root = styled(Box)(({ theme }) => ({
backgroundColor: "#f2f2f2",
zIndex: 0,
},
zIndex: theme.zIndex.appBar,
}));

const Settings: React.FC<SettingsProps> = ({ currentTab, tabs }) => {
Expand Down
9 changes: 8 additions & 1 deletion editor.planx.uk/src/pages/FlowEditor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,14 @@ const FlowEditor: React.FC<any> = ({ flow, breadcrumbs }) => {

return (
<Box id="editor-container">
<Box sx={{ display: "flex", flexDirection: "column", width: "100%" }}>
<Box
sx={{
display: "flex",
flexDirection: "column",
width: "100%",
overflowX: "auto",
}}
>
<LastEdited />
<Box id="editor" ref={scrollContainerRef} sx={{ position: "relative" }}>
<Flow flow={flow} breadcrumbs={breadcrumbs} />
Expand Down
33 changes: 33 additions & 0 deletions scripts/encrypt/decrypt.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { decrypt } from "@opensystemslab/planx-core";

/**
* Decrypt a secret
* Currently used to read secure secrets from the team_integrations table back to plain text
* e.g using API keys in another context, checking values
*
* @param encryptionKey - The encryption key - a 32-byte string
* @param secret - The encrypted secret and initialization vector in the format ${secret}:${iv}
* @returns The decrypted secret
* @example pnpm decrypt <encryptionKey> <secret>
*/
function main() {
try {
if (process.argv.length < 4) {
console.error("Usage: pnpm decrypt <encryptionKey> <secret>");
process.exit(1);
}

const encryptionKey = process.argv[2];
const secret = process.argv[3];
const decrypted = decrypt(secret, encryptionKey);

console.log("Success!");
console.log(decrypted);
} catch (error) {
console.log("Error!");
console.error(error);
process.exit(1);
}
}

main();
10 changes: 5 additions & 5 deletions scripts/encrypt/index.ts → scripts/encrypt/encrypt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ import { encrypt } from "@opensystemslab/planx-core";
* Currently used to generate secure secrets for the team_integrations table
* e.g converting plain text 3rd-part API keys (such as BOPS tokens) to encrypted strings
*
* @param secret - The secret to be encrypted.
* @param encryptionKey - The encryption key - a 32-byte string
* @param secret - The secret to be encrypted.
* @returns The encrypted secret and initialization vector in the format ${secret}:${iv}
* @example pnpm encode <secret> <encryptionKey>
* @example pnpm encrypt <encryptionKey> <secret>
*/
function main() {
try {
if (process.argv.length < 4) {
console.error("Usage: pnpm encode <secret> <encryptionKey>");
console.error("Usage: pnpm encrypt <encryptionKey> <secret>");
process.exit(1);
}

const secret = process.argv[2];
const encryptionKey = process.argv[3];
const encryptionKey = process.argv[2];
const secret = process.argv[3];
const encrypted = encrypt(secret, encryptionKey);

console.log("Success!");
Expand Down
3 changes: 2 additions & 1 deletion scripts/encrypt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "",
"main": "index.ts",
"scripts": {
"encrypt": "ts-node index.ts"
"encrypt": "ts-node encrypt.ts",
"decrypt": "ts-node decrypt.ts"
},
"keywords": [],
"dependencies": {
Expand Down
Loading