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

Fix windows encoding issues #2206

Merged
merged 3 commits into from
Nov 2, 2022

Conversation

peternied
Copy link
Member

@peternied peternied commented Oct 29, 2022

Description

Fix windows encoding issues

Adds spotbugs [1] to detect internationalization before they are added to the codebase, also fixed several encoding bugs that impact windows users.

[1] https://spotbugs.readthedocs.io/en/stable/index.html

Issues Resolved

Check List

  • New functionality includes testing
  • New functionality has been documented
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Adds spotbugs [1] to detect internalization before they are added to the codebase, also fixed several encoding bugs that impact windows users.

[1] https://spotbugs.readthedocs.io/en/stable/index.html

Closes opensearch-project#2194

Signed-off-by: Peter Nied <[email protected]>
@peternied peternied added windows backport 2.x backport to 2.x branch v2.4.0 'Issues and PRs related to version v2.4.0' labels Oct 29, 2022
@peternied peternied requested a review from a team October 29, 2022 00:55
@codecov-commenter
Copy link

codecov-commenter commented Oct 29, 2022

Codecov Report

Attention: Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.

Project coverage is 61.11%. Comparing base (a57fd0a) to head (747e962).
Report is 722 commits behind head on main.

Files with missing lines Patch % Lines
...dlic/auth/http/saml/AuthTokenProcessorHandler.java 0.00% 1 Missing ⚠️
...a/org/opensearch/security/tools/SecurityAdmin.java 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #2206      +/-   ##
============================================
+ Coverage     61.05%   61.11%   +0.06%     
  Complexity     3270     3270              
============================================
  Files           259      259              
  Lines         18335    18335              
  Branches       3248     3248              
============================================
+ Hits          11194    11206      +12     
+ Misses         5555     5542      -13     
- Partials       1586     1587       +1     
Files with missing lines Coverage Δ
...earch/security/auditlog/impl/AbstractAuditLog.java 73.75% <100.00%> (ø)
...ty/configuration/ConfigurationLoaderSecurity7.java 70.43% <100.00%> (ø)
...ensearch/security/ssl/DefaultSecurityKeyStore.java 67.83% <100.00%> (ø)
.../org/opensearch/security/support/ConfigHelper.java 86.00% <100.00%> (ø)
...dlic/auth/http/saml/AuthTokenProcessorHandler.java 47.28% <0.00%> (ø)
...a/org/opensearch/security/tools/SecurityAdmin.java 36.60% <0.00%> (ø)

... and 7 files with indirect coverage changes

.github/workflows/ci.yml Show resolved Hide resolved
<Match>
<Bug category="I18N" />
</Match>
</FindBugsFilter>
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think this should be added as a separate PR or is fine to include it in this one even though it seems not directly related to the parsing issue--maybe it is and I am wrong?

Copy link
Member

Choose a reason for hiding this comment

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

This is helpful to find instances where the code is relying on the default encoding. See https://spotbugs.readthedocs.io/en/latest/bugDescriptions.html?highlight=i18n#dm-reliance-on-default-encoding-dm-default-encoding

Copy link
Member Author

@peternied peternied Oct 31, 2022

Choose a reason for hiding this comment

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

I did not add more rules because we are in violation of many different rules, but I didn't see any types that would create platform specific issues.

If you'd like to see the full list, delete line 3 and run the gradle task, you'll see hundreds of things!

cwperks
cwperks previously approved these changes Oct 31, 2022
@peternied
Copy link
Member Author

@cwperks @DarshitChanpura Ready for review, thanks!

@peternied
Copy link
Member Author

@opensearch-project/security Can I get another review on this please?

@DarshitChanpura DarshitChanpura merged commit a040b86 into opensearch-project:main Nov 2, 2022
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.x 2.x
# Navigate to the new working tree
cd .worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-2206-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 a040b86a48eebcbe2791ba6371772fb9d386d6f2
# Push it to GitHub
git push --set-upstream origin backport/backport-2206-to-2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-2206-to-2.x.

@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.4 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.4 2.4
# Navigate to the new working tree
cd .worktrees/backport-2.4
# Create a new branch
git switch --create backport/backport-2206-to-2.4
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 a040b86a48eebcbe2791ba6371772fb9d386d6f2
# Push it to GitHub
git push --set-upstream origin backport/backport-2206-to-2.4
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.4

Then, create a pull request where the base branch is 2.4 and the compare/head branch is backport/backport-2206-to-2.4.

peternied added a commit that referenced this pull request Nov 2, 2022
Adds spotbugs [1] to detect internalization before they are added to the codebase, also fixed several encoding bugs that impact windows users.

[1] https://spotbugs.readthedocs.io/en/stable/index.html

Closes #2194

Signed-off-by: Peter Nied <[email protected]>
(cherry picked from commit a040b86)
peternied added a commit that referenced this pull request Nov 2, 2022
Adds spotbugs [1] to detect internalization before they are added to the codebase, also fixed several encoding bugs that impact windows users.

[1] https://spotbugs.readthedocs.io/en/stable/index.html

Closes #2194

Signed-off-by: Peter Nied <[email protected]>
(cherry picked from commit a040b86)
@peternied
Copy link
Member Author

Manual backports created:

@peternied peternied deleted the spotbugs branch November 2, 2022 17:46
cwperks pushed a commit that referenced this pull request Nov 2, 2022
Adds spotbugs [1] to detect internalization before they are added to the codebase, also fixed several encoding bugs that impact windows users.

