{"id":19336542,"url":"https://github.com/spt-development/spt-development-audit-spring","last_synced_at":"2025-09-15T12:41:05.638Z","repository":{"id":39926089,"uuid":"340074297","full_name":"spt-development/spt-development-audit-spring","owner":"spt-development","description":"Adds auditing to your project through the use of annotations typically added to Service methods.","archived":false,"fork":false,"pushed_at":"2025-07-06T15:42:45.000Z","size":217,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-06T16:30:56.426Z","etag":null,"topics":["auditing","spring"],"latest_commit_sha":null,"homepage":"https://github.com/spt-development/spt-development-audit-spring","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spt-development.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-02-18T14:24:18.000Z","updated_at":"2025-07-06T15:42:47.000Z","dependencies_parsed_at":"2023-10-15T09:47:08.253Z","dependency_job_id":"dbf87cb0-2027-4079-b6ef-728a57d66335","html_url":"https://github.com/spt-development/spt-development-audit-spring","commit_stats":null,"previous_names":[],"tags_count":44,"template":false,"template_full_name":null,"purl":"pkg:github/spt-development/spt-development-audit-spring","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spt-development%2Fspt-development-audit-spring","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spt-development%2Fspt-development-audit-spring/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spt-development%2Fspt-development-audit-spring/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spt-development%2Fspt-development-audit-spring/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spt-development","download_url":"https://codeload.github.com/spt-development/spt-development-audit-spring/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spt-development%2Fspt-development-audit-spring/sbom","scorecard":{"id":842726,"data":{"date":"2025-08-11","repo":{"name":"github.com/spt-development/spt-development-audit-spring","commit":"3c208fb58b1006038e63e5bd0ff52ee5831b1fd1"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/23 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":7,"reason":"9 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 7","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:38: update your workflow using https://app.stepsecurity.io/secureworkflow/spt-development/spt-development-audit-spring/build.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:44: update your workflow using https://app.stepsecurity.io/secureworkflow/spt-development/spt-development-audit-spring/build.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:54: update your workflow using https://app.stepsecurity.io/secureworkflow/spt-development/spt-development-audit-spring/build.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:75: update your workflow using https://app.stepsecurity.io/secureworkflow/spt-development/spt-development-audit-spring/build.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/spt-development/spt-development-audit-spring/build.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/spt-development/spt-development-audit-spring/build.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/spt-development/spt-development-audit-spring/build.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/latest-versions.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/spt-development/spt-development-audit-spring/latest-versions.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/latest-versions.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/spt-development/spt-development-audit-spring/latest-versions.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/owasp.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/spt-development/spt-development-audit-spring/owasp.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/owasp.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/spt-development/spt-development-audit-spring/owasp.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/owasp.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/spt-development/spt-development-audit-spring/owasp.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/owasp.yml:39: update your workflow using https://app.stepsecurity.io/secureworkflow/spt-development/spt-development-audit-spring/owasp.yml/main?enable=pin","Info:   0 out of   7 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   6 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/build.yml:1","Warn: no topLevel permission defined: .github/workflows/latest-versions.yml:1","Warn: no topLevel permission defined: .github/workflows/owasp.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact 3.0.30 not signed: https://api.github.com/repos/spt-development/spt-development-audit-spring/releases/230295654","Warn: release artifact 3.0.29 not signed: https://api.github.com/repos/spt-development/spt-development-audit-spring/releases/220800825","Warn: release artifact 3.0.28 not signed: https://api.github.com/repos/spt-development/spt-development-audit-spring/releases/216362580","Warn: release artifact 3.0.27 not signed: https://api.github.com/repos/spt-development/spt-development-audit-spring/releases/210559449","Warn: release artifact 3.0.26 not signed: https://api.github.com/repos/spt-development/spt-development-audit-spring/releases/196823349","Warn: release artifact 3.0.30 does not have provenance: https://api.github.com/repos/spt-development/spt-development-audit-spring/releases/230295654","Warn: release artifact 3.0.29 does not have provenance: https://api.github.com/repos/spt-development/spt-development-audit-spring/releases/220800825","Warn: release artifact 3.0.28 does not have provenance: https://api.github.com/repos/spt-development/spt-development-audit-spring/releases/216362580","Warn: release artifact 3.0.27 does not have provenance: https://api.github.com/repos/spt-development/spt-development-audit-spring/releases/210559449","Warn: release artifact 3.0.26 does not have provenance: https://api.github.com/repos/spt-development/spt-development-audit-spring/releases/196823349"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 15 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-j288-q9x7-2f5v"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T20:49:54.414Z","repository_id":39926089,"created_at":"2025-08-23T20:49:54.415Z","updated_at":"2025-08-23T20:49:54.415Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275260465,"owners_count":25433378,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-15T02:00:09.272Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["auditing","spring"],"created_at":"2024-11-10T03:11:35.739Z","updated_at":"2025-09-15T12:41:05.608Z","avatar_url":"https://github.com/spt-development.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"````\n  ____  ____ _____   ____                 _                                  _   \n / ___||  _ \\_   _| |  _ \\  _____   _____| | ___  _ __  _ __ ___   ___ _ __ | |_ \n \\___ \\| |_) || |   | | | |/ _ \\ \\ / / _ \\ |/ _ \\| '_ \\| '_ ` _ \\ / _ \\ '_ \\| __|\n  ___) |  __/ | |   | |_| |  __/\\ V /  __/ | (_) | |_) | | | | | |  __/ | | | |_ \n |____/|_|    |_|   |____/ \\___| \\_/ \\___|_|\\___/| .__/|_| |_| |_|\\___|_| |_|\\__|\n                                                 |_|                                           \n audit-spring -------------------------------------------------------------------\n````\n\n[![build_status](https://github.com/spt-development/spt-development-audit-spring/actions/workflows/build.yml/badge.svg)](https://github.com/spt-development/spt-development-audit-spring/actions)\n\nAdds auditing to your project through the use of annotations typically added to Service methods.\n\nUsage\n=====\n\nRegister the Aspect as a Spring Bean manually or by adding the  \n[spt-development/spt-development-audit-spring-boot](https://github.com/spt-development/spt-development-audit-spring-boot)\nstarter to your project's pom.\n\n```java\n@Configuration\npublic class AuditConfig {\n    private final String appName;\n    private final String appVersion;\n    private final AuditEventCommand auditEventCommand;\n\n    public AuditConfig(\n            @Value(\"${spring.application.name}\")\n            final String appName,\n            final AuditEventCommand auditEventCommand,\n            final BuildProperties buildProperties) {\n\n        this.appName = appName;\n        this.appVersion = buildProperties.getVersion();\n        this.auditEventCommand = auditEventCommand;\n    }\n\n    @Bean\n    public Auditor auditor() {\n        return new Auditor(appName, appVersion, auditEventWriter(), authenticationAdapterFactory());\n    }\n\n    ...\n}\n```\n\nThe Auditor aspect requires an `AuditEventWriter` and an `AuthenticationAdapterFactory` bean that can again be registered\nmanually or with the starter.\n\n```java\n@Bean\npublic AuditEventWriter auditEventWriter() {\n    return new Slf4jAuditEventWriter();\n}\n\n@Bean\npublic AuthenticationAdapterFactory authenticationAdapterFactory() {\n    return new AuthenticationAdapterFactory();\n}\n```    \n\nThe `Slf4jAuditEventWriter` simply logs the audit events with SLF4j which for production probably isn't particularly\nuseful and should be replaced either with `JmsAuditEventWriter` or a custom implementation of `AuditEventWriter` that\nwrites the audit events to a database for instance.\n\nThe `AuthenticationAdapterFactory` is used by the `Auditor` aspect to retrieve details about the currently logged-in\nuser. Anonymous, and basic username/password authentication are supported by the `DefaultAuthenticationAdapterFactory`\nimplementation. If using the default implementation, it may be necessary to customize how the user details are \nretrieved - the default implementation for username/password returns `null` for the user ID for instance - this is \npossible by providing custom factories for creating the adapters, for example:\n\n```java\n@Bean\npublic AuthenticationAdapterFactory authenticationAdapterFactory() {\n    return new DefaultAuthenticationAdapterFactory()\n            .withUsernamePasswordFactory(auth -\u003e new MyAuthenticationAdapter((MyPrincipal)auth.getPrincipal()));\n}\n```\n\nFor other types of authentication such as OAuth2, it will be necessary to implement a custom \n`AuthenticationAdapterFactory`.\n\nAuditing methods\n----------------\n\nAuditing is applied by annotating methods with the `@Audited` annotation. It is envisaged that auditing will be applied\npredominantly to methods belonging to classes annotated with the `org.springframework.stereotype.Service`\nannotation, however there is nothing in the implementation that prevents other methods being annotated with the\n`@Audited` annotation instead/as well.\n\nThe first example shows the simplest form of auditing. The `@Audited` annotation is added to the method to be audited \nand the `type` and `subType` must be set. This will result in an `AuditEvent` being generated with the `type` and \n`subType` set as specified, along with the application details, authentication details relating to the current user, \nhost name and timestamp.\n\n```java\n@Audited(type = \"SomeDomain\", subType = \"CREATE\")\npublic void auditedMethod(Map\u003cString, String\u003e details) {\n    ...\n}\n```\n\nThe next two examples show how to add an ID to the audit event based on one of the method arguments - either the \nargument value itself in the first instance, or a field from the argument in the second example.\n\n```java\n@Audited(type = \"SomeDomain\", subType = \"UPDATE\")\npublic void auditedMethod(@Audited.Id long id) {\n    ...\n}\n\n@Audited(type = \"SomeDomain\", subType = \"UPDATE\")\npublic void auditedMethod(Audited.Id(\"idField\") Domain details) {\n    ...\n}\n```\n\nNext are examples of how to use the return value for the ID value. Syntactically, the `@Audited.Id` annotation is applied\nto the method in these examples, however writing the code as shown below shows the intent of the annotation in a more\nreadable way.\n\n```java\n@Audited(type = \"SomeDomain\", subType = \"CREATE\") {\npublic @Audited.Id String auditedMethod() {\n    return \"Some ID value\";\n}\n\n@Audited(type = \"SomeDomain\", subType = \"CREATE\") {\npublic @Audited.Id(\"idField\") Domain auditedMethod() {\n    return new Domain(\"ID\");\n}\n```\n\nTo add further context to the audit events generated, apply the `@Audited.Detail` annotation to the method arguments.\nThis annotation can be applied to multiple arguments, however if multiple arguments are annotated, the name must be \nannotated. The annotated arguments are included as a JSON object in the adit event.\n\n```java\n@Audited(type = \"SomeDomain\", subType = \"UPDATE\") {\npublic void auditedMethod(@Audited.Detail Domain details) {\n    ...\n}\n\n@Audited(type = \"SomeDomain\", subType = \"UPDATE\") {\npublic void auditedMethod(@Audited.Detail(\"arg1\") Domain details1, @Audited.Detail(\"arg2\") Domain details2) {\n    ...\n}\n```\n\nBuilding locally\n================\n\nTo build the library, run the following maven command:\n\n```shell\n$ ./mvnw clean install\n```\n\nRelease\n=======\n\nTo build a release and upload to Maven Central push to `main`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspt-development%2Fspt-development-audit-spring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspt-development%2Fspt-development-audit-spring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspt-development%2Fspt-development-audit-spring/lists"}