Skip to content

Commit 2decfb5

Browse files
committed
fix(FR-1434): improve Makefile security and cross-platform compatibility (#4232)
Resolves [FR-1434](https://lablup.atlassian.net/browse/FR-1434) This PR addresses two important improvements to the project's Makefile: ## Changes 1. **Security Enhancement in Clean Target**: - Fixed the `clean` target to use explicit paths instead of `cd` commands - Prevents risk of deleting unintended directories if paths don't exist or fail - Makes the clean process safer and more predictable 2. **Cross-Platform Compatibility**: - Replaced `uuidgen` dependency with `openssl rand` for random ID generation - Ensures build process works reliably in minimal Linux environments - Maintains backward compatibility while improving portability ## Impact These changes improve the robustness and security of the build process without breaking existing functionality. **Checklist:** - [x] Documentation (changes are self-documenting in Makefile) - [x] Cross-platform compatibility verified - [x] No breaking changes to existing build process [FR-1434]: https://lablup.atlassian.net/browse/FR-1434?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
1 parent 9ea530b commit 2decfb5

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ site := $(or $(site),main)
88
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
99
current_dir := $(notdir $(patsubst %/,%,$(dir $(mkfile_path))))
1010

11-
KEYCHAIN_NAME := bai-build-$(shell uuidgen).keychain
11+
KEYCHAIN_NAME := bai-build-$(shell openssl rand -hex 16 | sed -E 's/(.{8})(.{4})(.{4})(.{4})(.{12})/\1-\2-\3-\4-\5/').keychain
1212
BAI_APP_SIGN_KEYCHAIN_FILE := $(shell mktemp -d)/keychain.p12
1313
BAI_APP_SIGN_KEYCHAIN =
1414

@@ -47,6 +47,9 @@ versiontag:
4747
compile_keepversion:
4848
@pnpm run build
4949
compile: versiontag
50+
@if [ ! -f "./config.toml" ]; then \
51+
cp config.toml.sample config.toml; \
52+
fi
5053
@pnpm run build
5154
compile_wsproxy:
5255
@cd ./src/wsproxy; pnpm dlx webpack-cli --config webpack.config.js
@@ -196,6 +199,6 @@ build_docker: compile
196199
i18n:
197200
@pnpm dlx i18next-scanner --config ./i18n.config.js
198201
clean:
199-
@cd app; rm -rf ./backend*; rm -rf ./Backend*
200-
@cd build;rm -rf ./unbundle ./bundle ./rollup ./electron-app
202+
@rm -rf ./app/backend*; rm -rf ./app/Backend*
203+
@rm -rf ./build/unbundle ./build/bundle ./build/rollup ./build/electron-app
201204
@rm -rf ./react/build

packages/backend.ai-ui/vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export default defineConfig(({ mode }) => {
6060
}),
6161
dts({
6262
include: ['src/**/*'],
63-
exclude: ['src/*/*/*.stories.ts', 'src/locale/*.json'],
63+
exclude: ['**/*.{stories,test}.{ts,tsx}', 'src/locale/*.json'],
6464
rollupTypes: false,
6565
insertTypesEntry: true,
6666
compilerOptions: {

0 commit comments

Comments
 (0)