jchase
May 18, 2018, 10:29pm
1
I am looking for a way to update all the fields within all the issues on a specific project. For instance, I have a field called #[ProjectType]# on all the issues on project 77, how do I update this field in all the project’s issues to a value such as “vulnscan”. Does anyone have a script that will do this?
TYIA,
–Jon
etd
May 19, 2018, 7:19am
2
Hi @jchase ,
You need something that in spirit is similar to:
# find_xss.rb - Find projects with XSS Issues in them.
#
# Copyright (C) 2016 Security Roots Ltd.
#
# This file is part of the Dradis Pro Scripting Examples (DPSE) collection.
# The collection can be found at
# https://github.com/securityroots/dradispro-scripting
#
# DPSE free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# DPSE is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with DPSE. If not, see <http://www.gnu.org/licenses/>.
This file has been truncated. show original
Pseudocode:
Locate project
Loop through Issues
Update field
Save issue
Real code:
project = Project.find( <id> )
Node.set_project_scope(project.id)
Note.set_project_scope(project.id)
Issue.set_project_scope(project.id)
Evidence.set_project_scope(project.id)
Tag.set_project_scope(project.id)
issue_library = Node.issue_library
Issue.where(node_id: issue_library.id).each do |issue|
issue.set_field('ProjectType', 'vulnscan')
issue.save
end