Android: send X-Kvitt-App app key on every server request (D-126)
The reverse proxy closes requests from outside the home LAN that lack X-Kvitt-App: <key>. The key is the build property kvitt.appKey (-Pkvitt.appKey, else android/local.properties, else empty = no header), validated as 16-128 printable ASCII without whitespace, exposed as BuildConfig.APP_KEY and passed via AppBuildInfo.appKey to KvittApi (every call, /health and other unauthenticated calls included) and the Coil picture client (PictureAuth). AppBuildInfo.toString hides the key. Tests use a made-up key; README documents the property. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TQd3pEP9UeN2uifbHknQ7B
This commit is contained in:
@@ -10,7 +10,8 @@ import se.hagstedt.kvitt.link.RELEASE_SERVER_URL
|
||||
import javax.inject.Singleton
|
||||
|
||||
/**
|
||||
* Both variants: the app's version (§10.6), build type and release server ([RELEASE_SERVER_URL], D-121, D-122) for
|
||||
* Both variants: the app's version (§10.6), build type, release server ([RELEASE_SERVER_URL], D-121, D-122) and app key
|
||||
* for the reverse proxy (`BuildConfig.APP_KEY` from `kvitt.appKey`, empty when the build has none, D-126) for
|
||||
* `:data`'s `DataModule`, which Hilt installs in debug and release alike (it binds no `:core:model` interface, D-041).
|
||||
*/
|
||||
@Module
|
||||
@@ -22,5 +23,6 @@ object AppBuildInfoModule {
|
||||
versionName = BuildConfig.VERSION_NAME,
|
||||
debug = BuildConfig.DEBUG,
|
||||
releaseServerUrl = RELEASE_SERVER_URL,
|
||||
appKey = BuildConfig.APP_KEY,
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user