aboutsummaryrefslogtreecommitdiffstats
path: root/integrity-audit/src/main/java/org/onap/policy
AgeCommit message (Collapse)AuthorFilesLines
2023-09-29Fix security vulnerabilitiesadheli.tavares3-182/+184
- iq nexus vulnerabilities - sonar security hotspots and code smell Issue-ID: POLICY-4761 Issue-ID: POLICY-4833 Change-Id: Iab2e07d2ee7b90031bc5a30210ce7d3f5a47b3fd Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
2023-09-21Java 17 Upgradeadheli.tavares4-31/+31
Issue-ID: POLICY-4668 Change-Id: If4e79224de61d66d7514f3abbd7b8bee1c3d5681 Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
2023-02-06Replace Eclipselink with Hibernateliamfallon1-2/+6
Issue-ID: POLICY-4533 Change-Id: I9d2e4d90bf997935efad16e8ae4473d635ae9d65 Signed-off-by: liamfallon <liam.fallon@est.tech>
2022-10-19Fix some dependencies flagged in scansliamfallon1-2/+6
Issue-ID: POLICY-4393 Change-Id: I5b82f5e17ae8827486cc477d7ade4ed46e2e902b Signed-off-by: liamfallon <liam.fallon@est.tech>
2021-06-18Fix new checkstyle issues in policy-commonJim Hahn1-1/+0
The new version of checkstyle identified new issues. Fixed those. Issue-ID: POLICY-3284 Change-Id: I2a8bf2b460fda7972ce573f14df5af52d46c9993 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-06-16Use lombok in common paramsJim Hahn4-146/+33
Also condensed some Map calls. Issue-ID: POLICY-3394 Change-Id: I850fcad5a72d92271da76b0731195e8b93dd4089 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-05-06Fix sonars in policy-commonJim Hahn5-51/+56
Fixed sonars: - use "var" instead of actual type name - re-interrupt threads - use rej2 split() instead of String split() Issue-ID: POLICY-3285 Change-Id: I82261e0b8a53ee5c5264556fbf5cec37454f014e Signed-off-by: Jim Hahn <jrh3@att.com>
2021-02-10More sonar issues in commonJim Hahn1-5/+3
Addressed the issues: - use of eq() in verify() - remove @NamedQueries - use computeIfAbsent() Issue-ID: POLICY-2914 Change-Id: I265bc98f0f326e7b4ce86c25e68fc4859bd7fb02 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-07-01Fix build breakage in policy-commonJim Hahn1-2/+4
When the commit for https://gerrit.onap.org/r/c/policy/parent/+/109705 was applied, it broke the changes to common to fix new sonar issues. Backed out some of those changes. Issue-ID: POLICY-2650 Change-Id: Id498392ff798e49c281296575223298c0b6e5143 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-06-30Fix sonars in common due to dependency upgradesJim Hahn1-3/+2
Fixed the following issues: - don't use annotation wrappers - version overridden in pom Issue-ID: POLICY-2650 Change-Id: Ia520037529861f8ace160c172ed70a5671b740d9 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-06-18Changes for checkstyle 8.32liamfallon1-5/+5
Issue-ID: POLICY-2188 Change-Id: I00843c61a6567001fc35c3ebb77b6843a1eb7da2 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-06-17Cleanup various sonar issues in policy-commonJim Hahn2-10/+8
Addressed the following issues: - unused imports - unused method parameters - use assertEquals, assertSame instead of assertTrue - provide the parametrized type for this generic Also fixed some checkstyle issues: - removed blank lines between "import" groups Issue-ID: POLICY-2650 Change-Id: I004bb650ac10c49ccd0fc405f6959896fec39f9b Signed-off-by: Jim Hahn <jrh3@att.com>
2020-04-07Update licenses on sonar fixes in commonJim Hahn1-1/+1
Forgot to update licenses on some of the files that were modified as part of addressing sonar issues. Updated. Issue-ID: POLICY-2305 Change-Id: I9858bfb54be5b8eb42406e944361ec100ae238ff Signed-off-by: Jim Hahn <jrh3@att.com>
2020-04-06More sonar issues in commonJim Hahn1-9/+11
Fixed additional sonar issues: - infinit loop; while the issue is bogus, it was easy enough to modify the code to satisfy sonar - doesn't like "volatile"; again, the issue is bogus, but easy enough to modify the code Disabled a couple of sonars in NetworkUtil, as they are not actually an issue. Issue-ID: POLICY-2305 Change-Id: I5500183e3fe4060696994cff55bdae4ba7e138c7 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-04-06Address sonar issues in commonJim Hahn1-33/+22
Addressed the following sonar issues: - missing assertion in junit test case - disable sonars about setAccessible() as it's required for jackson emulation - sleep in junit - don't use wild-cards (e.g., "*") with java.util Pattern - use re2j instead of java.util Pattern - use String methods (e.g., startsWith()) - duplicate method bodies - duplicate code in Coder classes - string concatenation in logger calls - UTF-8 encoding - return primitive instead of boxed primitive - add assertion to tests - renamed support methods from doTestXxx to verifyXxx - cognitive complexity - use AtomicRef instead of volatile - use specific Functionals (e.g., IntConsumer) - function always returns the same value - serializable vs transient Issue-ID: POLICY-2305 Change-Id: I08eb7aa495a80bdc1d26827ba17a7946c83b9828 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-03-27More sonar issues cleanupPamela Dragosh1-13/+6
Either log or rethrow Use boolean expression Add at least one test Remove commented out code Issue-ID: POLICY-2204 Change-Id: I4fdf31aea75303e4f49d25198eb3b12341995bfe Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2020-01-14Sonar cleanup overrides and fixesPamela Dragosh1-2/+2
Removal of UTF-8 because its already set capabilities doesn't generate any code, no need to include override false positives for passwords etc. override for logging and exception throw that we want add synchronized to overrides that are synchronized ignore checking of some conditions adding synchronized to match set* methods Issue-ID: POLICY-2321 Change-Id: I26d9ca22a0cdd67fdaae9c44b718b8dc103f190e Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-07-03Fix remaining sonar issues in Integrity AuditJim Hahn4-7/+8
Renamed enums to upper case - this might disrupt other repos, though it should be minimal. Renamed constants in a junit test. Change-Id: Ifd864bb61eec3d9b3c7a0321fe3841696046f6f6 Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-06-27Allow empty DB password in IntegrityAuditJim Hahn1-2/+4
With the sonar fixes, IntegrityAudit is no longer allowing an empty DB password. This breaks some junits in other policy repos. Corrected the issue. Change-Id: I291d1592ffd80ee76dd9758b3b7156436c579dab Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-06-24Fix more sonar issues in Integrity Audit & MonitorJim Hahn1-120/+75
Removed duplicate code in DbDao by refactoring common code into a new updateIae() method. Removed duplicate code in IntegrityMonitor by refactoring common code into a new withinTransaction() method. Removed duplicate code in StateManagementEntity, StateElement by replacing with lombok Getter & Setter annotations. Removed duplicate code in StateManagement by refactoring common code into new setState() and getState() methods. Also removed logger.isDebugEnabled() tests. Added coverage for StateChangeNotifier. Change-Id: I2e29b836dafc5de569a2267206a6a34105e44021 Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-06-21Fix sonar issues in integrity auditJim Hahn5-452/+521
Mostly used Eclipse Refactor->Extract Method to reduce cyclomatic complexity. Also combined a few "if" statements to reduce nesting levels. Also addressed some sonar issues in the tests (e.g., use "<>" where appropriate). Did not attempt to increase junit coverage. Change-Id: I9d6c1305ce455f0d64249b548d123bb9bf37292a Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-06-13More sonar fixes in policy/commonJim Hahn2-36/+33
Note: this does not increase code coverage, but should fix other code issues. Resolved cyclomatic complexity issue in ParameterValidationResult. Refactored duplicate code in GroupValidationResult. Removed IOException from NetworkUtil "throws". Replaced null/empty string tests with StringUtils.isBlank(). Added @FunctionalInterface where needed. Replaced anonymous classes with lambda expressions. Replaced duplicate strings with a constant. Added private constructors for utility classes. Removed sleep() from tests. Removed unused parameter from method call. Made some protected methods private. Compute integrity monitor's state-transition table once. Use for-loop instead of iterator. Moved constructors. Fixed some checkstyle issues (tabs => spaces, trailing spaces). Change-Id: I9a962ca45c4ff3f212c6014da799d06f07b232ef Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-01-09Remove policy/common integrity-audit suppressionsJim Hahn3-31/+31
Changed "DbDAO" to "DbDao". Change-Id: I51a6706cceef6857404ae7c12ce43e553ea0da29 Issue-ID: POLICY-1133 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-10-01Fix minor sonarPamela Dragosh2-65/+87
These are mainly duplicate strings. But also combined if statements and fixing some debug messages missing arguments or format specifiers. Some duplicates I left alone as it seemed unreadable to change them. Also moving variables to their correct place (before constructors). Issue-ID: POLICY-1130 Change-Id: I8018c676b22fe8fec635f129fa37921ad1004569 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2018-08-14Fixes for checkstyle issuesPamela Dragosh3-9/+14
More fixes for spacing, adding comments, adding period at the end, and move code closer to usage. Issue-ID: POLICY-881 Change-Id: Ife99eaf627a221e87d65d24dfd145b0ee4e06d21 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2018-06-21IntegrityAuditor: remove sleep from junit testsJim Hahn7-219/+115
Modified the code to use a CurrentTime object for its "time" operations (e.g., sleep(), currentTimeInMillis()). Modified junit tests to replace the CurrentTime object with TestTime objects so they don't actually do any sleeping. Reformat "commit" message. Remove TODO from junit test. Init testTime in junit setUp(). Add AuditorTime and test classes. Change "latch" to "semaphore" in comments. Change time units in junit test from SECONDS to MILLISECONDS. Add sleep() method to auditor test class. Reorder field qualifiers. Change utils scope to "compile" in pom. Change-Id: I8aa8b642b315156c00422192e4aa8e47b4503c2f Issue-ID: POLICY-908 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-06-20IntegrityAudit - remove latches from non-test codeJim Hahn2-76/+53
Change-Id: I5d5cc7d581f78d5551e2fe7447720403bb63ada2 Issue-ID: POLICY-908 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-03-20Removed checkstyle warningsmmis10-2565/+2520
Removed checkstyle warnings in policy/common/ia Issue-ID: POLICY-695 Change-Id: I25f589dff5ce1dba0681ba549a53087426593d71 Signed-off-by: mmis <michael.morris@ericsson.com>
2018-02-16Fix more generic exceptions in commonJim Hahn7-43/+66
Fixed a few more generic exceptions in integrity-audit and integrity-monitor. Fixed license dates. Change-Id: Ibbc21ae5f853896e0d3e416e33b5ea2a13672f62 Issue-ID: POLICY-246 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-02-13Speed up integrity-audit testsJim Hahn6-68/+322
Added additional DbDAO constructors to facilitate JUnit testing. Added DbDAO destroy() method to close the EntityManagerFactory. Pulled out common code into IntegrityAuditTestBase and subclassed the tests from there. Added hooks to IntegrityAudit so that the AuditThread timers could be set to smaller values so that all of the junit tests could be run in much less time. Added similar hooks to DbAudit. Modified integrity-audit tests to use new utility classes to auto-close JPA managers. Modified integrity-audit tests to use new utility class to scan logger items without the need to scan the actual log file. Added code to new test superclass to truncate the four ONAP logs. Modified hooks in IntegrityAuditEntity to adjust serialization so that dates are not serialized/de-serialized when used in junit tests. Deleted TestingUtils. Added a test for invalid nodeType property. Fixed issue wherein AuditThread doesn't stop when interrupted. Change-Id: I5101995b6b68655b2810777bc4d2ec80c7cbc363 Issue-ID: POLICY-582 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-02-02Removed commented code and add JUnit testsPamela Dragosh2-14/+12
* Useless assignments * Commented out code * Unused imports * Add simple JUnit for exception classes Issue-ID: POLICY-456 Change-Id: I012c2b6bdaf1b5803b2f1c37fd4d9514055e4ef0 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2018-02-01Fix sonar generic Exceptions in policy/commonJim Hahn2-33/+47
IntegrityMonitor.java: Renamed variables, Ex: dep_groups => depGroups. Renamed enum constants, Ex: pdp_xacml => PDP_XACML. Merged "if" tests. Cast values to "long" before multiplying. Re-throw interrupt(). Write exception via logger instead of e.printStackTrace(). Moved constructor to top of the file. Removed most logger.isDebugEnabled() checks. Returned generic List instead of ArrayList. Used entrySet() instead of keySet(). Removed useless parentheses. Removed superfluous exceptions from "throws" declaration. DbAudit.java: Modified DbAudit to throw DbAuditException. Replaced references to HashSet and HashMap with generic Set and Map. Modified DbAudit to iterate over entrySet() instead of keySet(). ComponentAdminException: Created ComponentAdminException class. Modified ComponentAdmin methods to throw new exception class. Extracted "stateManager" String constant. Eliminated logger.isDebugEnabled() calls. Updated the license data. Eliminated double-checked locking problem from PropertyUtil: Modified code to use Initialization On Demand Holder idiom. Change-Id: Ic01288542041da26df483ce85ecaf292ac138f85 Issue-ID: POLICY-246 Signed-off-by: Jim Hahn <jrh3@att.com>
2017-12-05Fix technical debt in common integrity-auditTemoc Rodriguez7-4/+9
Address technical debt in policy/common integrity-audit submodule. Implementation for empty constructors, remove useless assignment, use <> on constructor, use @Override. Not all technical debt addressed, only the ones specified by Pam in POLICY-336, except the use Set instead of HashSet where a method signature would change. Issue-ID: POLICY-456 Change-Id: If8f9f4151503bdd22c8c405485538f8be779cabd Signed-off-by: Temoc Rodriguez <cr056n@att.com>
2017-12-04Fix bug where paramsAreBad doesn't update stringTemoc Rodriguez2-52/+59
Replaced the string parameter with a StringBuilder so that the modified version can be accessed outside the method, since strings are immutable. Added null check for properties. Removed trim on properties in case the property is null. Added junit to test that the modified StringBuilder can be read outside the paramsAreBad method. Issue-ID: POLICY-492 Change-Id: I0550e9d639cbbcc876e6aafb84f6e9a363b653ff Signed-off-by: Temoc Rodriguez <cr056n@att.com>
2017-11-10Fix fortify Issue on Privacy ViolationJoseph Chou1-3/+1
Remove the line where password get stored in variable Issue-ID: POLICY-442 Change-Id: I5d474c7a27dfbdcf49b5f1578be75bd2cb627afe Signed-off-by: Joseph Chou <jc2555@att.com>
2017-09-14Fix sonar critical for passwordPamela Dragosh1-4/+0
Focused on hard coded passwords. I believe they are only used for JUnit tests so I moved them into a file for use. If they still show up on sonar then I will move into a properties file and/or mark as not going to fix. Issue-ID: POLICY-237 Change-Id: I6fa561714091043a2ea5e2edfb0441c2dfc8b044 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2017-09-14Logging exceptions to clear sonar criticalPamela Dragosh1-9/+1
Just logging the exceptions anyway and remove e.printstack since that goes to stdout/stderr. Issue-ID: POLICY-195 Change-Id: I60616bd6ce633e2fcae266bb37eb735c6e6bb4c4 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2017-09-12Fix sonar critical associated with loggingPamela Dragosh1-29/+4
Addressing the following sonar critical: Use a logger to log this exception Either log or rethrow this exception It does not hurt to simply do these as well as clean out lines of code that dump to Sys.out via e.printStackTrace. Issue-ID: POLICY-195 Change-Id: Ibc328094a0653b7baa04778298e4a69955105ea3 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2017-09-06Added license header to exception classMagnusen, Drew (dm741q)1-0/+20
Included license header in IntegrityAuditException class since it was accidentally omitted when class was originally created. Issue-ID: POLICY-96 Change-Id: Idcb24e8c7fc6b5a17dc96b51c227be3e24be2bda Signed-off-by: Magnusen, Drew (dm741q) <dm741q@att.com>
2017-08-11Sonar cleanup for integrity-auditMagnusen, Drew (dm741q)7-30/+61
Modified classes in integrity-audit module to resolve major sonar issues. Issue-ID: [POLICY-96] Change-Id: I5ef0abb8d2a3ea1ae93edc00363c4d2bea1747e2 Signed-off-by: Magnusen, Drew (dm741q) <dm741q@att.com>
2017-08-04[POLICY-96] Resolved sonar blockers in im/ia.Magnusen, Drew (dm741q)1-14/+38
Resolved 7 sonar blockers in the integrity monitor and integrity audit projects. Change-Id: I7bba7619d3b71f7aebcc2642d07a64876ee7aea0 Signed-off-by: Magnusen, Drew (dm741q) <dm741q@att.com>
2017-07-31[POLICY-71] replace openecomp for policy-commonGuo Ruijing9-0/+2579
Change-Id: I3241f5d1f0234043b4dff718eda1ffdc48052276 Signed-off-by: Guo Ruijing <ruijing.guo@intel.com> Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>