Skip to content

Commit 822a545

Browse files
committed
security: remove hardcoded Apple Developer ID
Removed hardcoded certificate hash from install.sh and Makefile. Code signing now requires APPLE_DEVELOPER_ID environment variable.
1 parent 71ac5c5 commit 822a545

2 files changed

Lines changed: 14 additions & 10 deletions

File tree

Makefile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ COMMIT=$(shell git rev-parse --short HEAD 2>/dev/null || echo "none")
66
BUILD_TIME=$(shell date -u '+%Y-%m-%d_%H:%M:%S')
77
LDFLAGS=-ldflags "-X main.version=$(VERSION) -X main.commit=$(COMMIT)"
88

9-
# Apple code signing (set via environment or use default)
10-
APPLE_DEVELOPER_ID ?= 9E5DE6F9BC4DF45371D1121683B21D1638CDB875
9+
# Apple code signing (set APPLE_DEVELOPER_ID env var to enable)
10+
# Example: APPLE_DEVELOPER_ID=YOUR_CERT_HASH make build-signed
1111

1212
.PHONY: all build build-signed clean install test lint
1313

@@ -18,15 +18,17 @@ build:
1818
go build $(LDFLAGS) -o $(BINARY_NAME) .
1919

2020
build-signed: build
21-
@echo "Signing binary..."
22-
@if [ "$$(uname)" = "Darwin" ]; then \
21+
@if [ "$$(uname)" = "Darwin" ] && [ -n "$(APPLE_DEVELOPER_ID)" ]; then \
22+
echo "Signing binary..."; \
2323
codesign --force --options runtime --sign "$(APPLE_DEVELOPER_ID)" $(BINARY_NAME); \
2424
echo "Binary signed successfully"; \
25+
elif [ "$$(uname)" = "Darwin" ]; then \
26+
echo "Skipping code signing (set APPLE_DEVELOPER_ID to enable)"; \
2527
else \
2628
echo "Skipping code signing (not macOS)"; \
2729
fi
2830

29-
install: build-signed
31+
install: build
3032
@echo "Installing to ~/.local/bin..."
3133
@mkdir -p ~/.local/bin
3234
@cp $(BINARY_NAME) ~/.local/bin/$(BINARY_NAME)

install.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ set -e
55
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
66
cd "$SCRIPT_DIR"
77

8-
# Apple Code Signing Configuration
9-
# Set these environment variables or they will use defaults
10-
APPLE_DEVELOPER_ID="${APPLE_DEVELOPER_ID:-9E5DE6F9BC4DF45371D1121683B21D1638CDB875}"
8+
# Apple Code Signing Configuration (optional)
9+
# Set APPLE_DEVELOPER_ID environment variable to enable signing
10+
# Example: export APPLE_DEVELOPER_ID="your-certificate-hash"
1111

1212
echo "=========================================="
1313
echo " Logdump Installation Script"
@@ -36,8 +36,8 @@ if ! go build -o logdump .; then
3636
exit 1
3737
fi
3838

39-
# Sign the binary (macOS only)
40-
if [[ "$OSTYPE" == "darwin"* ]]; then
39+
# Sign the binary (macOS only, requires APPLE_DEVELOPER_ID)
40+
if [[ "$OSTYPE" == "darwin"* ]] && [[ -n "$APPLE_DEVELOPER_ID" ]]; then
4141
echo "Signing binary with Developer ID..."
4242
if command -v codesign &> /dev/null; then
4343
codesign --force --options runtime --sign "$APPLE_DEVELOPER_ID" logdump
@@ -50,6 +50,8 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
5050
else
5151
echo "Warning: codesign not found, skipping signing"
5252
fi
53+
elif [[ "$OSTYPE" == "darwin"* ]]; then
54+
echo "Skipping code signing (set APPLE_DEVELOPER_ID to enable)"
5355
fi
5456

5557
# Install binary

0 commit comments

Comments
 (0)