系统安全加密优化
This commit is contained in:
1 parent
741bf2ee73
commit
c3cdb9e2d6
267 files changed
+15992
-2593
No files matched your search
@@ -5,28 +5,57 @@ Before saving any `secret=true` value in `sys_integration_config`, configure
|
||||
longer secret) in the backend runtime environment. Do not commit the key or
|
||||
place a real value in `src/main/resources/application.yml`.
|
||||
|
||||
## Payee bank-account protection
|
||||
|
||||
Before creating or changing a payee bank account, provide these runtime secrets:
|
||||
|
||||
- `APP_BANK_ACCOUNT_ENCRYPTION_KEYS`: comma-separated `version=Base64Key`
|
||||
entries; every decoded AES key must be exactly 32 bytes. Keep old versions
|
||||
present while old ciphertext still exists.
|
||||
- `APP_BANK_ACCOUNT_ACTIVE_KEY_VERSION`: the version used for new ciphertext.
|
||||
- `APP_BANK_ACCOUNT_FINGERPRINT_KEY`: a separate Base64-encoded 32-byte HMAC key.
|
||||
|
||||
Never reuse the integration key, JWT secret, database password, or an encryption
|
||||
key as the fingerprint key. Keep all real values outside the repository.
|
||||
|
||||
For an existing database, apply
|
||||
`V20261201_02__protect_payee_bank_accounts.sql` first. After a verified backup,
|
||||
set `APP_BANK_ACCOUNT_LEGACY_BACKFILL_ENABLED=true` for one observed maintenance
|
||||
run, then return it to `false`. The backfill is deliberately non-destructive: it
|
||||
adds ciphertext, mask, fingerprint, and key version but does not clear the legacy
|
||||
plaintext column. Final plaintext clearing requires a separate reviewed change,
|
||||
explicit data-cleanup authorization, restore evidence, and post-change checks.
|
||||
|
||||
For rollout and operations of asynchronous Feishu directory synchronization,
|
||||
see [`../docs/feishu-directory-sync.md`](../docs/feishu-directory-sync.md).
|
||||
see [`../financial_system_docs/feishu-directory-sync.md`](../financial_system_docs/feishu-directory-sync.md).
|
||||
|
||||
## Database contract
|
||||
|
||||
[`../database/init_schema.sql`](../database/init_schema.sql) is the only schema
|
||||
and bootstrap source. Run it with a MySQL 5.7 client only when
|
||||
[`../financial_system_database/init_schema.sql`](../financial_system_database/init_schema.sql) is the clean-install
|
||||
schema/bootstrap snapshot. Run it with a MySQL 8.4 LTS client only when
|
||||
`finance_system` does not yet exist. It intentionally fails against an existing
|
||||
or partial installation. The application keeps Hibernate `ddl-auto: validate`
|
||||
and never changes the application-owned schema during startup. The optional,
|
||||
explicitly authorized Kingdee table-preparation feature can create or alter only
|
||||
its configured target tables; use a narrowly scoped DDL account for that action
|
||||
or have a DBA pre-create those tables and keep the runtime account DML-only.
|
||||
Existing installations require a separately reviewed DBA release script and
|
||||
procedure for every in-place upgrade; never run the clean-install script against
|
||||
them.
|
||||
Existing installations use the closed manifest and chain runner documented in
|
||||
[`../financial_system_docs/mysql-migration-runner.md`](../financial_system_docs/mysql-migration-runner.md), with
|
||||
DBA review and staging rehearsal; never run the clean-install snapshot against them.
|
||||
Deployment JDBC `serverTimezone` and `DB_TIME_ZONE` are both `UTC`. MySQL 8.4 LTS
|
||||
is the runtime target; repository tests are not evidence of execution on a real
|
||||
production-equivalent instance, so the exact manifest requires production-like rehearsal.
|
||||
|
||||
The sole script intentionally seeds exactly one environment-specific Feishu
|
||||
identity and binds it to the built-in `SUPER_ADMIN_GROUP`. Treat the script as an
|
||||
access-controlled deployment asset, verify that the identity is the intended
|
||||
operator, and edit it before installing another tenant. The seed has no local
|
||||
password, mobile, email, or avatar URL; it receives `SUPER_ADMIN` only through
|
||||
group membership, while `DEFAULT_EMPLOYEE` has no materialized member. Default
|
||||
passwords, local-profile bootstrap, and first-user auto-promotion remain
|
||||
prohibited.
|
||||
The clean-install snapshot creates built-in roles, groups, and group-role links,
|
||||
but no person, default administrator, or personal group membership. Bootstrap the
|
||||
first `SUPER_ADMIN` exactly once: the candidate first completes normal Feishu
|
||||
login, two independent reviewers verify the immutable user ID and tenant against
|
||||
the corporate directory, and a DBA runs an external, hashed, parameterized
|
||||
transaction that adds only that `ACTIVE` user to `SUPER_ADMIN_GROUP`, checks the
|
||||
affected row and unique membership, and records the evidence in the change ticket.
|
||||
The candidate verifies `/api/auth/me`, the second reviewer closes the one-time
|
||||
channel, and all later grants use normal IAM administration. Never store the
|
||||
identity, script parameters, or secrets in the repository and never auto-promote
|
||||
the first user. `LocalDataInitializer` is loaded only by the `local` profile, and
|
||||
`finance.local-bootstrap.super-admin.enabled` defaults to `false`; neither the
|
||||
profile nor the switch is permitted in production.
|
||||