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

Full documentation about extending the plugin #27

Merged
merged 48 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
4d9c865
add docs
hugoqnc Jun 17, 2024
dbb72cc
full intro
hugoqnc Jun 18, 2024
a17c1e6
update
hugoqnc Jun 18, 2024
ffed985
four classes to use in generics
hugoqnc Jun 18, 2024
8c82756
engine
hugoqnc Jun 19, 2024
2ca2970
check registrar
hugoqnc Jun 19, 2024
105790c
finish 1st part
hugoqnc Jun 19, 2024
f2c7a78
update
hugoqnc Jun 19, 2024
7e23372
edit tree link
hugoqnc Jun 19, 2024
672087f
update
hugoqnc Jun 19, 2024
3c531c4
Detailed explanations
hugoqnc Jun 20, 2024
3fd7047
finish Detailed explanations
hugoqnc Jun 21, 2024
41ef55b
example
hugoqnc Jun 21, 2024
104e565
special cases
hugoqnc Jun 21, 2024
ae5796a
update
hugoqnc Jun 21, 2024
4c33834
update
hugoqnc Jun 24, 2024
a3cb2f5
translation
hugoqnc Jun 24, 2024
0987f6c
reorganization rules
hugoqnc Jun 25, 2024
f78a82d
translation
hugoqnc Jun 25, 2024
80ab95a
asserts and graphs
hugoqnc Jun 25, 2024
e7cdf83
update main readme
hugoqnc Jun 25, 2024
0012437
mistakes
hugoqnc Jun 25, 2024
8c5a7e5
proofread language support
hugoqnc Jun 26, 2024
946a7c4
proofread detection rules
hugoqnc Jun 26, 2024
ead0905
diagrams
hugoqnc Jun 26, 2024
3e98ad0
disclaimer
hugoqnc Jun 26, 2024
1b1b005
architecture diagram
hugoqnc Jun 26, 2024
9e1243a
fix
hugoqnc Jun 27, 2024
198556b
Update docs/DETECTION_RULE_STRUCTURE.md
hugoqnc Jul 1, 2024
00c92b2
Update docs/DETECTION_RULE_STRUCTURE.md
hugoqnc Jul 1, 2024
7e51bf1
Update docs/DETECTION_RULE_STRUCTURE.md
hugoqnc Jul 1, 2024
12c3b6e
Apply suggestions from code review
hugoqnc Jul 1, 2024
1c54269
coherence
hugoqnc Jul 1, 2024
70f5869
Function3 footnote
hugoqnc Jul 1, 2024
d6d5f2e
fix
hugoqnc Jul 1, 2024
ba8d35e
clarifications
hugoqnc Jul 1, 2024
916ffb1
Apply suggestions from code review
hugoqnc Jul 1, 2024
2c29f63
fix
hugoqnc Jul 1, 2024
026b262
Apply suggestions from code review
hugoqnc Jul 1, 2024
73aee67
fix
hugoqnc Jul 1, 2024
c42f447
Apply suggestions from code review
hugoqnc Jul 1, 2024
71766fd
fix
hugoqnc Jul 1, 2024
00617d5
Apply suggestions from code review
hugoqnc Jul 1, 2024
96d2fd3
fix
hugoqnc Jul 2, 2024
71e4760
fix a rule
hugoqnc Jul 2, 2024
47e57b0
fix
hugoqnc Jul 2, 2024
c4b5858
final fix of detection_rule_structure
hugoqnc Jul 2, 2024
4b4bd6a
Apply suggestions from code review
hugoqnc Jul 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,16 @@ in source code and generates [CBOM](https://cyclonedx.org/capabilities/cbom/).
| Language | Cryptographic Library | Coverage |
|----------|-----------------------------------------------------------------------------------------------|----------|
| Java | [JCA](https://docs.oracle.com/javase/8/docs/technotes/guides/security/crypto/CryptoSpec.html) | 100% |
| | [BouncyCastle](https://github.com/bcgit/bc-java) | 80% |
| | [BouncyCastle](https://github.com/bcgit/bc-java) (*light-weight API*) | 100%[^1] |
| Python | [pyca/cryptography](https://cryptography.io/en/latest/) | 100% |

> The plugin is designed so that it can be extended to support additional languages and recognition rules to support more libraries. Detailed instructions on how to add new languages and recognition rules will follow shortly.

[^1]: We only cover the BouncyCastle *light-weight API* according to [this specification](https://javadoc.io/static/org.bouncycastle/bctls-jdk14/1.75/specifications.html)

> [!NOTE]
> The plugin is designed in a modular way so that it can be extended to support additional languages and recognition rules to support more libraries.
> - To add support for another language or cryptography library, see [*Extending the Sonar Cryptography Plugin to add support for another language or cryptography library*](./docs/LANGUAGE_SUPPORT.md)
> - If you just want to know more about the syntax for writing new detection rules, see [*Writing new detection rules for the Sonar Cryptography Plugin*](./docs/DETECTION_RULE_STRUCTURE.md)

## Installation

Expand Down
324 changes: 324 additions & 0 deletions docs/DETECTION_RULE_STRUCTURE.md

Large diffs are not rendered by default.

581 changes: 581 additions & 0 deletions docs/LANGUAGE_SUPPORT.md

Large diffs are not rendered by default.

Binary file added docs/images/architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/reorganization.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/translation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ private BcKeyParameter() {
.withMethodParameter("int")
.withMethodParameter("int")
.shouldBeDetectedAs(new KeySizeFactory<>(Size.UnitType.BIT))
.asChildOfParameterWithId(-1)
.buildForContext(
new AlgorithmParameterContext(AlgorithmParameterContext.Kind.KEY))
.inBundle(() -> "BcKeyParameter")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ private AsymmetricBlockCipherReorganizer() {
(node, parent, roots) -> {
INode oaepChild =
node.getChildren()
.get(OptimalAsymmetricEncryptionPadding.class)
.deepCopy();
.get(OptimalAsymmetricEncryptionPadding.class);
INode messageDigestChild =
node.getChildren().get(MessageDigest.class).deepCopy();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.ibm.plugin.translation;
package com.ibm.plugin.translation.translator;

import com.ibm.mapper.configuration.Configuration;
import javax.annotation.Nonnull;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import com.ibm.mapper.ITranslator;
import com.ibm.mapper.model.*;
import com.ibm.mapper.utils.DetectionLocation;
import com.ibm.plugin.translation.JavaMapperConfig;
import com.ibm.plugin.translation.translator.contexts.*;
import java.util.List;
import java.util.Map;
Expand Down
Loading