Skip to content

Feat/site credentials - #311

Open
Samuelfaure wants to merge 11 commits into
developfrom
feat/site_credentials
Open

Feat/site credentials#311
Samuelfaure wants to merge 11 commits into
developfrom
feat/site_credentials

Conversation

@Samuelfaure

@Samuelfaure Samuelfaure commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

New AdminApientreprise.credentials reads config/credentials.yml or
config/credentials/<env>.yml, provisioned by very_ansible instead of Rails
encrypted credentials committed to this repo. Falls back to generated
values in dev/test/staging when a key is missing, raises in
production/sandbox.

secret_key_base is now set explicitly from this source, so
config.require_master_key is no longer needed in production/sandbox/staging.

Individual call sites are migrated to the new accessor in follow-up commits;
Rails.application.credentials keeps working in the meantime.
HASH_ALGO is memoized at class-load time, so the generic string fallback
("jwt_hash_algo") isn't a valid JWT algorithm and breaks encode/decode in
dev/test. Override it to a real algorithm globally in
test_credentials_setup.rb, applied before AccessToken is first referenced.
Covers the Mailjet gem config initializer, the contact-list webhook
interactor, and the shared "datapass webhook organizer" example (which
previously relied on Rails' bang credential accessor via public_send).
…ew source

formulaire_qf is a nested hash ({host:, secret:}), which the generic
default_proc fallback can't represent (it only synthesizes scalars), so
add a dedicated spec that stubs it explicitly via stub_credential and
exercises FormulaireQFAPIClient's real HTTP calls end to end.
api_particulier_reporters is genuinely optional (not every group needs to
be configured), so these three call sites use .fetch(key, default) rather
than plain [] access, bypassing the credentials default_proc entirely
instead of raising in production when the key is absent.
admin_emails (User#admin?), matomo_site_id_* (falls back to nil rather
than raising, since not every namespace is tracked), sentry_dsn,
ProConnect client config, and the workers UI basic-auth credentials.
@Samuelfaure
Samuelfaure marked this pull request as ready for review July 31, 2026 08:45
@Samuelfaure
Samuelfaure requested review from Un3x and skelz0r July 31, 2026 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant