-
Notifications
You must be signed in to change notification settings - Fork 0
ci: block rustfmt+cargo-deny; api: CSV include_header examples #27
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
Changes from all commits
7848a98
45388ae
7b5976c
e22cc4f
7725806
00200b0
9f5b47c
5b60022
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,135 +1,32 @@ | ||
| # cargo-deny configuration for Jive Money project | ||
| # This configuration helps ensure security, licensing compliance, and dependency management | ||
|
|
||
| # The path where the deny.toml file is located relative to the workspace root | ||
| [graph] | ||
| # The file system path to the graph file to use | ||
| # targets = [] | ||
|
|
||
| # Deny certain platforms from being used | ||
| [targets] | ||
| # The field that will be checked, this value must be one of | ||
| # - triple | ||
| # - arch | ||
| # - os | ||
| # - env | ||
| # | ||
| # cfg = "triple" | ||
| # The value to match | ||
| # value = "x86_64-unknown-linux-gnu" | ||
| ############################ | ||
| # Minimal cargo-deny config | ||
| ############################ | ||
|
|
||
| [advisories] | ||
| # The lint level for advisories that are for crates that are not direct dependencies | ||
| db-path = "~/.cargo/advisory-db" | ||
| db-urls = ["https://github.com/rustsec/advisory-db"] | ||
| # The lint level for crates that have a vulnerability | ||
| vulnerability = "deny" | ||
| # The lint level for crates that have been marked as unmaintained | ||
| unmaintained = "warn" | ||
| # The lint level for crates that have been yanked from crates.io | ||
| yanked = "deny" | ||
| # A list of advisory IDs to ignore | ||
| ignore = [ | ||
| # These are known issues that we've evaluated and determined acceptable | ||
| # Add RUSTSEC advisory IDs here if needed | ||
| ] | ||
| vulnerabilities = "deny" | ||
| unmaintained = "warn" | ||
| yanked = "warn" | ||
| notice = "warn" | ||
| ignore = [] | ||
|
|
||
| [licenses] | ||
| # List of explicitly allowed licenses | ||
| # See https://spdx.org/licenses/ for list of valid identifiers | ||
| unlicensed = "deny" | ||
| allow = [ | ||
| "MIT", | ||
| "Apache-2.0", | ||
| "Apache-2.0 WITH LLVM-exception", | ||
| "BSD-2-Clause", | ||
| "BSD-3-Clause", | ||
| "ISC", | ||
| "Unicode-DFS-2016", | ||
| "OpenSSL", | ||
| "MPL-2.0", | ||
| "CC0-1.0", | ||
| "BSL-1.0", # Boost Software License | ||
| "Zlib", | ||
| "Unlicense", | ||
| ] | ||
|
|
||
| # List of explicitly disallowed licenses | ||
| deny = [ | ||
| "GPL-2.0", | ||
| "GPL-3.0", | ||
| "AGPL-3.0", | ||
| "LGPL-2.0", | ||
| "LGPL-2.1", | ||
| "LGPL-3.0", | ||
| "SSPL-1.0", # Server Side Public License (MongoDB) | ||
| "MIT", "Apache-2.0", "BSD-2-Clause", "BSD-3-Clause", "ISC", | ||
| "Unicode-DFS-2016", "MPL-2.0", "Zlib", "BSL-1.0", "CC0-1.0", "Unlicense", "OpenSSL" | ||
| ] | ||
|
|
||
| # Lint level for when multiple versions of the same license are detected | ||
| copyleft = "deny" | ||
| # Blanket approval or denial for OSI-approved or FSF-approved licenses | ||
| allow-osi-fsf-free = "both" | ||
| # Lint level used when no license is detected | ||
| default = "deny" | ||
| # The confidence threshold for detecting a license from a license text. | ||
| # Expressed as a floating point number between 0.0 and 1.0 | ||
| copyleft = "warn" | ||
| confidence-threshold = 0.8 | ||
|
|
||
| # Allow certain licenses for specific crates only | ||
| [[licenses.exceptions]] | ||
| allow = ["ring", "webpki"] | ||
| name = "ISC" | ||
|
|
||
| [bans] | ||
| # Lint level for when multiple versions of the same crate are detected | ||
| multiple-versions = "warn" | ||
| # Lint level for when a crate version requirement is `*` | ||
| wildcards = "allow" | ||
| # The graph highlighting used when creating dotgraphs for crates | ||
| highlight = "all" | ||
|
|
||
| # List of crates to deny | ||
| deny = [ | ||
| # Deny old/insecure crypto libraries | ||
| { name = "openssl", version = "<0.10" }, | ||
| # Deny old/vulnerable versions of common crates | ||
| { name = "serde", version = "<1.0" }, | ||
| # Deny yanked crates | ||
| { name = "chrono", version = "=0.4.20" }, # Had a security issue | ||
| ] | ||
|
|
||
| # Certain crates/versions that will be skipped when doing duplicate detection. | ||
| skip = [ | ||
| # Skip certain crates that commonly have multiple versions | ||
| { name = "windows-sys" }, # Often multiple versions in dependency tree | ||
| { name = "syn", version = "1.0" }, # v1 and v2 coexist | ||
| ] | ||
|
|
||
| # Similarly to `skip` allows you to skip certain crates from being checked. Unlike `skip`, | ||
| # `skip-tree` skips the crate and all of its dependencies entirely. | ||
| skip-tree = [ | ||
| # Skip crates and their entire dependency trees | ||
| ] | ||
| deny = [] | ||
| skip = [] | ||
| skip-tree = [] | ||
|
|
||
| [sources] | ||
| # Lint level for what to happen when a crate from a crate registry that is | ||
| # not in the allow list is encountered | ||
| unknown-registry = "warn" | ||
| # Lint level for what to happen when a crate from a git repository that is not | ||
| # in the allow list is encountered | ||
| unknown-git = "warn" | ||
|
|
||
| # List of allowed registries | ||
| allow-registry = [ | ||
| "https://github.com/rust-lang/crates.io-index", | ||
| ] | ||
|
|
||
| # List of allowed Git repositories | ||
| allow-git = [ | ||
| # Allow specific git dependencies if needed | ||
| # "https://github.com/organization/repository" | ||
| ] | ||
|
|
||
| # Configuration specific to the jive-api workspace | ||
| [[sources.allow-org]] | ||
| github = ["jive-org"] # Replace with actual GitHub organization | ||
| gitlab = ["jive-gitlab"] # Replace with actual GitLab organization if used | ||
| unknown-git = "warn" | ||
| allow-registry = ["https://github.com/rust-lang/crates.io-index"] | ||
| allow-git = [] |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -138,3 +138,17 @@ quick-start: build dev | |||||
| @echo "API: http://localhost:8012" | ||||||
| @echo "Adminer: http://localhost:8080" | ||||||
| @echo "RedisInsight: http://localhost:8001" | ||||||
|
|
||||||
| # 便捷:导出/审计(支持 include_header 传参) | ||||||
|
||||||
| # 便捷:导出/审计(支持 include_header 传参) | |
| # Convenience: export/audit (supports include_header parameter) |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pipe | head -n 20 in the export-csv-stream target is likely not behaving as intended. The curl command uses -o /tmp/transactions_export.csv to write the response body to a file, and -D - to write headers to standard output. As a result, head -n 20 will only process the response headers, not the CSV content.
To preview the first 20 lines of the downloaded CSV file, you should first let curl finish downloading and then run head on the output file. I've also removed the -D - flag which prints headers to standard output, as it would interfere with previewing the file content.
curl -s -H "Authorization: Bearer $${TOKEN}" \
"http://localhost:$${API_PORT:-8012}/api/v1/transactions/export.csv?include_header=$${HEADER:-true}" \
-o /tmp/transactions_export.csv && head -n 20 /tmp/transactions_export.csv
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Downloading and executing binaries from external URLs without verification poses a security risk. Consider using a GitHub Action like
EmbarkStudios/cargo-deny-actionor verify the binary checksum after download.Copilot uses AI. Check for mistakes.