diff --git a/.gitignore b/.gitignore index bc78471..ffcac66 100644 --- a/.gitignore +++ b/.gitignore @@ -482,3 +482,6 @@ $RECYCLE.BIN/ # Vim temporary swap files *.swp + +# SEC-1: local Google Maps key injection — never commit the real key +maps.key.props diff --git a/FieldLogger/FieldLogger.csproj b/FieldLogger/FieldLogger.csproj index e1e8450..6b5a0bd 100644 --- a/FieldLogger/FieldLogger.csproj +++ b/FieldLogger/FieldLogger.csproj @@ -46,6 +46,18 @@ 6.5 + + + + $(MAPS_API_KEY) + MAPS_API_KEY=$(MapsApiKey) + + diff --git a/FieldLogger/Platforms/Android/AndroidManifest.xml b/FieldLogger/Platforms/Android/AndroidManifest.xml index 2603a9b..04b7e59 100644 --- a/FieldLogger/Platforms/Android/AndroidManifest.xml +++ b/FieldLogger/Platforms/Android/AndroidManifest.xml @@ -1,8 +1,10 @@  - - + + diff --git a/README.md b/README.md index 47b52ee..b1e87df 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,6 @@ Cross-platform .NET MAUI app (Windows, macOS, iOS, Android) for logging utility points from an **Underground Magnetics locating receiver** paired with RTK GPS positions from a **Maglink (H11) RTK receiver**, both over BLE. -Maps API Key: AIzaSyDhH16gF-7UN-CBsTQGfQSHNGjLC6VJ5dI - ## Solution layout ``` @@ -40,8 +38,13 @@ doc/ Device protocol documentation ## Setup required before running -1. **Google Maps key (Android):** replace `YOUR_GOOGLE_MAPS_ANDROID_API_KEY` in - `FieldLogger/Platforms/Android/AndroidManifest.xml` (Google Cloud Console → Maps SDK for Android). +1. **Google Maps key (Android):** the manifest key is **injected at build time**, never + committed (SEC-1). Provide it one of three ways: pass `-p:MapsApiKey=` to + `dotnet build` (how CI supplies it from a secret), set the `MAPS_API_KEY` environment + variable, or copy `maps.key.props.example` to `maps.key.props` (gitignored) at the repo + root and put your key there. Use a key restricted to the app package + release SHA-1 + (Google Cloud Console → Maps SDK for Android). Without a key, maps render blank but the + app builds. 2. **Google Maps key (Windows):** create a Maps JavaScript API key and paste it into the Settings page of the app. 3. **Maglink GATT UUIDs:** the Maglink docs describe the serial protocol but not its GATT diff --git a/maps.key.props.example b/maps.key.props.example new file mode 100644 index 0000000..436cdd4 --- /dev/null +++ b/maps.key.props.example @@ -0,0 +1,13 @@ + + + + YOUR_GOOGLE_MAPS_ANDROID_API_KEY + +