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

V3 Refactor #169

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from
Draft

V3 Refactor #169

wants to merge 13 commits into from

Conversation

Celerium
Copy link
Contributor

@Celerium Celerium commented Oct 7, 2024

Quite a bit got over with this but I've overhauled the ITGlueAPI module. I did this simply because this module got me into writing API wrappers/other PowerShell projects and I wanted to give back to the community as a way of saying thank you.

I have tested every function and the majority of their associated parameters/parameter sets and have not run across any issues yet. With that being said there are a lot of changes and I easily could have missed some things. I have also supplied some generic test scripts in the "examples" folder to help perform general tests when it comes to creating, updating, & deleting data in ITGlue. I labeled this as v3 because while I did my best with backward compatibility, the amount of changes in this PR could cause some breaking changes.

I have working examples for all the changes in my branch over at my repo. This should help with any of the GitHub pages & Azure DevOps pipeline questions. Adjustments will need to be made accordingly if this PR is accepted as GitHub Pages, Azure DevOps, and ReadMe links are dependent on these resources and their specific web URLs.

I am not married to any of the proposed changes I am suggesting and encourage any conversations on anything that could be adjusted.

Issues this PR should resolve

  1. UTF-8 Encoding Error #167 (fixed from previous Specify UTF-8 in API requests to support Unicode characters #162 )
  2. Enable tab completion support for -include parameter #155 (tab completion added to all supported commands with reference documentation on allowed values depending on parameter set user)
  3. Audit module against current IT Glue API documentation #154 (manual tracking CSV, since ITGlue doesn't offer an API spec)
  4. Consider PascalCase Parameter Aliases #153 (All commands and parameters have been converted to PascalCase with backward compatibility in the form of aliases)
  5. Return Related Items from configurations / flexible assets #132 (Added to applicable functions)
  6. Troubleshooting New-ITGlueAttachments Forbidden #108 (Validated/updated attachment functions, everything should be gtg)
  7. Addition of Comment Based help #56 (All comment based help should now be in place/up-to-date)
  8. Support Revision History Parameters #30 (I believe this is in place now with all the updated function parameters)

Interesting discovery

OTP Passwords
#138 (This endpoint showed up a while ago but disappears off and on randomly from their documentation page. ITGlue might be trying to support this but as of 2024-10-07 it is no longer on their developer page again.)

Changes

  • Not an exhausted listed

Pester Tests

  1. Built out more robust tests
  2. Should be compatible with cross-platform
  3. The "tests" folder was moved out of the ITGlueAPI module folder into the root of the repo

GitHub Pages

  1. PowerShell help now redirects to GitHub pages with secondary links going to ITGlues developer documentation
  2. This will have to be turned on for the ITGlue repo "Settings > Pages > Deploy from branch > Master > docs"
  3. Examples found at My repo
  4. Links/formats will need to be adjusted to ITGlue repo. I think I converted the links correctly but it is a little hard to test other repos pages in my PR ;)

Azure DevOps (Pipelines)

  1. Runs cross-platform build tests for various items. Pester tests, help updating, module building...etc
  2. Examples found at My Azure DevOps page

Other changes

  1. Switched from "Internal" & "Resources" to "Public" & "Private"
  2. Module is now compiled into a single "psd1" & "psm1" (See "build > ITGlueAPI > Version#" for details)
  3. Verbose output added to all commands to help with troubleshooting.
  4. Each command will save general function data to global variables to also help with troubleshooting.
  • Example Get-ITGlueUser -ID 8675309
  • $Invoke_ITGlueRequest_Parameters = Information about the API call
  • $Get_ITGlueUser_Parameters = Information about the parameters users
  • $Get_ITGlueUser_ParametersQuery = Information about the query filters used
  1. Functions that modify data now support "ShouldProcess" (Might need some tweaks here)
  2. All functions now have a begin, process, & end to support input processing methods
  3. Some functions now have pipeline support
  • Example 8675309,123456 |Get-ITGlueUser
  1. Examples are consolidated into a single "examples" folder instead of having two different repos.
  2. ReadMe page updated with new information and format (pictures, links..etc)
  3. New and updated Issue & PR templates

