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

Harden configuration reading #2701

Merged
merged 7 commits into from
Sep 26, 2024
Merged

Harden configuration reading #2701

merged 7 commits into from
Sep 26, 2024

Conversation

JCZuurmond
Copy link
Member

@JCZuurmond JCZuurmond commented Sep 23, 2024

Changes

Harden configuration reading by verifying the type before reading the "value" using .get

Linked issues

Resolves #2581 (hopefully the second get is the issue, type hinting should cover that, but who knows)

Functionality

  • modified existing workflow: assessment

Tests

  • added unit tests

@JCZuurmond JCZuurmond added the internal this pull request won't appear in release notes label Sep 23, 2024
@JCZuurmond JCZuurmond self-assigned this Sep 23, 2024
@JCZuurmond JCZuurmond requested a review from a team as a code owner September 23, 2024 14:26
value = config.get(key, {}).get("value", "")
value = config.get(key, {})
if isinstance(value, dict):
value = value.get("value", "")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug: otherwise value is None. add an else statement

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That could also happen in line 48 and the function signature allows return type None. It will break when get_secret is True

@nfx nfx merged commit d4aa8f6 into main Sep 26, 2024
4 of 6 checks passed
@nfx nfx deleted the fix/harden-secrets-reading branch September 26, 2024 08:43
jgarciaf106 pushed a commit to rportilla-databricks/ucx that referenced this pull request Sep 26, 2024
## Changes
Harden configuration reading by verifying the type before reading the
"value" using `.get`

### Linked issues

Resolves databrickslabs#2581 (hopefully the second get is the issue, type hinting
should cover that, but who knows)

### Functionality

- [x] modified existing workflow: `assessment`

### Tests

- [x] added unit tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal this pull request won't appear in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG]: TASK "assess azure sp" fails with 'str' object has no attribute 'get'
2 participants