{"id":16560667,"url":"https://github.com/bgalek/safe-svg","last_synced_at":"2026-03-10T02:31:31.397Z","repository":{"id":44885598,"uuid":"175808841","full_name":"bgalek/safe-svg","owner":"bgalek","description":"Simple and lightweight library that helps to validate SVG files in security manners.","archived":false,"fork":false,"pushed_at":"2026-03-09T12:21:32.000Z","size":447,"stargazers_count":45,"open_issues_count":3,"forks_count":8,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-03-09T17:10:56.806Z","etag":null,"topics":["hacktoberfest","security","svg","xss","xss-detection"],"latest_commit_sha":null,"homepage":"https://detektywi.it/2019/03/bezpieczny-svg/","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/bgalek.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":"SECURITY.md","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":"2019-03-15T11:36:28.000Z","updated_at":"2026-03-09T12:21:30.000Z","dependencies_parsed_at":"2023-02-16T06:40:21.163Z","dependency_job_id":"fb94e7bd-a923-42b1-a050-1c81c5260b70","html_url":"https://github.com/bgalek/safe-svg","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/bgalek/safe-svg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgalek%2Fsafe-svg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgalek%2Fsafe-svg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgalek%2Fsafe-svg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgalek%2Fsafe-svg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bgalek","download_url":"https://codeload.github.com/bgalek/safe-svg/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgalek%2Fsafe-svg/sbom","scorecard":{"id":235994,"data":{"date":"2025-08-11","repo":{"name":"github.com/bgalek/safe-svg","commit":"0ffb949baf6ea07bdd6886f0cd9b085662fcdff8"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.8,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/1 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":"Binary-Artifacts","score":9,"reason":"binaries present in source code","details":["Warn: binary detected: gradle/wrapper/gradle-wrapper.jar:1"],"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":"Security-Policy","score":4,"reason":"security policy file detected","details":["Info: security policy file detected: SECURITY.md:1","Warn: no linked content found","Info: Found disclosure, vulnerability, and/or timelines in security policy: SECURITY.md:1","Info: Found text in security policy: SECURITY.md:1"],"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":"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":"Maintained","score":5,"reason":"6 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 5","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: topLevel 'contents' permission set to 'write': .github/workflows/build.yml:8","Warn: no topLevel permission defined: .github/workflows/publish.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":"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:14: update your workflow using https://app.stepsecurity.io/secureworkflow/bgalek/safe-svg/build.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/bgalek/safe-svg/build.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/bgalek/safe-svg/build.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/bgalek/safe-svg/build.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:37: update your workflow using https://app.stepsecurity.io/secureworkflow/bgalek/safe-svg/build.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:9: update your workflow using https://app.stepsecurity.io/secureworkflow/bgalek/safe-svg/publish.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/bgalek/safe-svg/publish.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/publish.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/bgalek/safe-svg/publish.yml/main?enable=pin","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   4 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":"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":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"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":"Packaging","score":10,"reason":"packaging workflow detected","details":["Info: Project packages its releases by way of GitHub Actions.: .github/workflows/publish.yml:6"],"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":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"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 29 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"}}]},"last_synced_at":"2025-08-17T05:47:00.795Z","repository_id":44885598,"created_at":"2025-08-17T05:47:00.795Z","updated_at":"2025-08-17T05:47:00.795Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30322645,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T01:36:58.598Z","status":"online","status_checked_at":"2026-03-10T02:00:06.579Z","response_time":106,"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":["hacktoberfest","security","svg","xss","xss-detection"],"created_at":"2024-10-11T20:29:43.034Z","updated_at":"2026-03-10T02:31:31.375Z","avatar_url":"https://github.com/bgalek.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SVG SECURITY\n\n\u003e Simple and lightweight library that helps to validate SVG files in security manners.\n\n[![Build](https://github.com/bgalek/safe-svg/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/bgalek/safe-svg/actions/workflows/build.yml)\n![Codecov](https://img.shields.io/codecov/c/github/bgalek/safe-svg.svg?style=flat-square)\n![GitHub Release Date](https://img.shields.io/github/release-date/bgalek/safe-svg.svg?style=flat-square)\n![Maven Central](https://img.shields.io/maven-central/v/com.github.bgalek.security.svg/safe-svg?style=flat-square)\n![Libraries.io dependency status for GitHub repo](https://img.shields.io/librariesio/github/bgalek/safe-svg.svg?style=flat-square)\n![Scrutinizer code quality](https://img.shields.io/scrutinizer/g/bgalek/safe-svg.svg?style=flat-square)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=bgalek_safe-svg\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=bgalek_safe-svg?style=flat-square)\n\nIt will help you in detecting malicious content inside uploaded SVGs.\n\n## Are you aware that SVG can cause XSS?\n\nRead [https://sekurak.pl/pozwalasz-ladowac-pliki-svg-masz-xss-a/](https://sekurak.pl/pozwalasz-ladowac-pliki-svg-masz-xss-a/) for more details.\n\n## Example\n\nTry to upload this SVG into your application, if it passes through and user can browse this file - probably You are vulnerable to XSS attack.\n\n```xml\n\u003c?xml version=\"1.0\" standalone=\"no\"?\u003e\n\u003c!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\"\u003e\n\u003csvg version=\"1.1\" baseProfile=\"full\" xmlns=\"http://www.w3.org/2000/svg\"\u003e\n\u003cpolygon id=\"triangle\" points=\"0,0 0,50 50,0\" fill=\"#009900\" stroke=\"#004400\"/\u003e\n\u003cscript type=\"text/javascript\"\u003e\nalert('Hello, world!');\n\u003c/script\u003e\n\u003c/svg\u003e\n```\n\n## Usage\n\nAdd library dependency:\n\n```groovy\ncompile \"com.github.bgalek.security.svg:safe-svg:1.1.4\"\n```\n\nYou can use this library to check uploaded svg files\n\n```java\nSvgSecurityValidator svgSecurityValidator = SvgSecurityValidator.builder().build();\nString svg = \"\u003c?xml version=\\\"1.0\\\" standalone=\\\"no\\\"?\u003e\\n\" +\n                \"\u003c!DOCTYPE svg PUBLIC \\\"-//W3C//DTD SVG 1.1//EN\\\" \\\"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\\\"\u003e\\n\" +\n                \"\u003csvg version=\\\"1.1\\\" baseProfile=\\\"full\\\" xmlns=\\\"http://www.w3.org/2000/svg\\\"\u003e\\n\" +\n                \"\u003cpolygon id=\\\"triangle\\\" points=\\\"0,0 0,50 50,0\\\" fill=\\\"#009900\\\" stroke=\\\"#004400\\\"/\u003e\\n\" +\n                \"\u003cscript type=\\\"text/javascript\\\"\u003e\\n\" +\n                \"alert('Hello, world!');\\n\" +\n                \"\u003c/script\u003e\\n\" +\n                \"\u003c/svg\u003e\";\n        ValidationResult validation = svgSecurityValidator.validate(svg);\n        if (validation.hasViolations()) {\n            throw new RuntimeException(\"this file is suspicious\" + validation.getOffendingElements());\n        }\n```\n\nIf you want to allow other (possibly non-safe) elements/attributes use\n\n```java\nValidationResult detect = SvgSecurityValidator.builder()\n    .withAdditionalElements(elements)\n    .withAdditionalAttributes(attributes)\n    .build()\n    .validate(testFile);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbgalek%2Fsafe-svg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbgalek%2Fsafe-svg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbgalek%2Fsafe-svg/lists"}