Celerium and others added 12 commits October 7, 2024 10:16
Bumps [idna](https://github.com/kjd/idna) from 2.8 to 3.7.
- [Release notes](https://github.com/kjd/idna/releases)
- [Changelog](https://github.com/kjd/idna/blob/master/HISTORY.rst)
- [Commits](kjd/idna@v2.8...v3.7)

---
updated-dependencies:
- dependency-name: idna
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.24.1 to 1.26.19.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](urllib3/urllib3@1.24.1...1.26.19)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
…oling-Scripts/urllib3-1.26.19

Bump urllib3 from 1.24.1 to 1.26.19 in /examples/Python Tooling Scripts
…oling-Scripts/idna-3.7

Bump idna from 2.8 to 3.7 in /examples/Python Tooling Scripts
@adrianwells
Copy link
Collaborator

@Celerium this is an impressive contribution. Thank you! Will attempt to review.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at {{ email }}. All
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like an email address is desired here, thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ya there are a few placeholder items throughout this commit that I couldn't populate as I didn't know if this proposed change would be accepted plus what item to use in its place.

Copy link
Collaborator

Choose a reason for hiding this comment

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

OK. Just noting them for now.


The "ITGlueAPI" team and community take all security bugs in "ITGlueAPI" seriously. Thank you for improving the security of "ITGlueAPI". We appreciate your efforts and responsible disclosure and will make every effort to acknowledge your contributions.

Report security bugs by emailing the lead maintainer at [[email protected]]([email protected]) and include the word "SECURITY" in the subject line..
Copy link
Collaborator

Choose a reason for hiding this comment

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

Another email address placeholder and bonus period at end of line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops, that'll be an easy fix, and ya another placeholder from a canned security readme

.github/SECURITY.md Outdated Show resolved Hide resolved

Discuss how someone should disclose a vulnerability to "ITGlueAPI", in tl;dr ( or ELI5 ) language. Then expand on this with "How To Disclose a vulnerability in detail". Please give detailed steps on how to disclose the vulnerability. Keep these OWASP guidelines in mind ( <https://www.owasp.org/index.php/Vulnerability_Disclosure_Cheat_Sheet> ) when creating your disclosure policy. Below are some recommendations for security disclosures:

- "ITGlueAPI" security contact { [[email protected]]([email protected]) }
Copy link
Collaborator

Choose a reason for hiding this comment

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

Another email address placeholder for consideration

@davidhaymond
Copy link
Collaborator

Thanks for this massive contribution, @Celerium! I'll attempt to review it this week.

Copy link

Choose a reason for hiding this comment

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

While we are possibly introducing some slightly breaking changes in this PR, might I suggest updating the ApiKey parameter from a string to [System.Security.SecureString] to allow piping directly a secure string object for the API key directly to the function.

This would help to prevent possible capture by logging, and a few additional benefits as well. Please let me know if there are any thoughts, thx.

Suggested change
Add-ITGlueAPIKey -ApiKey (ConvertTo-SecureString 'some_api_key' -AsPlainText)
Will use the seucre string entered into the [ -ApiKey ] parameter
.EXAMPLE
(ConvertTo-SecureString '12345' -AsPlainText) | Add-ITGlueAPIKey
Will use the secure string passed into it as its API key
.NOTES
N/A
.LINK
https://itglue.github.io/ITGlue-PowerShellWrapper/site/Internal/Add-ITGlueAPIKey.html
.LINK
https://github.com/itglue/powershellwrapper
#>
[CmdletBinding()]
[Alias('Set-ITGlueAPIKey')]
Param (
[Parameter(Mandatory = $true, ValueFromPipeline = $true)]
[AllowEmptyString()]
[Alias('Api_Key')]
[securestring]$ApiKey
)
begin {}
process{
Set-Variable -Name 'ITGlue_API_Key' -Value $ApiKey -Option ReadOnly -Scope Global -Force
}

@Celerium
Copy link
Contributor Author

Hi everyone

I just wanted to check in and see if this is something that would like to be done. Is there anything I can help with or better explain?

I would also like to throw out that if this isn't something that interests the community I will not take offense if you say thank you but we're good and close it.

@davidhaymond
Copy link
Collaborator

@Celerium Once again, I thank you for your contribution. I wonder if it would be better to open a new PR for each independent change you'd like to make. Keeping each change separate will help with review, community discussion, and keeping a clean commit history. This PR is difficult to review because it is such a significant overhaul, and I haven't had the time yet to parse through it all.

@adrianwells, thoughts on this?

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.

4 participants