[1] https://spotbugs.readthedocs.io/en/stable/index.html

Closes #2194

Signed-off-by: Peter Nied <[email protected]>
(cherry picked from commit a040b86)
cwperks pushed a commit that referenced this pull request Nov 2, 2022
Adds spotbugs [1] to detect internalization before they are added to the codebase, also fixed several encoding bugs that impact windows users.

[1] https://spotbugs.readthedocs.io/en/stable/index.html

Closes #2194

Signed-off-by: Peter Nied <[email protected]>
(cherry picked from commit a040b86)
stephen-crawford pushed a commit to stephen-crawford/security that referenced this pull request Nov 10, 2022
…ject#2218)

Adds spotbugs [1] to detect internalization before they are added to the codebase, also fixed several encoding bugs that impact windows users.

[1] https://spotbugs.readthedocs.io/en/stable/index.html

Closes opensearch-project#2194

Signed-off-by: Peter Nied <[email protected]>
(cherry picked from commit a040b86)
stephen-crawford pushed a commit to stephen-crawford/security that referenced this pull request Nov 10, 2022
Adds spotbugs [1] to detect internalization before they are added to the codebase, also fixed several encoding bugs that impact windows users.

[1] https://spotbugs.readthedocs.io/en/stable/index.html

Closes opensearch-project#2194

Signed-off-by: Peter Nied <[email protected]>
Signed-off-by: Stephen Crawford <[email protected]>
stephen-crawford pushed a commit to stephen-crawford/security that referenced this pull request Nov 10, 2022
…ject#2218)

Adds spotbugs [1] to detect internalization before they are added to the codebase, also fixed several encoding bugs that impact windows users.

[1] https://spotbugs.readthedocs.io/en/stable/index.html

Closes opensearch-project#2194

Signed-off-by: Peter Nied <[email protected]>
(cherry picked from commit a040b86)
Signed-off-by: Stephen Crawford <[email protected]>
stephen-crawford pushed a commit to stephen-crawford/security that referenced this pull request Nov 10, 2022
…ject#2218)

Adds spotbugs [1] to detect internalization before they are added to the codebase, also fixed several encoding bugs that impact windows users.

[1] https://spotbugs.readthedocs.io/en/stable/index.html

Closes opensearch-project#2194

Signed-off-by: Peter Nied <[email protected]>
(cherry picked from commit a040b86)
Signed-off-by: Stephen Crawford <[email protected]>
@cwperks cwperks added the backport 1.3 backport to 1.3 branch label Dec 1, 2022
@opensearch-trigger-bot
Copy link
Contributor

The backport to 1.3 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-1.3 1.3
# Navigate to the new working tree
cd .worktrees/backport-1.3
# Create a new branch
git switch --create backport/backport-2206-to-1.3
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 a040b86a48eebcbe2791ba6371772fb9d386d6f2
# Push it to GitHub
git push --set-upstream origin backport/backport-2206-to-1.3
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-1.3

Then, create a pull request where the base branch is 1.3 and the compare/head branch is backport/backport-2206-to-1.3.

@cwperks cwperks mentioned this pull request Dec 1, 2022
13 tasks
peternied added a commit to peternied/security that referenced this pull request Dec 1, 2022
Adds spotbugs [1] to detect internalization before they are added to the codebase, also fixed several encoding bugs that impact windows users.

[1] https://spotbugs.readthedocs.io/en/stable/index.html

Closes opensearch-project#2194

Signed-off-by: Peter Nied <[email protected]>
stephen-crawford pushed a commit to stephen-crawford/security that referenced this pull request Dec 2, 2022
Adds spotbugs [1] to detect internalization before they are added to the codebase, also fixed several encoding bugs that impact windows users.

[1] https://spotbugs.readthedocs.io/en/stable/index.html

Closes opensearch-project#2194

Signed-off-by: Peter Nied <[email protected]>
peternied added a commit that referenced this pull request Dec 6, 2022
Windows build and test support for 1.3

- Use most recent format of CI workflows from main
- Backport #2206
- Supply workarounds for JDK8 incompatible APIs for Encoding / Pattern matching (Thanks @cwperks!)
- Backport only freeport logic from #1638
- Backport #1758
- All updates to TestAuditlogImpl.java from main
  - #2180
  - #1935 
  - #1920
  - #1914
  - #1829 
  - And Targeted test updates for ComplianceAuditlogTest and BasicAuditlogTest to keep up with TestAuditlogImpl.java updates

Signed-off-by: Peter Nied <[email protected]>
Signed-off-by: Stephen Crawford <[email protected]>
Signed-off-by: Stephen Crawford <[email protected]>
Co-authored-by: Stephen Crawford <[email protected]>
wuychn pushed a commit to ochprince/security that referenced this pull request Mar 16, 2023
…ject#2217)

Adds spotbugs [1] to detect internalization before they are added to the codebase, also fixed several encoding bugs that impact windows users.

[1] https://spotbugs.readthedocs.io/en/stable/index.html

Closes opensearch-project#2194

Signed-off-by: Peter Nied <[email protected]>
(cherry picked from commit a040b86)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 1.3 backport to 1.3 branch backport 2.x backport to 2.x branch backport 2.4 v2.4.0 'Issues and PRs related to version v2.4.0' windows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Windows] Configuration values are improperly decoded
5 participants