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

Attempts to fix security errors around using unsanitized flow and screen inputs #547

Merged
merged 5 commits into from
Apr 25, 2024

Conversation

bseeger
Copy link
Contributor

@bseeger bseeger commented Apr 23, 2024

Issue tracking number πŸ”—

Description of change ✍️

Creates a way to use flow and screen for redirects in a way that they are first validated to be safe values to use.
The getScreenConfig was already ensuring they were good values, but that doesn't stop the code scanning for thinking they are unsafe.

Priority πŸ₯‡

Effect on other applications using FFB 🌊

Testing

βœ… Checklist before requesting a review

  • Does the new code follow our preferred coding
    style
    ?
  • Does the code include javadocs, where necessary?
  • [N/A] Have tests for this feature been added / updated?
  • [N/A] Has the readme been updated?

* }
* <p>
* /**
* Checks if current screen condition is met.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm... typo, I think. I will revert this change.

String flowName;
String screenName;
ScreenNavigationConfiguration screenNavigationConfiguration;
}
Copy link
Contributor Author

@bseeger bseeger Apr 23, 2024

Choose a reason for hiding this comment

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

If we like this, I can put it out into another class. The problem I'm trying to solve is that you can't get the flow or the screen name from the screenNavigationConfiguration object, so I thought I'd do a light weight wrapping of it with that data, for convenience. If you can think of a better way, let me know.

It's hard to change the ScreenNavigationConfiguration object because it's tightly coupled to the yaml format.

@bseeger
Copy link
Contributor Author

bseeger commented Apr 23, 2024

This doesn't appear to fix the issue, though I'm not particularly worried about these pieces of code being a security vulnerability, given the code path.

@bseeger bseeger requested a review from coltborg April 23, 2024 21:52
@bseeger
Copy link
Contributor Author

bseeger commented Apr 23, 2024

I think the last change fixes the security alerts. Question is, do we like this change?

@@ -29,4 +32,13 @@ public class FlowConfiguration {
public ScreenNavigationConfiguration getScreenNavigation(String screenName) {
return flow.get(screenName);
}

public void setFlow(Map<String, ScreenNavigationConfiguration> screenMap) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This method will get called by SnakeYAML when it builds the flow configuration from the yaml file. This allows us to inject information, if we want.

Copy link
Contributor

@coltborg coltborg left a comment

Choose a reason for hiding this comment

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

Yep, I think having the warning go away means you've addressed them πŸ‘πŸ»

@bseeger bseeger merged commit fb28ce5 into main Apr 25, 2024
5 checks passed
@bseeger bseeger deleted the fix_security_alerts branch April 25, 2024 17:03
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.

None yet

2 participants