Skip to content

refactor: Migrate project management to Projen#162

Open
flamingquaks wants to merge 19 commits into
mainfrom
projen-refactor
Open

refactor: Migrate project management to Projen#162
flamingquaks wants to merge 19 commits into
mainfrom
projen-refactor

Conversation

@flamingquaks

Copy link
Copy Markdown
Contributor

This PR refactors the project to be managed using Projen for better long-term maintenance and stability of the project.
Overall, there's no functionality changed.
Many files have linting and import order optimizations.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

flamingquaks and others added 8 commits October 27, 2024 09:53
…tant files

.projenrc.ts ignores lib dir, but lib dir is used differently in this project. So libdir was set to
out/. This allowed lib/ to be included again.

BREAKING CHANGE: Previous commit fails to build
GitHub Actions failed due to new build workflow requiring config.json file during build and not just
during synth
Comment thread cli/config-manage.ts Fixed
Comment thread cli/config-manage.ts Fixed
throw new Error('USER_POOL_CLIENT_ID is not set');
}
const regex = new RegExp(VALIDATION_REGEX)
const regex = new RegExp(VALIDATION_REGEX);

Check failure

Code scanning / CodeQL

Regular expression injection

This regular expression is constructed from a [environment variable](1).

Copilot Autofix

AI over 1 year ago

To fix the problem, we need to sanitize the VALIDATION_REGEX environment variable before using it to construct a regular expression. The best way to do this is by using a well-known library like lodash to escape any special characters in the regex pattern. This ensures that any meta-characters in the input are treated as literals, preventing injection attacks.

  1. Import the lodash library.
  2. Use the _.escapeRegExp function to sanitize VALIDATION_REGEX before constructing the regular expression.
Suggested changeset 2
lib/authorization/index.action-authorization.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/lib/authorization/index.action-authorization.ts b/lib/authorization/index.action-authorization.ts
--- a/lib/authorization/index.action-authorization.ts
+++ b/lib/authorization/index.action-authorization.ts
@@ -25,2 +25,3 @@
 import { queryToActionAuth } from './authorization-helper';
+import _ from 'lodash';
 
@@ -46,3 +47,4 @@
 }
-const regex = new RegExp(VALIDATION_REGEX);
+const safeValidationRegex = _.escapeRegExp(VALIDATION_REGEX);
+const regex = new RegExp(safeValidationRegex);
 
EOF
@@ -25,2 +25,3 @@
import { queryToActionAuth } from './authorization-helper';
import _ from 'lodash';

@@ -46,3 +47,4 @@
}
const regex = new RegExp(VALIDATION_REGEX);
const safeValidationRegex = _.escapeRegExp(VALIDATION_REGEX);
const regex = new RegExp(safeValidationRegex);

package.json
Outside changed files

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/package.json b/package.json
--- a/package.json
+++ b/package.json
@@ -114,3 +114,4 @@
     "typescript": "^5.6.3",
-    "uuid": "^10.0.0"
+    "uuid": "^10.0.0",
+    "lodash": "^4.17.21"
   },
EOF
@@ -114,3 +114,4 @@
"typescript": "^5.6.3",
"uuid": "^10.0.0"
"uuid": "^10.0.0",
"lodash": "^4.17.21"
},
This fix introduces these dependencies
Package Version Security advisories
lodash (npm) 4.17.21 None
Copilot is powered by AI and may make mistakes. Always verify output.
@github-actions github-actions Bot added documentation Improvements or additions to documentation GitHubPages labels Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants