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

Expose scan template level control scanning options #88

Merged
merged 2 commits into from
Nov 5, 2014

Conversation

erran
Copy link
Contributor

@erran erran commented Nov 4, 2014

  • ScanTemplate#control_scanning?
  • ScanTemplate#control_scanning=

def control_scanning=(enable)
global_controls_scan = REXML::XPath.first(@xml, 'ScanTemplate/ControlsScan/globalControlsScanEnabled')
if global_controls_scan.attributes['enabled'] == '1'
warn 'Updating the local controls scanning option when the global is enabled has no effect.'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should this raise an exception? The UI grays out the corresponding check box when the global option is enabled.

Copy link
Contributor

Choose a reason for hiding this comment

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

I tend to shy away from adding checks like this to duplicate UI logic. What happens if it is enabled and you try to save? Will Nexpose throw or return an error? If it does and that message is clear enough, then this check only saves a small roundtrip and avoids the gem having to repeat UI validation.

On a separate note, I see "control" and "controls" in different places. What's the official term? We should use that where possible (if we aren't). My gut is "controls", but UX/Doc would be the final word.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On a separate note, I see "control" and "controls" in different places. What's the official term? We should use that where possible (if we aren't). My gut is "controls", but UX/Doc would be the final word.

The UX is Control Scanning in the Nexpose UI. The XML nodes use Controls Scan which was a previous iteration in the UX.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tend to shy away from adding checks like this to duplicate UI logic. What happens if it is enabled and you try to save? Will Nexpose throw or return an error? If it does and that message is clear enough, then this check only saves a small roundtrip and avoids the gem having to repeat UI validation.

The API will silently ignore it. Do you think the warning should be removed or is appropriate? My initial thought was to add a warning but I could be swayed to remove it since it seems to be harmless (I learned this afterwards).

Copy link
Contributor

Choose a reason for hiding this comment

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

I think I'd just go ahead and remove it. I could see a workflow where an admin goes through an modifies the templates first before flipping the global switch.

As to names, let's make sure we are using the singular "control" then (except in the XML, where there's no choice). Don't need to rework anything not in this commit, but worth auditing at some point.

@erran-r7
Copy link
Contributor

erran-r7 commented Nov 5, 2014

@mdaines-r7 There you go. 👍

@mdaines-r7
Copy link
Contributor

Sorry, forgot this was pending. You want a release?

mdaines-r7 added a commit that referenced this pull request Nov 5, 2014
Expose scan template level control scanning options
@mdaines-r7 mdaines-r7 merged commit 5867804 into rapid7:master Nov 5, 2014
@erran-r7 erran-r7 deleted the template-controls-scanning-option branch November 5, 2014 21:52
@erran-r7
Copy link
Contributor

erran-r7 commented Nov 5, 2014

@mdaines-r7 That'd be great.

@mdaines-r7
Copy link
Contributor

done.

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.

3 participants