Skip to content

Fix unpermitted params notices from the backend#854

Open
kevin-atnos wants to merge 1 commit intomasterfrom
CU-86c2k2yaa_ClientServeur-il-y-a-un-souci-de-unpermitted-parameters
Open

Fix unpermitted params notices from the backend#854
kevin-atnos wants to merge 1 commit intomasterfrom
CU-86c2k2yaa_ClientServeur-il-y-a-un-souci-de-unpermitted-parameters

Conversation

@kevin-atnos
Copy link
Collaborator

@kevin-atnos kevin-atnos commented Feb 3, 2026

This fix unpermitted params notices on Structures creation, PIA creation and Answer creation when pia is used with pia-back (client/server mode).

The fix filters out id, created_at, and updated_at from being sent to the server during updates. These fields are server-managed and shouldn't be included in API requests.

  • The update() method in ApplicationDb was sending ALL properties from the entry object to the Rails backend
  • Rails correctly flagged id, created_at, updated_at as unpermitted parameters since they shouldn't be modifiable via the API

The fix:

  • Added an excludedFields array containing ['id', 'created_at', 'updated_at']
  • These fields are now skipped when building the FormData for API updates
  • Also added user_pias to the excluded fields. This field contains relational data (the association between users and PIAs) that shouldn't be sent to the server during updates - it's managed by the backend through a separate join table.

Answer management:
updated both:
- Backend (see PR on pia-back):
- Changed answer_params to permit :data as a string
- Added processed_answer_params that parses the JSON string (same pattern as structures_controller)
- Frontend (pia/src/app/services/answer.service.ts):
- Serialize data as JSON string instead of nested form fields
This follows the same pattern used for structures.

@kevin-atnos kevin-atnos requested a review from brunto February 3, 2026 08:33
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