Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marshall provider config back to JSON from parsed structures to strip extra keys #3544

Merged
merged 3 commits into from
Jun 6, 2024

Conversation

jhrozek
Copy link
Contributor

@jhrozek jhrozek commented Jun 5, 2024

Summary

Right now, we parse the user-provided provider configuration, but if it passes validation, we save the user-provided config verbatim. This means that if there are any extra keys, we save them as well because Go ignores extra attributes when unmarshalling JSON.

We need to fix this or else we risk our users flood our database with large configs.

Credit to @blkt for bringing this up.

Fixes #3543

Change Type

  • Bug fix (resolves an issue without affecting existing features)
  • Feature (adds new functionality without breaking changes)
  • Breaking change (may impact existing functionalities or require documentation updates)
  • Documentation (updates or additions to documentation)
  • Refactoring or test improvements (no bug fixes or new functionality)

Testing

manual + make test

Review Checklist:

  • Reviewed my own code for quality and clarity.
  • Added comments to complex or tricky code sections.
  • Updated any affected documentation.
  • Included tests that validate the fix or feature.
  • Checked that related changes are merged.

Or else we risk people updating junk up to our configured limit and
polluting our database

Fixes: mindersec#3543
@jhrozek jhrozek requested a review from a team as a code owner June 5, 2024 20:06
@coveralls
Copy link

Coverage Status

Changes unknown
when pulling 7dae751 on jhrozek:save_marhsalled_config
into ** on stacklok:main**.

@coveralls
Copy link

Coverage Status

coverage: 53.148% (+0.03%) from 53.114%
when pulling 04ed8cc on jhrozek:save_marhsalled_config
into ebc0bf5 on stacklok:main.

@rdimitrov rdimitrov merged commit a21f1dd into mindersec:main Jun 6, 2024
21 checks passed
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.

Strip unknown JSON keys before saving provider config
3 participants