Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
apk-tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
alpine
apk-tools
Commits
769bb19b
Commit
769bb19b
authored
5 months ago
by
Timo Teräs
Browse files
Options
Downloads
Patches
Plain Diff
fetch: validate downloaded package against repository
Use the repository hash to validate the package. fixes
#11027
parent
229dccea
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/app_fetch.c
+7
-7
7 additions, 7 deletions
src/app_fetch.c
with
7 additions
and
7 deletions
src/app_fetch.c
+
7
−
7
View file @
769bb19b
...
...
@@ -16,6 +16,7 @@
#include
"apk_applet.h"
#include
"apk_database.h"
#include
"apk_extract.h"
#include
"apk_io.h"
#include
"apk_print.h"
#include
"apk_solver.h"
...
...
@@ -153,6 +154,7 @@ static int fetch_package(struct apk_database *db, const char *match, struct apk_
struct
apk_ostream
*
os
;
struct
apk_repository
*
repo
;
struct
apk_file_info
fi
;
struct
apk_extract_ctx
ectx
;
char
url
[
PATH_MAX
],
filename
[
256
];
int
r
,
urlfd
;
...
...
@@ -207,13 +209,11 @@ static int fetch_package(struct apk_database *db, const char *match, struct apk_
goto
err
;
}
apk_stream_copy
(
is
,
os
,
pkg
->
size
,
progress_cb
,
ctx
,
0
);
apk_ostream_copy_meta
(
os
,
is
);
apk_istream_close
(
is
);
r
=
apk_ostream_close
(
os
);
if
(
r
)
goto
err
;
goto
done
;
is
=
apk_istream_tee
(
is
,
os
,
APK_ISTREAM_TEE_COPY_META
,
progress_cb
,
ctx
);
apk_extract_init
(
&
ectx
,
db
->
ctx
,
NULL
);
apk_extract_verify_identity
(
&
ectx
,
pkg
->
digest_alg
,
apk_pkg_digest_blob
(
pkg
));
r
=
apk_extract
(
&
ectx
,
is
);
if
(
r
==
0
)
goto
done
;
err:
apk_err
(
out
,
PKG_VER_FMT
": %s"
,
PKG_VER_PRINTF
(
pkg
),
apk_error_str
(
r
));
ctx
->
errors
++
;
...
...
This diff is collapsed.
Click to expand it.
Timo Teräs
@fabled
mentioned in commit
7763d4ed
·
4 months ago
mentioned in commit
7763d4ed
mentioned in commit 7763d4edde0813e3bb0c38fd5cb396b11f2c7dc5
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment